本文整理汇总了C++中pd_new函数的典型用法代码示例。如果您正苦于以下问题:C++ pd_new函数的具体用法?C++ pd_new怎么用?C++ pd_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pd_new函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: post
/*--------------------------------------------------------------------
* new SIZE
*--------------------------------------------------------------------*/
static void *weightmap_new(t_floatarg f, t_floatarg max)
{
t_weightmap *x;
int i;
x = (t_weightmap *)pd_new(weightmap_class);
// create float (index) outlet
outlet_new(&x->x_obj, &s_float);
// create list (dump) outlet
x->x_dumpoutlet = outlet_new(&x->x_obj, &s_list);
// set number of elements
x->x_nvalues = f;
if ( x->x_nvalues < 1 ) x->x_nvalues = 1;
// set maximum expected input probability
x->x_wmax = max;
if (!x->x_wmax) x->x_wmax = DEFAULT_WEIGHT_MAX;
// allocate weight-vector
x->x_weights = (t_float *)getbytes(x->x_nvalues*sizeof(t_float));
if (!x->x_weights) {
pd_error(x,"weightmap : failed to allocate weight vector");
return NULL;
}
// initialize weights
for (i = 0; i < x->x_nvalues; i++) {
*(x->x_weights+i) = DEFAULT_WEIGHT_VALUE;
}
// initialize sum
x->x_wsum = DEFAULT_WEIGHT_VALUE * x->x_nvalues;
#ifdef WEIGHTMAP_DEBUG
post("weightmap_debug : create : nvalues=%d , wmax=%f", x->x_nvalues, x->x_wmax);
#endif
return (void *)x;
}
示例2: sizeof
/*
* Q.2 - Création d'un nouvel objet scs
*/
void *scs_tilde_new(int argc, t_atom * argv)
{
int i = 0;
t_scs_tilde *m = (t_scs_tilde *)pd_new(scs_tilde_class);
m->bypass = 0;
m->autonorm = 1;
m->shapeWidth = 1;
// Si argument present
switch (argc) {
// Bypass en argument
case 2 :
m->bypass = atom_getint(argv + (1 * sizeof(t_atom)));
case 1 :
m->autonorm = atom_getint(argv);
default :
break;
}
m->x_in2 = inlet_new(&m->x_obj, &m->x_obj.ob_pd,
&s_signal, &s_signal);
floatinlet_new(&m->x_obj, &m->shapeWidth);
m->messages = inlet_new(&m->x_obj,
&m->x_obj.ob_pd,
gensym("list"),
gensym("messages"));
m->x_out = outlet_new(&m->x_obj, &s_signal);
m->window = malloc(SIZE * sizeof * m->window);
m->bitshuffle = malloc(SIZE * 2 * sizeof * m->bitshuffle);
m->weighting = malloc(SIZE * 2 * sizeof * m->weighting);
for (i = 0; i<SIZE; i++) {
m->window[i] = (float) (0.54-0.46*(cos (TWOPI * i/SIZE)));
}
init_rdft(SIZE, m->bitshuffle, m->weighting);
return (void *)m;
}
示例3: getbytes
static void *fofsynth_new(t_symbol* s,t_float a,t_float b,t_float c,t_float d)
{
int maxgrains = MAXGRAINS;
t_fofsynth *x = (t_fofsynth *)pd_new(fofsynth_class);
x->debug = 0;
x->x_arrayname = s;
if (s == &s_)
x->x_arrayname = NULL;
/* setup the grain queue */
x->grainbase = getbytes(sizeof(t_grain)*maxgrains);
x->maxgrains = maxgrains;
grain_makecyclic(x->grainbase,maxgrains);
x->grainstart = x->grainbase;
x->grainend = x->grainbase;
x->numgrains = 0;
/* some of them could be signals too */
floatinlet_new(&x->x_obj, &x->formfreq);
floatinlet_new(&x->x_obj, &x->risedur);
floatinlet_new(&x->x_obj, &x->falldur);
x->fundph = 0.0;
x->fundfreq = 200.0;
x->formfreq = 600.0;
x->risedur = 5.0;
x->falldur = 140.0;
if (a) x->fundfreq = a;
if (b) x->formfreq = b;
if (c) x->risedur = c;
if (d) x->falldur = d;
outlet_new(&x->x_obj, &s_signal);
return (x);
}
示例4: gensym
static void *modulo_counter_new(t_symbol *s, int ac, t_atom *av)
{
t_modulo_counter *x = (t_modulo_counter *)pd_new(modulo_counter_class);
int max = 1, cur = 0;
if((ac > 0) && IS_A_FLOAT(av, 0))
max = atom_getintarg(0, ac, av);
if((ac > 1) && IS_A_FLOAT(av, 1))
cur = atom_getintarg(1, ac, av);
if(max < 1)
x->x_max = 1;
else
x->x_max = max;
if(cur < 0)
cur = 0;
if(cur >= x->x_max)
cur = x->x_max - 1;
x->x_cur = cur;
outlet_new(&x->x_obj, &s_float);
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
return (x);
}
示例5: post
static void *toggle_mess_new(t_symbol *s, int ac, t_atom *av)
{
t_toggle_mess *x = (t_toggle_mess *)pd_new(toggle_mess_class);
int i;
if(!ac)
{
post("toggle_mess-ERROR: must have at least one argument!");
x->x_at = (t_atom *)0;
return(0);
}
x->x_ac = ac;
x->x_at = (t_atom *)getbytes(ac * sizeof(t_atom));
for(i=0; i<ac; i++)
x->x_at[i] = *av++;
x->x_index = 0;
x->x_set = gensym("set");
outlet_new(&x->x_obj, &s_list);
x->x_out_mid_sym = outlet_new(&x->x_obj, &s_list);
x->x_out_rght_flt = outlet_new(&x->x_obj, &s_float);
return(x);
}
示例6: gensym
void *residency_buffer_new(t_symbol *msg, short argc, t_atom *argv)
{
t_residency_buffer *x = (t_residency_buffer *)pd_new(residency_buffer_class);
t_fftease *fft;
inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal"));
inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal"));
outlet_new(&x->x_obj, gensym("signal"));
outlet_new(&x->x_obj, gensym("signal"));
x->size_outlet = outlet_new(&x->x_obj, gensym("float"));
x->fft = (t_fftease *) calloc(1,sizeof(t_fftease));
fft = x->fft;
fft->initialized = 0;
fft->N = FFTEASE_DEFAULT_FFTSIZE;
fft->overlap = FFTEASE_DEFAULT_OVERLAP;
fft->winfac = FFTEASE_DEFAULT_WINFAC;
if(argc > 0){ x->buffername = atom_getsymbolarg(0, argc, argv); }
else { post("%s: Must specify array name", OBJECT_NAME); return NULL; }
if(argc > 1){ fft->N = (int) atom_getfloatarg(1, argc, argv); }
if(argc > 2){ fft->overlap = (int) atom_getfloatarg(2, argc, argv); }
return x;
}
示例7: OpNew
OpPtr OpNew(SymbolPtr msg, AtomCount argc, AtomPtr argv)
{
OpPtr self;
TTValue v;
TTErr err;
self = OpPtr(pd_new(sOpClass));
if (self) {
self->outlet = outlet_new(SELF, gensym("audio.connect"));
v.setSize(2);
v.set(0, TT("operator"));
v.set(1, TTUInt32(1));
err = TTObjectInstantiate(TT("audio.object"), (TTObjectPtr*)&self->audioGraphObject, v);
if (!self->audioGraphObject->getUnitGenerator()) {
error("op≈: cannot load Jamoma DSP object");
return NULL;
}
}
return self;
}
示例8: gensym
static void *cd4516_new(t_symbol *s, int argc, t_atom *argv)
{
t_cd4516 *x;
x = (t_cd4516 *)pd_new(cd4516_class);
if (x == NULL) return (x);
x->x_Q1Out = outlet_new((t_object *)x, &s_float);
x->x_Q2Out = outlet_new((t_object *)x, &s_float);
x->x_Q3Out = outlet_new((t_object *)x, &s_float);
x->x_Q4Out = outlet_new((t_object *)x, &s_float);
x->x_CarryOut = outlet_new((t_object *)x, &s_float);
x->x_UpDownIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("updown"));
x->x_ResetIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("reset"));
x->x_PresetEnableIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("presetenable"));
x->x_CarryIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("carry"));
x->x_P1In = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("P1"));
x->x_P2In = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("P2"));
x->x_P3In = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("P3"));
x->x_P4In = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("P4"));
return (x);
}
示例9: sprintf
/* The class might have been created by another dll...
This is public, because apart from the "_patchboard" class above,
it is called for the "_raftentry" class too. LATER rethink. */
t_class *patchvalue_classnew(t_symbol *cname, size_t size)
{
t_class *cls;
t_symbol *bindsym;
char buf[MAXPDSTRING];
sprintf(buf, "#%s", cname->s_name);
bindsym = gensym(buf);
if (bindsym->s_thing)
{
t_pd *pd = bindsym->s_thing;
char *name = class_getname(*pd);
if (strcmp(name, cname->s_name))
{
/* FIXME handle this properly... */
loudbug_bug("patchvalue_classnew");
}
else return (*pd);
}
cls = class_new(cname, 0, 0, size, CLASS_PD | CLASS_NOINLET, 0);
pd_bind(pd_new(cls), bindsym); /* never unbound */
return (cls);
}
示例10: gensym
static void *cd4076_new(t_symbol *s, int argc, t_atom *argv)
{
t_cd4076 *x;
x = (t_cd4076 *)pd_new(cd4076_class);
if (x == NULL) return (x);
x->x_output_A = outlet_new((t_object *)x, &s_float);
x->x_output_B = outlet_new((t_object *)x, &s_float);
x->x_output_C = outlet_new((t_object *)x, &s_float);
x->x_output_D = outlet_new((t_object *)x, &s_float);
x->x_clear = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("clear"));
x->x_input_disable_1 = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("inputdisable1"));
x->x_input_disable_2 = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("inputdisable2"));
x->x_output_disable_1 = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("outputdisable1"));
x->x_output_disable_2 = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("outputdisable2"));
x->x_input_A = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("inputA"));
x->x_input_B = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("inputB"));
x->x_input_C = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("inputC"));
x->x_input_D = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("inputD"));
return (x);
}
示例11: gensym
static void *cd40193_new(t_symbol *s, int argc, t_atom *argv)
{
t_cd40193 *x;
x = (t_cd40193 *)pd_new(cd40193_class);
if (x == NULL) return (x);
x->x_QAOut = outlet_new((t_object *)x, &s_float);
x->x_QBOut = outlet_new((t_object *)x, &s_float);
x->x_QCOut = outlet_new((t_object *)x, &s_float);
x->x_QDOut = outlet_new((t_object *)x, &s_float);
x->x_CarryOut = outlet_new((t_object *)x, &s_float);
x->x_BorrowOut = outlet_new((t_object *)x, &s_float);
x->x_CountDownIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("countdown"));
x->x_ClearIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("clear"));
x->x_LoadIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("load"));
x->x_DataAIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("dataA"));
x->x_DataBIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("dataB"));
x->x_DataCIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("dataC"));
x->x_DataDIn = inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("dataD"));
return (x);
}
示例12: fittermax_rangewarning
static void *bangbang_new(t_floatarg val)
{
t_bangbang *x;
int i, nouts = (int)val;
t_outlet **outs;
if (nouts < BANGBANG_MINOUTS)
nouts = BANGBANG_DEFOUTS;
if (nouts > BANGBANG_C74MAXOUTS)
fittermax_rangewarning(bangbang_class, BANGBANG_C74MAXOUTS, "outlets");
if (nouts > BANGBANG_DEFOUTS)
{
if (!(outs = (t_outlet **)getbytes(nouts * sizeof(*outs))))
return (0);
}
else outs = 0;
x = (t_bangbang *)pd_new(bangbang_class);
x->x_nouts = nouts;
x->x_outs = (outs ? outs : x->x_outbuf);
for (i = 0; i < nouts; i++)
x->x_outs[i] = outlet_new((t_object *)x, &s_bang);
return (x);
}
示例13: dsp_setup
void *presidency_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
t_presidency *x = (t_presidency *)newobject(presidency_class);
dsp_setup((t_pxobject *)x,4);
outlet_new((t_pxobject *)x, "signal");
outlet_new((t_pxobject *)x, "signal");
#endif
#if PD
t_presidency *x = (t_presidency *)pd_new(presidency_class);
inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal"));
inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal"));
inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal"));
outlet_new(&x->x_obj, gensym("signal"));
outlet_new(&x->x_obj, gensym("signal"));
#endif
x->duration = atom_getfloatarg(0,argc,argv)/1000.0;
x->lo_freq = atom_getfloatarg(1,argc,argv);
x->hi_freq = atom_getfloatarg(2,argc,argv);
x->overlap = atom_getfloatarg(3,argc,argv);
x->winfac = atom_getfloatarg(4,argc,argv);
x->D = sys_getblksize();
x->R = sys_getsr();
x->vector_size = x->D;
x->topfreq = 3000.; // default top freq
if(!x->lo_freq){
x->lo_freq = 0;
}
if(!x->hi_freq)
x->hi_freq = 4000.0;
presidency_init(x,0);
return (x);
}
示例14: gensym
static void *average_new(t_floatarg f)
{
int i;
t_average *x = (t_average *)pd_new(average_class);
x->x_inindex = inlet_new(&x->x_ob, &x->x_ob.ob_pd, gensym("float"), gensym("index"));
x->x_outfloat = outlet_new(&x->x_ob, gensym("float"));
x->x_outtendency = outlet_new(&x->x_ob, gensym("float"));
/* zeroe out the array */
for(i = 0; i < MAX_ARG; i++)x->x_input[i] = 0.0;
x->x_index = (t_int)f;
if(x->x_index > MAX_ARG)
{
x->x_index = MAX_ARG;
post("average: set number of items to %d", x->x_index);
}
x->x_inpointer = 0;
x->x_average = 0;
x->x_mode = 0;
return (void *)x;
}
示例15: new
static void*freeframe_loader_new(t_symbol*s, int argc, t_atom*argv) {
if(!s){
::verbose(2, "freeframe_loader: no name given");
return 0;
}
::verbose(2, "freeframe_loader: %s",s->s_name);
try{ \
Obj_header *obj = new (pd_new(pix_freeframe_class),(void *)NULL) Obj_header;
char*realname=s->s_name+offset_pix_; /* strip of the leading 'pix_' */
CPPExtern::m_holder = &obj->pd_obj;
CPPExtern::m_holdname=s->s_name;
obj->data = new pix_freeframe(gensym(realname));
CPPExtern::m_holder = NULL;
CPPExtern::m_holdname=NULL;
return(obj);
} catch (GemException&e) {
::verbose(2, "freeframe_loader: failed! (%s)", e.what());
return 0;
}
return 0;
}