/* create new instance of object... MUST send it an int even if you do nothing with this int!! */
void *def_ls_new(t_symbol *s, int ac, t_atom *av)	
{
	// s is object name (we ignore it)
	t_def_ls *x = (t_def_ls *) object_alloc((t_class*) (def_ls_class));

	x->x_outlet0 =  outlet_new(x, 0L);	/* create a (list) outlet */

	initContent_ls_directions(x,ac,av); // Initialize object internal data from a ls-directions list

	return x;					/* return a reference to the object instance */
}
Ejemplo n.º 2
0
void *pokef_new(t_symbol *s, long chan)
{
	t_pokef *x = (t_pokef *)object_alloc(pokef_class);
	//dsp_setup((t_pxobject *)x, 1);
    intin((t_object *)x, 3);
	dsp_setup((t_pxobject *)x, 3);
	outlet_new((t_object *)x, "signal");
	pokef_set(x, s);
	pokef_in3(x,chan);
	//x->l_obj.z_misc = Z_NO_INPLACE;
	return (x);
}
void *bufconvolve_new  (t_symbol *s, short argc, t_atom *argv)

{
    t_bufconvolve *x = (t_bufconvolve *)object_alloc (this_class);
	
	x->process_done = bangout(x);
	
	init_HIRT_common_attributes(x);
	attr_args_process(x, argc, argv);
	
	return(x);
}
Ejemplo n.º 4
0
/* function run to create a new instance of the t_slice class */
void *slice_new(long s)
{
	t_slice *x;							/* object we'll be creating */
	
	x = (t_slice *)object_alloc(s_slice_class);	/* allocates memory and sticks in an inlet */
	intin(x, 1);                        	/* added jun 96 rdd - was missing from code */
	x->s_out2 = intout(x);
	x->s_out1 = intout(x);
	x->s_len = 0;
	x->s_split = s < 1 ? 1 : s;
	return (x);						/* always return a copy of the created object */
}
Ejemplo n.º 5
0
void *howbigisyourp_new(t_symbol *s, long argc, t_atom *argv)
{
	t_howbigisyourp *x = NULL;

	if ((x = (t_howbigisyourp *)object_alloc(howbigisyourp_class))) {
		x->subpatchername = gensym("");
		x->out = outlet_new(x, NULL);
		x->hash = hashtab_new(0);
		hashtab_flags(x->hash, OBJ_FLAG_DATA);
	}
	return (x);
}
Ejemplo n.º 6
0
void *folder_new(t_symbol *msg, short argc, t_atom *argv)
{
	t_folder *x = (t_folder *)object_alloc(s_folder_class);;
	if(x){
		object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL));
#ifdef MAC_VERSION
		x->applescript = (t_object*)object_new_typed(_sym_box, gensym("tap.applescript"), 0, NULL);
#endif
    	attr_args_process(x,argc,argv);
    }
 	return (x);
}
Ejemplo n.º 7
0
void *odowncast_new(t_symbol *msg, short argc, t_atom *argv)
{
	t_odowncast *x;
	if((x = (t_odowncast *)object_alloc(odowncast_class))){
		x->outlet = outlet_new((t_object *)x, "FullPacket");
        x->proxy = proxy_new((t_object *)x, 1, &(x->inlet));
		x->timetag_address = NULL;
		x->doubles = x->ints = x->bundles = x->timetags = 1;
		attr_args_process(x, argc, argv);
	}
	return x;
}
Ejemplo n.º 8
0
void *folder_new(t_symbol *msg, short argc, t_atom *argv)
{
	t_folder *x;
		
	x = (t_folder *)object_alloc(folder_class);
	if (x) {
		object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL));

    	attr_args_process(x,argc,argv);
    }
 	return (x);
}
Ejemplo n.º 9
0
void *f0ext_new(double val) {
	t_f0ext *x= (t_f0ext *)object_alloc(f0ext_class);
	if(x) {
        if(val==0.0) {
            x->valRight= 7.0;
        } else {
            x->valRight= val;
        }
        floatin(x, 1);
	}
	return (x);
}
Ejemplo n.º 10
0
void *posit_new(t_symbol *s, long argc, t_atom *argv)
{
	t_posit *x = NULL;
    
	if ((x = (t_posit *)object_alloc(posit_class))) {
	
        x->p_outlet3 = intout(x);
        x->p_outlet2 = bangout(x);
        x->p_outlet = listout(x);
	}
	return (x);
}
Ejemplo n.º 11
0
void *gold_new(long n)
{
	t_gold *x; 
	x = (t_gold *)object_alloc(gold_class);
	if(x){
		x->g_out2 = listout(x);
		x->g_outlet = listout(x);
		x->g_result = 0;
		x->g_goldie = ((sqrt(5) -1.0) * 0.5) ;
	}
	return x;
}
Ejemplo n.º 12
0
void* testterminate_new(t_symbol *s, long argc, t_atom *argv)
{
	t_testterminate *x = (t_testterminate*)object_alloc(s_testterminate_class);
	
	if (x) {
		object_obex_lookup(x, _sym_pound_P, &x->x_patcher);
		x->x_test = (t_test*)gensym("#T")->s_thing;
		attr_args_process(x, (short)argc, argv);
	}
	autocolorbox((t_object*)x);
	return x;
}
void *ircropfade_new()
{
    t_ircropfade *x = (t_ircropfade *)object_alloc (this_class);

    x->process_done = bangout(x);

    x->read_chan = 1;
    x->write_chan = 1;
    x->resize = 1;

    return(x);
}
Ejemplo n.º 14
0
void *wuter_new(double initial_coeff)
{
	int i;

    t_wuter *x = (t_wuter *)object_alloc(wuter_class);
    //zero out the struct, to be careful (takk to jkclayton)
    if (x) { 
        for(i=sizeof(t_pxobject);i<sizeof(t_wuter);i++)  
                ((char *)x)[i]=0; 
	} 
    dsp_setup((t_pxobject *)x,4);
    outlet_new((t_object *)x, "signal");
    outlet_new((t_object *)x, "signal");
    
    x->srate = sys_getsr();
    x->one_over_srate = 1./x->srate;
    x->freq = x->freq1 = x->freq2 = 500.;
    x->res_freq = x->res_freqSave = 500.;
    x->totalEnergy = 0.;
    
	x->shakeEnergy = 0.0;
	for(i=0; i<2; i++) {
		x->output[i] = 0.;
		x->output1[i] = 0.;
		x->output2[i] = 0.;
	}
	x->input = 0.0;
	x->input1 = 0.0;
	x->input2 = 0.0;
	x->sndLevel = 0.0;
	x->gain = 0.0; x->gain1 = 0; x->gain2 = 0;
	x->soundDecay = 0.0;
	x->systemDecay = 0.0;	
	x->shakeEnergy = 1.;
	
    x->shake_damp = 0.9;
    x->shake_max = 0.9;
    x->shake_dampSave = 0.9; 	//damping
    x->shake_maxSave = 0.9;

 	for(i=0; i<3; i++) {
		x->finalZ[i] = 0.;
	}
	
	x->pandropL = x->pandropR = 0.76;
    
    wuter_setup(x);
    
    srand(0.54);
    
    return (x);
}
Ejemplo n.º 15
0
/*------------------------------------ spaceballCreate ---*/
static void *
spaceballCreate(t_symbol * addOrDelta,
                const long pollRate)
{
    SpaceballData * xx = static_cast<SpaceballData *>(object_alloc(gClass));
    
    if (xx)
    {
        xx->fPollClock = NULL;
        xx->fPollQueue = NULL;
        xx->fBufferPos = xx->fDelayCounter = 0;
        xx->fButtons = 0;
        xx->fChunkPulseSent = xx->fInited = xx->fNextCharEscaped = xx->fOutputBlocked = false;
        xx->fReset = xx->fSkipping = xx->fModeDelta = xx->fStopping = false;
        if ((0 > pollRate) || (MAX_POLL_RATE < pollRate))
        {
            LOG_ERROR_2(xx, OUTPUT_PREFIX "invalid polling rate (%ld) for device", pollRate)
            xx->fPollRate = SER_SAMPLE_RATE;
        }
        else
        {
            xx->fPollRate = (pollRate ? pollRate : SER_SAMPLE_RATE);
        }
        /* Set up our connections and private data */
        xx->fProxy = proxy_new(xx, 1L, &xx->fInletNumber);
        xx->fErrorBangOut = static_cast<t_outlet *>(bangout(xx));
        xx->fChunkSendOut = static_cast<t_outlet *>(bangout(xx));
        xx->fDataSendOut = static_cast<t_outlet *>(outlet_new(xx, 0L));  /* list, int */
        xx->fSampleBangOut = static_cast<t_outlet *>(bangout(xx));
        xx->fDataOut = static_cast<t_outlet *>(outlet_new(xx, 0L));   /* normally just a list */
        xx->fPollClock = MAKE_CLOCK(xx, spaceballProcessClock);
        xx->fPollQueue = MAKE_QELEM(xx, spaceballProcessQueue);
        if (! (xx->fProxy && xx->fErrorBangOut && xx->fDataSendOut && xx->fChunkSendOut &&
               xx->fSampleBangOut && xx->fDataOut && xx->fPollClock && xx->fPollQueue))
        {
            LOG_ERROR_1(xx, OUTPUT_PREFIX "unable to create port or clock for device")
            freeobject(reinterpret_cast<t_object *>(xx));
            xx = NULL;
        }
        else
        {
            xx->fResetDuration = ((2000 + xx->fPollRate - 1) / xx->fPollRate);
            xx->fInitDuration = ((1000 + xx->fPollRate - 1) / xx->fPollRate);
            if (addOrDelta != gEmptySymbol)
            {
                spaceballSetMode(xx, addOrDelta);
            }
            clock_delay(xx->fPollClock, xx->fPollRate);
        }
    }
    return xx;
} // spaceballCreate
Ejemplo n.º 16
0
void *cambio_new(void) {
	t_cambio *x;
    
    x = (t_cambio *)object_alloc(cambio_class);
	
	if (x==0) return 0;
    
	x->prev = -987654321.;  // So first sample will always be a change
	
  	dsp_setup((t_pxobject *)x,1);
    x->outlet = floatout(x);
    return x;
}
Ejemplo n.º 17
0
void *hxl_new(long n)
{
	t_hxl *x;
	short 	i;
	x = (t_hxl *)object_alloc(hxl_class);
	if(x) {
		x->h_outlet = intout(x);
		for (i=0; i<8; i++){
			x->h_thelist[i].a_w.w_long = 48;
		}
	}
	return x;
}
Ejemplo n.º 18
0
void *str2ul_new(t_symbol *s, long argc, t_atom *argv)
{
	t_str2ul	*x;
	x = (t_str2ul *)object_alloc(str2ul_class);
	if(x) {
		x->s_outlet = outlet_new(x,0L);
		x->s_mode = 0;
		if(argc >= 1){
			str2ul_mode(x, s, argc, argv);
		}
	}
	return (x);
}
Ejemplo n.º 19
0
void *midside_new(t_symbol *s, long argc, t_atom *argv)
{
    t_midside *x = (t_midside *)object_alloc(midside_class);
    dsp_setup((t_pxobject *)x,2);
    outlet_new((t_pxobject *)x, "signal");
    outlet_new((t_pxobject *)x, "signal");
    
    x->f_fade_time = 5. / 1000.;
    x->f_fade_samples = x->f_fade_time * sys_getsr();
    x->f_middle_gain = x->f_side_gain = 0.5;
    
    return (x);
}
Ejemplo n.º 20
0
void *oflatten_new(t_symbol *msg, short argc, t_atom *argv)
{
	t_oflatten *x;
	if((x = (t_oflatten *)object_alloc(oflatten_class))){
		x->outlet = outlet_new((t_object *)x, "FullPacket");
		x->level = 0;
		x->sep = gensym("");
		x->remove_enclosing_address_if_empty = 1;
		attr_args_process(x, argc, argv);
	}
		   	
	return x;
}
Ejemplo n.º 21
0
void *fftnorm_new(long value)
{
	t_fftnorm *x = (t_fftnorm *)object_alloc(fftnorm_class);;
	if(x){
    	object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL));	// dumpout		
		dsp_setup((t_pxobject *)x, 3);				// Create Object and 2 Inlets
		outlet_new((t_object *)x, "signal");		// Create a signal outlet 
		outlet_new((t_object *)x, "signal");		// Create a signal outlet 
		x->s_bins = value;							// Number of bins in analysis
		//attr_args_process(x,argc,argv);					//handle attribute args			
	}
	return x;										// Return pointer
}
Ejemplo n.º 22
0
void *sdif_fileinfo_new(t_symbol *s, int ac, t_atom *av) {
	t_sdif_fileinfo *x;
	x = object_alloc(sdif_fileinfo_class);	
	if(!x){
		return NULL;
	}
    x->outlet2 = outlet_new(x, 0L);
    x->outlet = outlet_new(x, 0L);
	x->print_NVT_matrices = 1;
	
	sdif_fileinfo_clear(x);
	return (x);
}
Ejemplo n.º 23
0
void *filecontainer_new(t_symbol *msg, short argc, t_atom *argv)
{
    t_filecontainer		*x;

    x = (t_filecontainer *)object_alloc(s_filecontainer_class);;
    if(x) {
        x->sqlite = NULL;
        x->dumpout = outlet_new(x,NULL);
        object_obex_store((void *)x, _sym_dumpout, (object *)x->dumpout);
        attr_args_process(x, argc, argv);
    }
    return (x);
}
Ejemplo n.º 24
0
void *prime_new(long value)
{
	t_prime *x;

	x = (t_prime *)object_alloc(this_class);	// create the new instance and return a pointer to it
	if (x) {
    	object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL));	// dumpout	
		x->p_out = intout(x);		//Create the outlet
		x->right_inlet = proxy_new(x, 1, 0L);
		x->p_value = value;				//Init the prime value
	}
	return(x);						// must return a pointer to the new instance 
}
Ejemplo n.º 25
0
void *hoa_decoder_new(t_symbol *s, long argc, t_atom *argv)
{
	t_hoa_decoder *x = NULL;
    t_dictionary *d = NULL;
    t_dictionary *attr = NULL;
    t_atom_long channels;
    t_symbol*   mode;
	int	order = 1;
    x = (t_hoa_decoder *)object_alloc(hoa_decoder_class);
	if (x)
	{
		if(atom_gettype(argv) == A_LONG)
			order = atom_getlong(argv);
		if(order < 1)
            order = 1;
    
        x->f_decoder    = new Hoa2D::DecoderMulti(order);
        x->f_decoder->setSampleRate(sys_getsr());
        x->f_decoder->setVectorSize(sys_getblksize());
        
        d = (t_dictionary *)gensym("#D")->s_thing;
        if(d && dictionary_getdictionary(d, gensym("saved_object_attributes"), (t_object **)&attr) == MAX_ERR_NONE)
        {
            if(dictionary_getsym(attr, gensym("mode"), &mode) == MAX_ERR_NONE)
            {
                if(mode == gensym("irregular"))
                    x->f_decoder->setDecodingMode(Hoa2D::DecoderMulti::Irregular);
                else if(mode == gensym("binaural"))
                    x->f_decoder->setDecodingMode(Hoa2D::DecoderMulti::Binaural);
                else
                    x->f_decoder->setDecodingMode(Hoa2D::DecoderMulti::Regular);
            }
            if(dictionary_getlong(attr, gensym("channels"), &channels) == MAX_ERR_NONE)
                x->f_decoder->setNumberOfChannels(channels);
            dictionary_getlong(attr, gensym("autoconnect"), &x->f_send_config);
        }
       
		dsp_setup((t_pxobject *)x, x->f_decoder->getNumberOfHarmonics());
        for(int i = 0; i < x->f_decoder->getNumberOfChannels(); i++)
            outlet_new(x, "signal");
        
        x->f_ob.z_misc = Z_NO_INPLACE;
        x->f_ins = new double[x->f_decoder->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
        x->f_outs= new double[MAX_CHANNELS * SYS_MAXBLKSIZE];
        
        if(d)
            attr_dictionary_process(x, d);
	}

	return (x);
}
void *hoa_gain_new(t_symbol *s, short argc, t_atom *argv)
{
    t_hoa_gain *x = NULL;
    t_dictionary *d = NULL;
    
    x = (t_hoa_gain *) object_alloc(s_hoa_gain_class);
    d = object_dictionaryarg(argc, argv);
    
    if (x && d)
    {
        long flags = 0
        | JBOX_DRAWFIRSTIN
        | JBOX_NODRAWBOX
        | JBOX_DRAWINLAST
        | JBOX_GROWBOTH
        | JBOX_DRAWBACKGROUND
        | JBOX_MOUSEDRAGDELTA
        ;
        
        x->j_val = 0;
        x->j_defaultValuedB = 0;
        x->j_valdB = x->j_defaultValuedB;
        x->f_interp = 20;
        x->f_number_of_channels = 8;
        
        jbox_new((t_jbox *)x, flags, argc, argv);
        x->j_box.z_box.b_firstin = (t_object *)x;
        
        x->f_amp = new Line<t_sample>();
        x->f_amp->setRamp((const ulong)(0.1 * sys_getsr()));
        x->f_amp->setValueDirect(1.f);
        
        // inputs
        dsp_setupjbox((t_pxjbox *)x, x->f_number_of_channels + 1);
        
        // outputs
        x->f_outlet_infos = outlet_new(x, NULL);
        for (int i=0; i < x->f_number_of_channels; i++)
            outlet_new(x,"signal");
        
        x->j_box.z_misc = Z_NO_INPLACE;
        
        attr_dictionary_process(x,d); // handle attribute args
        
        hoa_gain_set_dB(x, x->j_defaultValuedB);
        
        jbox_ready((t_jbox *)x);
    }
    
    return x;
}
Ejemplo n.º 27
0
void *dbapBformatNew(t_symbol *msg, long argc, t_atom *argv)
{
	t_dbapBformat *x;
	long i,j;
	
	x = (t_dbapBformat *)object_alloc(this_class);	// create the new instance and return a pointer to it
	
	if (x) {
    	object_obex_store(x, _sym_dumpout, (object *)outlet_new(x,NULL));	// dumpout
		x->outlet = outlet_new(x, 0);				// Left outlet: Feed to matrix~
		
		// Initializing and setting defaults for attributes.
		x->masterGain = 1.;								// default value
		x->attrNumberOfSources = 1;						// default value
		x->attrNumberOfDestinations = 1;				// default value
		x->attrRollOff = 6;								// 6 dB rolloff by default
		x->attrVicinity = 0.15;							// Radius of 0.15 by default
		
		for (i=0; i<MAX_NUM_SOURCES; i++) {
			x->sourcePosition[i].x	= 0.;
			x->sourcePosition[i].y	= 0.;
			x->sourcePosition[i].z	= 0.;
			x->blur[i]				= 0.000001;
			x->sourceGain[i]		= 1.0;
			x->sourceNotMuted[i]	= 1.0;
			x->polarity[i]			= 1.0;
		}
		
		for (i=0; i<MAX_NUM_DESTINATIONS; i++) {
			x->destinationPosition[i].x = 0.;
			x->destinationPosition[i].y = 0.;
			x->destinationPosition[i].z = 0.;
		}

		for (i=0;i<MAX_NUM_SOURCES;i++) {
			for (j=0;j<MAX_NUM_DESTINATIONS;j++) {
				x->sourceWeight[i][j] = 1.;
				// TODO: The following initialisation is preliminary
				x->decodeCoefficients[i][j].w = 0.;
				x->decodeCoefficients[i][j].x = 0.;
				x->decodeCoefficients[i][j].y = 0.;
				x->decodeCoefficients[i][j].z = 0.;
			}
		}
		
		attr_args_process(x, argc, argv);			// Handle attribute args
		dbapBformatCalculateA(x);					// Calculate expo0nent coefficiant used for rolloff
		dbapBformatCalculateVariance(x);			// This implisitly also calculate all matrix values
	}
	return (x);										// Return the pointer
}
Ejemplo n.º 28
0
void *rotate_new(t_symbol *s, long argc, t_atom *argv)
{
#if NOCP
	t_rotate	*x = (t_rotate *)object_alloc(rotate_class);
#else
	t_rotate	*x = (t_rotate *)object_alloc(rotate_class);;
#endif

	if(x){
		object_obex_store((void *)x, _sym_dumpout, (object *)outlet_new(x,NULL));	// dumpout
			
		x->inlets[2] = proxy_new(x, 3, &x->inletnum);			
		x->inlets[1] = proxy_new(x, 2, &x->inletnum);			
		x->inlets[0] = proxy_new(x, 1, &x->inletnum);			
		x->outlets[2] = outlet_new(x, 0);
		x->outlets[1] = outlet_new(x, 0);
		x->outlets[0] = outlet_new(x, 0);
		x->numsets = 1;
		
		attr_args_process(x,argc,argv);			 //handle attribute args	
	}
	return x;
}
Ejemplo n.º 29
0
void * example_new(t_symbol *s, long argc, t_atom *argv) {
	Example *x = NULL;
	if ((x = (Example *)object_alloc(max_class))) {
		
		x = new (x) Example();
		
		// apply attrs:
		attr_args_process(x, (short)argc, argv);
		
		// invoke any initialization after the attrs are set from here:
		
	}
	return (x);
}
Ejemplo n.º 30
0
//this gets called when the object is created; everytime the user types in new args, this will get called
void *prc_chorus_new(long baseDelay)
{
    t_prc_chorus *x = (t_prc_chorus *)object_alloc(prc_chorus_class);
    
    if (x) {
		dsp_setup((t_pxobject *)x, 1);		//inputs
		outlet_new((t_object*)x, "signal");	//outputs
		
		if (baseDelay<1)
			baseDelay = 1;
		x->mychorus = new Chorus(baseDelay);
	}
    return x;
}