From 533888d2daff17041b5fc1bb0f9f2eca24d8aa52 Mon Sep 17 00:00:00 2001 From: Jonathan Wilkes <jon.w.wilkes@gmail.com> Date: Tue, 25 Jul 2017 21:04:49 -0400 Subject: [PATCH] allow all iem_ambi objects to instantiate without arguments --- externals/iem/iem_ambi/src/ambi_decode.c | 12 ++++++++++++ externals/iem/iem_ambi/src/ambi_decode2.c | 14 ++++++++++++++ externals/iem/iem_ambi/src/ambi_decode3.c | 13 +++++++++++++ externals/iem/iem_ambi/src/ambi_decode_cube.c | 13 +++++++++++++ 4 files changed, 52 insertions(+) diff --git a/externals/iem/iem_ambi/src/ambi_decode.c b/externals/iem/iem_ambi/src/ambi_decode.c index 2e315bc3c..1dcd5adf3 100644 --- a/externals/iem/iem_ambi/src/ambi_decode.c +++ b/externals/iem/iem_ambi/src/ambi_decode.c @@ -626,6 +626,18 @@ static void *ambi_decode_new(t_symbol *s, int argc, t_atom *argv) t_ambi_decode *x = (t_ambi_decode *)pd_new(ambi_decode_class); int nls, order, dim, i; int nphls=0;/* phantom_loudspeaker */ + t_atom sane_defaults[3]; + + if(!argc) + { + post("ambi_decode: warning: no arguments provided: setting to " + "[ambi_decode 1 2 1]"); + SETFLOAT(sane_defaults, 1.); + SETFLOAT(sane_defaults+1, 2.); + SETFLOAT(sane_defaults+2, 1.); + argc = 3; + argv = sane_defaults; + } if(argc < 3) { diff --git a/externals/iem/iem_ambi/src/ambi_decode2.c b/externals/iem/iem_ambi/src/ambi_decode2.c index c14e84fbf..cc154400b 100644 --- a/externals/iem/iem_ambi/src/ambi_decode2.c +++ b/externals/iem/iem_ambi/src/ambi_decode2.c @@ -718,6 +718,20 @@ static void *ambi_decode2_new(t_symbol *s, int argc, t_atom *argv) int n_ls=0;/* number of loudspeakers */ int n_mir_ls=0;/* number of mirror_loudspeakers */ int n_ph_ls=0;/* number of phantom_loudspeakers */ + t_atom sane_defaults[5]; + + if(!argc) + { + post("ambi_decode2: warning: no arguments provided: setting to " + "[ambi_decode2 1 2 1 0 0]"); + SETFLOAT(sane_defaults, 1.); + SETFLOAT(sane_defaults+1, 2.); + SETFLOAT(sane_defaults+2, 1.); + SETFLOAT(sane_defaults+3, 0.); + SETFLOAT(sane_defaults+4, 0.); + argc = 5; + argv = sane_defaults; + } if((argc >= 5) && IS_A_FLOAT(argv,0) && diff --git a/externals/iem/iem_ambi/src/ambi_decode3.c b/externals/iem/iem_ambi/src/ambi_decode3.c index 46302da9a..5bad7f868 100644 --- a/externals/iem/iem_ambi/src/ambi_decode3.c +++ b/externals/iem/iem_ambi/src/ambi_decode3.c @@ -662,6 +662,19 @@ static void *ambi_decode3_new(t_symbol *s, int argc, t_atom *argv) int order, dim, i; int n_real_ls=0;/* number of loudspeakers */ int n_pht_ls=0;/* number of phantom_loudspeakers */ + t_atom sane_defaults[4]; + + if(!argc) + { + post("ambi_decode3: warning: no arguments provided: setting to " + "[ambi_decode3 1 2 1 0]"); + SETFLOAT(sane_defaults, 1.); + SETFLOAT(sane_defaults+1, 2.); + SETFLOAT(sane_defaults+2, 1.); + SETFLOAT(sane_defaults+3, 0.); + argc = 4; + argv = sane_defaults; + } if((argc >= 4) && IS_A_FLOAT(argv,0) && diff --git a/externals/iem/iem_ambi/src/ambi_decode_cube.c b/externals/iem/iem_ambi/src/ambi_decode_cube.c index a30b421a4..26160b9db 100644 --- a/externals/iem/iem_ambi/src/ambi_decode_cube.c +++ b/externals/iem/iem_ambi/src/ambi_decode_cube.c @@ -695,6 +695,19 @@ static void *ambi_decode_cube_new(t_symbol *s, int argc, t_atom *argv) t_ambi_decode_cube *x = (t_ambi_decode_cube *)pd_new(ambi_decode_cube_class); int nls, order, dim, i; int nphls=0;/* phantom_loudspeaker */ + t_atom sane_defaults[3]; + + if(!argc) + { + post("ambi_decode_cube: warning: no arguments provided: " + "setting to [ambi_decode_cube 1 2 1]"); + SETFLOAT(sane_defaults, 1.); + SETFLOAT(sane_defaults+1, 2.); + SETFLOAT(sane_defaults+2, 1.); + argc = 3; + argv = sane_defaults; + } + if(argc < 3) { -- GitLab