Commit 756fbd5f authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

make classes instantiate with no arguments

parent 0fdd35c7
......@@ -345,11 +345,25 @@ static void *partconv_new(t_symbol *s, int argc, t_atom *argv)
t_partconv *x = (t_partconv *)pd_new(partconv_class);
outlet_new(&x->x_obj, gensym("signal"));
t_atom sane_defaults[2];
if (argc != 2) {
/* Give some sane defaults with no args so we can at least
instantiate and get to the help patch */
if (!argc)
{
post("partconv~: warning: no arguments given");
SETSYMBOL(sane_defaults, &s_);
SETFLOAT(sane_defaults+1, 2.);
argc = 2;
argv = sane_defaults;
}
else
{
post("argc = %d", argc);
error("partconv~: usage: [partconv~ <arrayname> <partsize>]\n\t- partition size must be a power of 2 >= blocksize");
return NULL;
}
}
x->arrayname = atom_getsymbol(argv);
......
......@@ -315,14 +315,27 @@ static void *pvoc_new(t_symbol *s, int argc, t_atom *argv)
{
t_pvoc *x = (t_pvoc *)pd_new(pvoc_class);
int i;
t_atom sane_defaults[3];
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); // pitch-shift inlet
outlet_new(&x->x_obj, gensym("signal"));
if (argc != 3) {
if (!argc)
{
post("partconv~: warning: no arguments given");
SETSYMBOL(sane_defaults, &s_);
SETFLOAT(sane_defaults+1, 2.);
SETFLOAT(sane_defaults+2, 2.);
argc = 3;
argv = sane_defaults;
}
else
{
post("argc = %d", argc);
error("pvoc~: usage: [pvoc~ <arrayname> <fftsize> <overlap>]");
return NULL;
}
}
x->fftsize = atom_getfloatarg(1, argc, argv);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment