Exemplo n.º 1
0
void *kbuffer_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
	t_kbuffer *x = (t_kbuffer *)newobject(kbuffer_class);
	dsp_setup((t_pxobject *)x,1);
	outlet_new((t_object *)x, "signal");
	outlet_new((t_object *)x, "signal");
#endif
#if PD
  t_kbuffer *x = (t_kbuffer *)pd_new(kbuffer_class);
  outlet_new(&x->x_obj, gensym("signal"));
  outlet_new(&x->x_obj, gensym("signal"));
#endif

	x->srate = sys_getsr();
	if( x->srate == 0 ){
		error("zero sampling rate - set to 44100");
		x->srate = 44100;
	}
	x->ksrate = atom_getfloatarg(0,argc,argv);
    x->duration = atom_getfloatarg(1,argc,argv)/1000.0;
	if(x->ksrate <= 0)
		x->ksrate = 128;
	if(x->duration <= 0)
		x->duration = 10.;
	
	kbuffer_init(x,0);   
 	return (x);
}
Exemplo n.º 2
0
void *resent_new(t_symbol *msg, short argc, t_atom *argv)
{
#if MSP
  t_resent *x = (t_resent *)newobject(resent_class);
//  x->m_bang = bangout((t_pxobject *)x);
//  x->m_clock = clock_new(x,(method)resent_tick);
  dsp_setup((t_pxobject *)x,1);
  outlet_new((t_pxobject *)x, "signal");
  outlet_new((t_pxobject *)x, "signal");
#endif

#if PD
  t_resent *x = (t_resent *)pd_new(resent_class);
  outlet_new(&x->x_obj, gensym("signal"));
  outlet_new(&x->x_obj, gensym("signal"));
//  x->m_bang = outlet_new(&x->x_obj,gensym("bang"));
//  x->m_clock = clock_new(x,(void *)resent_tick);
#endif

  srand(clock());

  x->duration = atom_getfloatarg(0, argc, argv)/1000.0;
  x->overlap = atom_getfloatarg(1, argc, argv);
  x->winfac = atom_getfloatarg(2, argc, argv);
  x->D = sys_getblksize();
  x->R = sys_getsr();

  resent_init(x,0);

  return (x);
}
Exemplo n.º 3
0
void *xsyn_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
	t_xsyn *x = (t_xsyn *)newobject(xsyn_class);
	dsp_setup((t_pxobject *)x,2);
	outlet_new((t_pxobject *)x, "signal");
#endif
#if PD
	t_xsyn *x = (t_xsyn *)pd_new(xsyn_class);
	inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal"));
	outlet_new(&x->x_obj, gensym("signal"));
#endif
	x->overlap = atom_getfloatarg(0,argc,argv);
	x->winfac = atom_getfloatarg(1,argc,argv);
	if(!fftease_power_of_two(x->overlap))
		x->overlap = 4;
	if(!fftease_power_of_two(x->winfac))
		x->winfac = 1;
	
	x->R = sys_getsr();
	x->vs = sys_getblksize();
	
	xsyn_init(x,0);
	return (x);
}
Exemplo n.º 4
0
	//-------------------------------------------------------------------------
	HelloMapMoblet::HelloMapMoblet( )
		: mScreen( NULL )
	//-------------------------------------------------------------------------
	{
		//
		// CloudMade map key
		// Used to access CloudMade map tile servers.
		// Please register with CloudMade to get a personal API key at
		// http://cloudmade.com/
		//
		#ifdef CLOUDMADE_API_KEY
		CloudMadeMapSource::ApiKey = CLOUDMADE_API_KEY;
		#endif

		//
		// Google Static Maps API key
		// Used to access Google Static Maps tile servers.
		// Please register with Google to get a personal API key at
		// http://code.google.com/apis/maps/documentation/staticmaps/
		//
		#ifdef GOOGLE_API_KEY
		GoogleMapSource::ApiKey = GOOGLE_API_KEY;
		#endif

		mScreen = newobject( HelloMapScreen, new HelloMapScreen( ) );
		mScreen->show( );
	}
Exemplo n.º 5
0
void *cavoc_new(t_symbol *msg, short argc, t_atom *argv)
{
#if MSP
  t_cavoc *x = (t_cavoc *)newobject(cavoc_class);
  dsp_setup((t_pxobject *)x,1);
  outlet_new((t_pxobject *)x, "signal");
 #endif

#if PD
	t_cavoc *x = (t_cavoc *)pd_new(cavoc_class);
  outlet_new(&x->x_obj, gensym("signal"));
#endif

  x->D = sys_getblksize();
  x->R = sys_getsr();

  x->density = atom_getfloatarg(0,argc,argv);
  x->hold_time = atom_getintarg(1,argc,argv);
  x->overlap = atom_getintarg(2,argc,argv);
  x->winfac = atom_getintarg(3,argc,argv);

  
	cavoc_init(x,0);
  return (x);
}
Exemplo n.º 6
0
void *drown_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
  t_drown *x = (t_drown *)newobject(drown_class);
  dsp_setup((t_pxobject *)x,3);
  outlet_new((t_pxobject *)x, "signal");
#endif
#if PD
  t_drown *x = (t_drown *)pd_new(drown_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"));
  outlet_new(&x->x_obj, gensym("signal"));
#endif

  x->threshold = atom_getfloatarg(0,argc,argv);
  x->drownmult = atom_getfloatarg(1,argc,argv);
  x->overlap = atom_getfloatarg(2,argc,argv);
  x->winfac = atom_getfloatarg(3,argc,argv);

  if(x->threshold <= 0)
    x->threshold = .0001;
  if(x->drownmult <= 0)
    x->drownmult = 0.1;
  if(!power_of_two(x->overlap))
    x->overlap = 4;
  if(!power_of_two(x->winfac))
    x->winfac = 1;
  	
  x->vs = sys_getblksize();
  x->R = sys_getsr();
  
  drown_init(x,0);
  return (x);
}
Exemplo n.º 7
0
void *thresher_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
	t_thresher *x = (t_thresher *)newobject(thresher_class);
	dsp_setup((t_pxobject *)x,3);
	outlet_new((t_pxobject *)x, "signal");
#endif
	
#if PD
    t_thresher *x = (t_thresher *)pd_new(thresher_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"));
    outlet_new(&x->x_obj, gensym("signal"));
#endif
	
	
	x->move_threshold = atom_getfloatarg(0, argc, argv);
	x->damping_factor = atom_getfloatarg(1, argc, argv);
	x->overlap = atom_getfloatarg( 2, argc, argv );
	x->winfac = atom_getfloatarg( 3, argc, argv );
	
//	post("thresh %f damper %f overlap %d winfac %d", x->move_threshold, x->damping_factor, x->overlap, x->winfac);

	/* if overlap is zero we crash so should protect against bad input parameters*/

	x->D = sys_getblksize();
	x->R = sys_getsr();
	
	thresher_init(x,0);
	return (x);
}
Exemplo n.º 8
0
void *ether_new(t_symbol *s, int argc, t_atom *argv)
{

#if MSP
  t_ether 	*x = (t_ether *) newobject(ether_class);
  dsp_setup((t_pxobject *)x,3);
  outlet_new((t_pxobject *)x, "signal");
#endif
#if PD
  t_ether *x = (t_ether *)pd_new(ether_class);
  /* add two additional signal inlets */
  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"));
#endif

/* optional arguments: overlap winfac */
	
  x->overlap = atom_getfloatarg(0,argc,argv);
  x->winfac = atom_getfloatarg(1,argc,argv);
  if(!power_of_two(x->overlap)){
    x->overlap = 4;
  }
  if(!power_of_two(x->winfac)){
    x->winfac = 1;
  }
  x->vs = sys_getblksize();
  x->R = sys_getsr();
  ether_init(x,0);
  
  return (x);
}
Exemplo n.º 9
0
void *cabasa_new(double initial_coeff)
{
	int i;
	
	    //user controlled vars	    
	float coeffs[2];

    t_cabasa *x = (t_cabasa *)newobject(cabasa_class);
    //zero out the struct, to be careful (takk to jkclayton)
    if (x) { 
        for(i=sizeof(t_pxobject);i<sizeof(t_cabasa);i++)  
                ((char *)x)[i]=0; 
	} 
    dsp_setup((t_pxobject *)x,4);
    outlet_new((t_object *)x, "signal");
    
    x->srate = sys_getsr();
    x->one_over_srate = 1./x->srate;

	x->shakeEnergy = 0.0;
	for(i=0; i<2; i++) {
		x->output[i] = 0.;
	}
	x->input = 0.0;
	x->sndLevel = 0.0;
    
    cabasa_setup(x);
    
    srand(0.54);
    
    return (x);
}
Exemplo n.º 10
0
void *tpeq_sinelist_new(long maxpartials) {
	tpeq_sinelist *x;
	int i;
				
	x = newobject(tpeq_sinelist_class);		// get memory for a new object & initialize	
	x->o_outlet = listout(x);

	if (maxpartials <= 0) maxpartials = DEFAULT_MAX_PARTIALS;

	x->n = 1;
	x->findex[0] = 0.f;     /* Doesn't matter, since n==1 */
	x->gains[0] = 0.f;	    /* Sets all gains to zero Db as default */
	x->maxpartials = maxpartials;
	x->validFactors = maxpartials;
	/* Output list has 2 Atoms per partials: freq, amp */
	x->outputlist = (Atom *) getbytes(2 * maxpartials * sizeof(Atom));
	x->partialFactors = (float *) getbytes(maxpartials * sizeof(float));

	if (x->outputlist == 0 || x->partialFactors == 0) {
		error("Out of memory");
		return 0;
	}

	for (i = 0; i < maxpartials; ++i) {
		x->outputlist[i].a_type = A_FLOAT;
		x->partialFactors[i] = 1.0f;
	}
	x->interp = COSINE;

	return (x);
}
Exemplo n.º 11
0
void *bthresher_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
  t_bthresher *x = (t_bthresher *)newobject(bthresher_class);
  x->list_outlet = listout((t_pxobject *)x);
  dsp_setup((t_pxobject *)x,3);
  outlet_new((t_pxobject *)x, "signal");
#endif

#if PD
    t_bthresher *x = (t_bthresher *)pd_new(bthresher_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"));
    outlet_new(&x->x_obj, gensym("signal"));
    x->list_outlet = outlet_new(&x->x_obj,gensym("list"));
#endif


  x->D = sys_getblksize();
  x->R = sys_getsr();
  
  x->init_thresh = atom_getfloatarg(0,argc,argv);
  x->init_damping = atom_getfloatarg(1,argc,argv);
  x->overlap = atom_getintarg(2,argc,argv);
  x->winfac = atom_getintarg(3,argc,argv);
  
  bthresher_init(x,0);
  


  return (x);
}
Exemplo n.º 12
0
void *shapee_new(t_symbol *s, int argc, t_atom *argv)
{
			
#if MSP
  t_shapee 	*x = (t_shapee *) newobject(shapee_class);
  dsp_setup((t_pxobject *)x, 3);
  outlet_new((t_pxobject *)x, "signal");
#endif
#if PD
  t_shapee *x = (t_shapee *)pd_new(shapee_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"));
  outlet_new(&x->x_obj, gensym("signal"));
#endif

/* INITIALIZATIONS */
  x->overlap = atom_getfloatarg(0,argc,argv);
  x->winfac = atom_getfloatarg(1,argc,argv);
  if(!x->winfac)	
	x->winfac = 1;
  if(!x->overlap)
	x->overlap = 4;
  x->vs = sys_getblksize();
  x->R = sys_getsr();
  shapee_init(x,0); 

  return (x);
}
Exemplo n.º 13
0
void *pvcompand_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
  t_pvcompand *x = (t_pvcompand *)newobject(pvcompand_class);
  dsp_setup((t_pxobject *)x,2);
  outlet_new((t_pxobject *)x, "signal");
#endif

#if PD
    t_pvcompand *x = (t_pvcompand *)pd_new(pvcompand_class);
    inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal"));
    outlet_new(&x->x_obj, gensym("signal"));
#endif

  // INITIALIZATIONS
  x->D  = sys_getblksize();
  x->R = sys_getsr();
  x->max_atten = atom_getfloatarg(0,argc,argv);
  x->overlap = atom_getfloatarg(1,argc,argv);
  x->winfac = atom_getfloatarg(2,argc,argv);
  if(!x->max_atten)
  	x->max_atten = -6;

  if(x->D <= 0)
  	x->D = 256;
  if(x->R <= 0)
  	x->R = 44100;

   pvcompand_init(x,0);
  return (x);
}
Exemplo n.º 14
0
void *crossx_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
  t_crossx *x = (t_crossx *)newobject(crossx_class);
  dsp_setup((t_pxobject *)x,3);
  outlet_new((t_pxobject *)x, "signal");
#endif
#if PD
  t_crossx *x = (t_crossx *)pd_new(crossx_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"));
  outlet_new(&x->x_obj, gensym("signal"));
#endif


  x->overlap = atom_getfloatarg(0,argc,argv);
  x->winfac = atom_getfloatarg(1,argc,argv);
  if(x->overlap <= 0)
    x->overlap = 4;

  x->winfac = 1;
    
  x->R = sys_getsr();
  x->vs = sys_getblksize();

  crossx_init(x,0);
  return (x);
}
Exemplo n.º 15
0
void *myobject_new(long n)

{

	MyObject *x;

	

	EnterCallback();

	x = newobject(myobject_class);		// get memory for a new object & initialize

	x->m_value = n;						// store value (default is 0)

	x->m_out = intout(x);				// create an int outlet

	x->m_out_b = bangout(x);

	x->m_out_s = outlet_new(x,0L)

	ExitCallback();

	return (x);							// return newly created object to caller

}
Exemplo n.º 16
0
void *EermMaxNew(Symbol *s, short ac, Atom *av)
{
	int nnodes = KNNodesDefault;
	int nmaxsimplices = KNMaxSimplicesDefault;
	int nmaxtokens = KNMaxTokensDefault;
	int Nf = KNfDefault;
	float dt = KDtInMsDefault;
	EermMax *m;

	MTraceCall("eermMax:\tNew..");

	unused(s);
	
	arg_num(nnodes,0,ac,av);
	arg_num(nmaxsimplices,1,ac,av);
	arg_num(nmaxtokens,2,ac,av);
	arg_num(Nf,3,ac,av);
	arg_num(dt,4,ac,av);

	MTrace5("eermMax:\tNew: nnodes=%d, nmaxsimp=%d, nmaxt=%d, Nf=%d, dt=%f",
		nnodes, nmaxsimplices, nmaxtokens, Nf, dt);
		
	m = (EermMax *)newobject(EermMaxClass);
	m->e = EermNew(nnodes, nmaxsimplices, nmaxtokens, Nf, dt);

	m->DoClock = 0;
	
	m->xout = listout(m);
	m->out = listout(m);
	
	EermMaxLabelsNew(m);
	
	MTraceCall("eermMax:\tNew finished.");
	return (m);
}
Exemplo n.º 17
0
void *leaker_new(t_symbol *msg, short argc, t_atom *argv)
{
#if MSP
  t_leaker *x = (t_leaker *)newobject(leaker_class);
  dsp_setup((t_pxobject *)x,3);
  outlet_new((t_pxobject *)x, "signal");
#endif

#if PD
  t_leaker *x = (t_leaker *)pd_new(leaker_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"));
  outlet_new(&x->x_obj, gensym("signal"));
#endif

  x->D = sys_getblksize();
  x->R = sys_getsr();
  if(!x->D)
    x->D = 256;
  if(!x->R)
    x->R = 44100;

  x->overlap = atom_getfloatarg(0,argc,argv);
  x->winfac = atom_getfloatarg(1,argc,argv);
  if(!x->overlap)
    x->overlap = 4;
  if(!x->winfac)
    x->winfac = 1;

  leaker_init(x,0);	
  return (x);
}
Exemplo n.º 18
0
void*
SssNew(
	long	iNN,
	long	iSeed)
	
	{
	tPink*			me			= NIL;
	tTaus88DataPtr	myTausStuff	= NIL;	
	
	
	// Run through initialization parameters from right to left, handling defaults
	if (iSeed != 0) myTausStuff = Taus88New(iSeed);
	
	// Default NN value doesn't need massaging
	// Finished checking intialization parameters

	// Let Max allocate us, our inlets, and outlets.
	me = (tPink*) newobject(gObjectClass);
	
	intin(me, 1);								// NN inlet
	
	floatout(me);								// Access through me->coreObject.o_outlet
	
	// Set up object components
	me->tausData = myTausStuff;
	SssNN(me, iNN);
	me->counter = 0;							// This will cause the dice array to be
												// initialized at the first bang.

	return me;
	}
Exemplo n.º 19
0
void *pvtuner_new(t_symbol *s, int argc, t_atom *argv)
{
#if MSP
    t_pvtuner *x = (t_pvtuner *)newobject(pvtuner_class);
    dsp_setup((t_pxobject *)x,3);
    outlet_new((t_pxobject *)x, "signal");
#endif
#if PD
    t_pvtuner *x = (t_pvtuner *)pd_new(pvtuner_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"));
    outlet_new(&x->x_obj, gensym("signal"));
#endif

    x->R = sys_getsr();
    x->D = sys_getblksize();

    x->lofreq = atom_getfloatarg(0, argc, argv);
    x->hifreq = atom_getfloatarg(1, argc, argv);
    x->overlap = atom_getfloatarg(2, argc, argv);
    x->winfac = atom_getfloatarg(3, argc, argv);

    if(x->lofreq <= 0 || x->lofreq >= x->R/2)
        x->lofreq = 0;
    if(x->hifreq <= 0 || x->hifreq > x->R/2)
        x->hifreq = 4000.0;


    pvtuner_init(x,0);

    return (x);
}
Exemplo n.º 20
0
void *rLCD(void *patcher, short x, short y, short w, short s)
{
	ResType		theType;
	Lcd			*p;
	FontInfo	info;

	p = (Lcd *)newobject(lcd_class);

	if (s < 1) s = 1;
	box_new((Box *)p, patcher, F_DRAWFIRSTIN | F_GROWBOTH, x, y, x+w,y+s);

	p->lcd_box.b_firstin = (void *)p;  /* it's not really an inlet */
	p->lcd_row = 0;
	p->lcd_col = 0;
	p->lcd_region = 0L;  /* DDZ moved to prevent dispose of bad region handle
							(LCD_font calls LCD_resize) */
	LCD_font(p,0L,0L);	/* DDZ changed to add 0,0 as arguments (needed) 12/14/92 */
	
	p->lcd_shiftClick = false;
	p->file_outlet=outlet_new(p,0L);
	p->lcd_outlet = outlet_new(p,0L);

	p->lcd_palette = myPalette;
	p->lcd_pIndex = numPaletteColors-1;
	p->lcd_penMode = patCopy;
	
	p->screen = 0L;
	
	p->reson_sampleRate = 20000.0;
	p->reson_spectScale = -100.0;
	p->reson_trimRatio = 1.0;
	
	p->local=1; // sde want to draw mouseclicks by default

	p->lcd_debug = false;
	p->lcd_oldRect = p->lcd_box.b_rect;
	/* DDZ, the statement above needs to be done in case the 
		window is not visible, because otherwise, oldRect
		can be set to some huge size and erase the entire
		patcher window
	*/
	// sde
	picthandle = (PicHandle)newhandle(4L);// create a dummy so we have something to dispose
	pictgood=0;
	
	{
		GrafPort *gp;
		
		gp = patcher_setport(p->lcd_box.b_patcher);	
		if (gp) {
			LCD_resize(p);
			SetPort(gp);
		}
	}
	
	box_ready((Box *)p);

	return (p);
}
Exemplo n.º 21
0
PRIVATE void setup_ancestor(void) {
  OVECTOR ansym = newsym("Root");

  if (AT(ansym, SY_VALUE) == undefined) {
    OBJECT ancestor = newobject(NULL, NULL);
    ATPUT(ansym, SY_VALUE, (OBJ) ancestor);
  }
}
Exemplo n.º 22
0
void *sigflip_new(double val)
{
    t_sigflip *x = (t_sigflip *)newobject(sigflip_class);
    dsp_setup((t_pxobject *)x,2);
    outlet_new((t_pxobject *)x, "signal");
    x->x_val = val;
    return (x);
}
Exemplo n.º 23
0
void *vdb_new(t_symbol *s, int argc, t_atom *argv)
{
int i;
int user_chans;
t_vdb *x;

	if(argc < 2){
		error("%s: you must provide a valid buffer name and channel count",OBJECT_NAME);
		return (void *)NULL;
	}	
	
	x = (t_vdb *)newobject(vdb_class);
	x->sr = sys_getsr();
	
	if(!x->sr){
		error("zero sampling rate - set to 44100");
		x->sr = 44100;
	}
	// DSP CONFIG


	// SET DEFAULTS
	x->maxdelay = 50.0; // milliseconds
	x->feedback = 0.5;
	x->delay_time  = 0.0;

// args: name channels [max delay, initial delay, feedback, interpolation_flag]

    x->buffername = atom_getsymarg(0,argc,argv);
	user_chans = atom_getfloatarg(1,argc,argv);
	x->maxdelay = atom_getfloatarg(2,argc,argv);
	x->delay_time = atom_getfloatarg(3,argc,argv);
	x->feedback = atom_getfloatarg(4,argc,argv);
	x->interpolate = atom_getfloatarg(5,argc,argv);   
	x->b_nchans = user_chans;
/*
	if(! x->b_nchans){
		error("did not find channels from buffer");
		if(user_chans > 0)
			
	} */
	/* need data checking here */
	x->inlet_count = x->b_nchans + 2;
	x->outlet_count = x->b_nchans;
	x->delay_inlet = x->b_nchans;
	x->feedback_inlet = x->delay_inlet + 1;

	dsp_setup((t_pxobject *)x,x->inlet_count);
	for(i = 0; i < x->outlet_count; i++){
		outlet_new((t_object *)x, "signal");
	}
    x->x_obj.z_misc |= Z_NO_INPLACE;
    	

		
	vdb_init(x,0);
	return (x);
}
Exemplo n.º 24
0
t_gaussdraw *gaussdraw_new(Symbol *sym, short argc, Atom *argv)
{
	t_gaussdraw *x = (t_gaussdraw *)newobject(gaussdraw_class);	

	x->x_outlet = listout((t_gaussdraw *)x); // Create a list outlet
	floatin(x,2); // Create 1 additional inlets
	floatin(x,1); // Create 1 additional inlets

	switch (argc) { // Read arguments
		case 0: 
			x->x_max = DEFMAX;
			x->x_min = DEFMIN;
			x->x_height = DEFHEIGHT;
			x->x_N = DEF_N;
			break;
		case 1:
			x->x_max = DEFMAX;
			x->x_min = DEFMIN;
			x->x_height = DEFHEIGHT;
			readx_N(x,argv);
			break;
		case 2:
			x->x_max = DEFMAX;
			x->x_min = DEFMIN;
			readx_height(x,argv);
			readx_N(x,argv);
			break;
		case 3:
			x->x_max = DEFMAX;
			readx_min(x,argv);
			readx_height(x,argv);
			readx_N(x,argv);
			break;
		case 4:
			readx_max(x,argv);
			readx_min(x,argv);
			readx_height(x,argv);
			readx_N(x,argv);
			break;
		default:
			post("gaussdraw: too many arguments.");		
			readx_max(x,argv);
			readx_min(x,argv);
			readx_height(x,argv);
			readx_N(x,argv);
	}
	
	if (x->x_max <= x->x_min) {
		post("gaussdraw: min can't be higher than max. Taking default...");		
		x->x_max = DEFMAX;
		x->x_min = DEFMIN;
	}	
	x->myList = (Atom *) NewPtr(MAXNUMPTS * sizeof(*x->myList));     
	
	return x;
}
Exemplo n.º 25
0
void *bowedbar_new(double initial_coeff)
{
	int i;

    t_bowedbar *x = (t_bowedbar *)newobject(bowedbar_class);
     //zero out the struct, to be careful (takk to jkclayton)
    if (x) { 
        for(i=sizeof(t_pxobject)-1;i<sizeof(t_bowedbar);i++)  
                ((char *)x)[i]=0; 
	} 
    dsp_setup((t_pxobject *)x,6);
    outlet_new((t_object *)x, "signal");
    
    x->x_bp = 0.5;
    x->x_bpos = 0.15;
    x->x_bv = 0.5;
    x->x_freq = 440.;
    
    x->modes[0] = 1.0;
    x->modes[1] = 2.756;
  	x->modes[2] = 5.404;
  	x->modes[3] = 8.933;
  	
    x->length = 100.;
  	
  	for (i=0;i<4;i++)	{
    	x->gains[i] = pow(0.9,(double) i);
    	DLineN_alloc(&x->delay[i], 2408);
    	DLineN_setDelay(&x->delay[i], (int)(x->length/x->modes[i]));
    	DLineN_clear(&x->delay[i]);
    	BiQuad_init(&x->bandpass_[i]);
    	BiQuad_clear(&x->bandpass_[i]);
      	x->Zs[i][0] = 0.0;
      	x->Zs[i][1] = 0.0;
      	x->filtOut[i] = 0.0;
      	x->filtIn[i] = 0.0;
  	}
    
    x->srate = sys_getsr();
    x->one_over_srate = 1./x->srate;
    
    //initialize things
    BowTabl_init(&x->bowTabl);
    x->bowTabl.slope = 3.0;
    x->slope = 3.;
  	x->R = 0.97;
  	x->x_GAIN = 0.999;
  	x->integration_const_ = 0.;
  	x->velinput = 0.;

    x->fr_save = x->x_freq;
    
    post("some people do this for a living...");
    
    return (x);
}
Exemplo n.º 26
0
void *index_new(t_symbol *s, long chan)
{
	t_index *x = (t_index *)newobject(index_class);
	dsp_setup((t_pxobject *)x, 1);
	intin((t_object *)x,1);
	outlet_new((t_object *)x, "signal");
	x->l_sym = s;
	index_in1(x,chan);
	return (x);
}
Exemplo n.º 27
0
//----------------------------------------------------------------------------------------------
void *f0ext_new(double val) {
	x_f0ext *f0ext= (x_f0ext *)newobject(this_class);
	if(val!=0) {
		f0ext->x_valRight= val;
	} else {
		f0ext->x_valRight= 1;
	}
	dsp_setup((t_pxobject *)f0ext, 2);						//inlets
	outlet_new((t_pxobject *)f0ext, "signal");				//outlet
	return(f0ext);
}
Exemplo n.º 28
0
void *iter_new(long dummy)
{
	t_iter *x;
	short i;
	
	x = (t_iter *)newobject(iter_class);
	x->i_ac = 0;
	x->i_av = NULL;
	outlet_new(x,0L);
	return x;
}			
Exemplo n.º 29
0
objPolynom*
GalliardNew(
	Symbol*	sym,
	short	iArgC,
	Atom*	iArgV)
	
	{
	#pragma unused(sym)
	
	objPolynom*	me	= NIL;
	
	//
	// Let Max allocate us, our inlets, and our outlets
	//
	
	me = (objPolynom*) newobject(gObjectClass);
	if (me == NIL) {
		error("%s: insufficient memory to create object", kClassName);
		goto punt;
		}
	
	dsp_setup(&(me->coreObject), 1);		// Inlets
	outlet_new(me, "signal");

	// Set up to default state
	me->order		= 0;
	me->coeffs[0]	= 0.0;
	
	switch (iArgC) {
	case 0:
		// nothing to do;
		break;
	
	case 1:
		switch (iArgV[0].a_type) {
		case A_LONG:
			GalliardConstInt(me, iArgV[0].a_w.w_long);
			break;
		case A_FLOAT:
			GalliardConstFt(me, iArgV[0].a_w.w_float);
			break;
		default:
			break;
			}
		break;
			
	default:
		GalliardCoeffs(me, NULL, iArgC, iArgV);
		break;
		}

punt:
	return me;
	}	
Exemplo n.º 30
0
	//-------------------------------------------------------------------------
	AppScreenBase::AppScreenBase( MobletEx* moblet ) :
	//-------------------------------------------------------------------------
		mMoblet( moblet ),
		mSoftKeyBar( NULL ),
		mContentFrame( NULL ),
		mAppFrame( NULL ),
		mMessagePosted( false ),
		mKeyTimer( NULL )
	{
		//
		// Screen size
		//
		MAExtent screenSize = maGetScrSize( );
		mWidth = EXTENT_X( screenSize );
		mHeight = EXTENT_Y( screenSize );
		//
		// Frame containing tab widgets
		//
		mContentFrame = newobject( Layout, new Layout( 0, 0, mWidth, mHeight - BottomHeight, NULL, 1, 1 ) );
		//
		// Bottom bar with soft key labels
		//
		mSoftKeyBar = newobject( SoftKeyBar, new SoftKeyBar( 0, 0, mWidth, BottomHeight, NULL ) );
		mSoftKeyBar->setLeftAction( newobject( ShowMenuAction, new ShowMenuAction( this ) ) );
		mSoftKeyBar->setRightAction( newobject( ExitAction, new ExitAction( mMoblet ) ) );

		AppStyle* style = AppStyleMgr::getStyle( );
		mAppFrame = newobject( AppFrame, new AppFrame( 0, 0, mWidth, mHeight,NULL, 1, 3 ) );

		mAppFrame->add( mContentFrame );
		mAppFrame->add( mSoftKeyBar );
		mAppFrame->setDrawBackground( false );
		mAppFrame->setfont( style->getFont( FontSize_Smallest, Color::white, false ) );
		mAppFrame->update( );

		setMain( mAppFrame );
		//
		// Listen to messages
		//
		MessageMgr::get( )->addListener( this );
	}