Example #1
0
void hoa_map_float(t_hoa_map *x, double f)
{
    if(x->f_map->getNumberOfSources() == 1)
    {
		if(x->f_mode == hoa_sym_polar)
		{
			if(proxy_getinlet((t_object *)x) == 1)
			{
				x->f_lines->setRadius(0, clip_min(f, 0.));
			}
			else if(proxy_getinlet((t_object *)x) == 2)
			{
				x->f_lines->setAzimuth(0, f);
			}
		}
		else if(x->f_mode == hoa_sym_cartesian)
		{
			if(proxy_getinlet((t_object *)x) == 1)
			{
                float ord = ordinate(x->f_lines->getRadius(0), x->f_lines->getAzimuth(0));
				x->f_lines->setRadius(0, radius(f, ord));
                x->f_lines->setAzimuth(0, azimuth(f, ord));
			}
			else if(proxy_getinlet((t_object *)x) == 2)
			{
				float abs = abscissa(x->f_lines->getRadius(0), x->f_lines->getAzimuth(0));
                x->f_lines->setRadius(0, radius(abs, f));
				x->f_lines->setAzimuth(0, azimuth(abs, f));
			}
		}
    }
}
Example #2
0
void wlet_int(t_wlet *x, long n)
{
	float f = (float)n;
	int i = (int)n;
	
	if(proxy_getinlet((t_object *)x) == 1){
		wlet_setupWavelet(x, gensym((char *)gsl_wavelet_name(x->w_wavelet)), (size_t)n);
	}else if(proxy_getinlet((t_object *)x) == 2){
		if(n > sys_getblksize()){
			error("wavelet: size must be smaller than the signal vector %ld", sys_getblksize());
			return;
		}
		while(i > 1){
			f = f / 2.0;
			if(f - round(f)){
				error("wavelet: size must be a multiple of 2");
				return;
			}
			i = (int)f;
		}
		x->w_waveletLength = (int)n;
		
		gsl_wavelet_workspace *oldWspace = x->w_workspace;
		x->w_workspace = gsl_wavelet_workspace_alloc((size_t)n);
		gsl_wavelet_workspace_free(oldWspace);
		
		double *oldTmp = x->w_tmp;
		x->w_tmp = (double *)calloc((int)n, sizeof(double));
		free(oldTmp);
	}//else if(proxy_getinlet((t_object *)x) == 3){
	//	x->w_stride = (size_t)n;
	//}
}
void hoa_rotate_int(t_hoa_rotate *x, long n)
{
	if(proxy_getinlet((t_object *)x) == x->f_rotate->getNumberOfHarmonics())
    {
        x->f_rotate->setRoll(n);
    }
	else if(proxy_getinlet((t_object *)x) == x->f_rotate->getNumberOfHarmonics() + 1)
    {
        x->f_rotate->setPitch(n);
    }
	else if(proxy_getinlet((t_object *)x) == x->f_rotate->getNumberOfHarmonics() + 2)
    {
        x->f_rotate->setYaw(n);
    }
}
void hoa_rotate_float(t_hoa_rotate *x, double f)
{
	if(proxy_getinlet((t_object *)x) == x->f_rotate->getNumberOfHarmonics())
    {
        x->f_rotate->setRoll(f);
    }
	else if(proxy_getinlet((t_object *)x) == x->f_rotate->getNumberOfHarmonics() + 1)
    {
        x->f_rotate->setPitch(f);
    }
	else if(proxy_getinlet((t_object *)x) == x->f_rotate->getNumberOfHarmonics() + 2)
    {
        x->f_rotate->setYaw(f);
    }
}
Example #5
0
void flext_base::cb_anything(flext_hdr *c,const t_symbol *s,short argc,t_atom *argv)
{
    Locker lock(c);
    int const ci = proxy_getinlet((t_object *)&c->obj);
//    post("%s %i, cb_anything(%i)",__FILE__,__LINE__,ci);
    thisObject(c)->CbMethodHandler(ci,s,argc,argv);
}
Example #6
0
FLEXT_TEMPIMPL(void FLEXT_CLASSDEF(flext_base))::cb_int(flext_hdr *c,long v)
{
    t_atom atom; SetInt(atom,v);
    Locker lock(c);
    int const ci = proxy_getinlet((t_object *)&c->obj);
    thisObject(c)->CbMethodHandler(ci,sym_int,1,&atom);
}
Example #7
0
// INPUT: LIST/SYMBOL
void change_anything(t_change *x, t_symbol *msg, long argc, t_atom *argv)
{	
	short 	i;
	bool	match = false;
	bool	mismatch = false;
	long	inlet = proxy_getinlet((t_object *)x);
											
	if(inlet == 0){
		if (x->last_input_type != msg_list)		// didn't receive a list/symbol last time
			mismatch = true;
		else if (msg != x->last_input_symbol)	// last list/symbol received didn't start with the same symbol
			mismatch = true;
		else if (argc != x->last_argc)			// last list/symbol was not the same length
			mismatch = true;
		else {									// check to see if the args are the same...
			for(i=0; i<argc; i++){
				match = atom_compare(&(x->last_input_list[i]), argv+i);			
				if(!match) mismatch = true;
			}
		}
			
		if(mismatch)							// output the input
			outlet_anything(x->change_Out[0], msg, argc, argv);		
		else									// All elements are the same, send a bang
			outlet_bang(x->change_Out[1]);		
	}		
	x->last_input_symbol = msg;					// Make copies of the input for the next time
	x->last_input_type = msg_list;
	x->last_argc = argc;
	memcpy(argv, x->last_input_list, sizeof(t_atom) * argc);
}
Example #8
0
void dict_route_dictionary(t_dict_route *x, t_symbol *s)
{
	t_dictionary	*d = dictobj_findregistered_retain(s);

	if (!d) {
		object_error((t_object*)x, "unable to reference dictionary named %s", s);
		return;
	}

	if (proxy_getinlet((t_object*)x) == 0) {	
		// left inlet : validate the input against the schema

		long			validates = false;
		t_atom			a;

		validates = dictobj_validate(x->schema_dict, d);
		atom_setsym(&a, s);
		if (validates)
			outlet_anything(x->outlet_dict, _sym_dictionary, 1, &a);
		else
			outlet_anything(x->outlet_nomatch, _sym_dictionary, 1, &a);
	}
	else {
		// right inlet : set the contents of the schema with a copy of the incoming dictionary

		if (d) {
			dictionary_clear(x->schema_dict);
			dictionary_clone_to_existing(d, x->schema_dict);
		}
	}
	dictobj_release(d);
}
Example #9
0
void testequals_float(t_testequals *x, double f)
{
	if (proxy_getinlet((t_object*)x) == 1)
		x->x_operand = f;
	else
		outlet_int(x->x_outlet, testequals_equivalent(x->x_operand, f, x->x_tolerance, x->x_single_precision));
}
Example #10
0
void flext_base::cb_float(flext_hdr *c,double v)
{
    t_atom atom; SetFloat(atom,v);
    Locker lock(c);
    int const ci = proxy_getinlet((t_object *)&c->obj);
    thisObject(c)->CbMethodHandler(ci,sym_float,1,&atom);
}
Example #11
0
TTErr MaxGraphConnect(t_object* x, TTGraphObjectBasePtr audioSourceObject, TTUInt16 sourceOutletNumber)
{
	WrappedInstancePtr	self = WrappedInstancePtr(x);
	long				inletNumber = proxy_getinlet(SELF);
	
	return self->graphObject->connect(audioSourceObject, sourceOutletNumber, inletNumber);
}
Example #12
0
void OSCTimeTag_FullPacket(OSCTimeTag *x, t_symbol* s, int argc, t_atom* argv) {

  long i;
  unsigned long sec;
  unsigned long frac_sec;

  struct ntptime r;

  char* data;

  sec = 0;
  frac_sec = 0;

  i = proxy_getinlet((t_object *)x);
  if(argc == 2 && argv[0].a_type == A_LONG && argv[0].a_w.w_long >= 16 && argv[1].a_type == A_LONG && argv[1].a_w.w_long != 0) {

    data = (char*)argv[1].a_w.w_long;
    if(strcmp(data, "#bundle") == 0) {

      sec =      ntohl(*((unsigned long *)(data+8)));
      frac_sec = ntohl(*((unsigned long *)(data+12)));

      if(i == 0) {
	if(sec == 0 && frac_sec == 1) {
	  if(x->op == OP_TAG) {
	    x->a.type = TIME_NOW;
	  } else {
	    x->a.type = TIME_IMMEDIATE;
	  }
	} else {
	  x->a.type = TIME_STAMP;
	  x->a.sec = sec;
	  x->a.frac_sec = frac_sec;
	}

	r = OSCTimeTag_run(x);

	if(x->to == TO_P) {
	  // write result into packet...
	  (*((unsigned long *)(data+8))) = htonl(r.sec);
	  (*((unsigned long *)(data+12))) = htonl(r.frac_sec);

	  // output transformed FullPacket
	  outlet_anything(x->out_p[0], ps_FullPacket, 2, argv);
	}

      }
      else if(i == 1) {
	if(sec == 0 && frac_sec == 1) {
	  x->b.type = TIME_IMMEDIATE;
	} else {
	  x->b.type = TIME_STAMP;
	  x->b.sec = sec;
	  x->b.frac_sec = frac_sec;
	}
      }
    }
  }

}
Example #13
0
// FLOATING POINT INPUT
// on Windows this object only works if the argument is declared double?
void pack_float(t_pack *x, double value)
{
	long inletnum = proxy_getinlet((object *)x);
	atom_setfloat(&(x->mylist[inletnum]), value);
		
	if (x->triggerlist[(x->inletnum)] != 0)
		outlet_list(x->my_outlet, 0L, x->mylistlen, x->mylist);	// output the result	
}
Example #14
0
// SYMBOL INPUT
void pack_symbol(t_pack *x, t_symbol *msg, short argc, t_atom *argv)
{
	long inletnum = proxy_getinlet((object *)x);
	atom_setsym(x->mylist+(inletnum), msg);

	if (x->triggerlist[(x->inletnum)] != 0)
		outlet_list(x->my_outlet, 0L, x->mylistlen, x->mylist);	// output the result	
}
Example #15
0
/****************************************************************
*  Get the destination buffer depending on the proxy
*/
t_dstr str_proxy_to_dstr(t_strstr *x)
{
  switch (proxy_getinlet((t_object *)x)) {
  case 0:  return x->i_dstr1;
  case 1:  return x->i_dstr2;
  default: return NULL;
  }
}
Example #16
0
TTErr OpConnectAudio(OpPtr self, TTAudioGraphObjectPtr audioSourceObject, long sourceOutletNumber)
{
	long inletNumber = proxy_getinlet(SELF);
	
	if (inletNumber == 1)
		self->audioGraphObject->setAttributeValue(TT("numAudioInlets"), 2);
	return self->audioGraphObject->connectAudio(audioSourceObject, sourceOutletNumber, inletNumber);
}
Example #17
0
void hoa_map_int(t_hoa_map *x, long n)
{
	if(x->f_map->getNumberOfSources() == 1)
    {
        if(proxy_getinlet((t_object *)x) == 1)
        {
            x->f_map->setAzimuth(0, n);
        }
        else if(proxy_getinlet((t_object *)x) == 2)
        {
            x->f_map->setElevation(0, n);
        }
        else if(proxy_getinlet((t_object *)x) == 3)
        {
            x->f_map->setDistance(0, n);
        }
    }
}
Example #18
0
void pi_int(t_pi *x, long n)
{
    if (proxy_getinlet((t_object*)x))
        x->f_phase = n != 0;
    else
    {
        x->f_value = n;
        x->f_phase = 1;
    }
}
Example #19
0
void pi_float(t_pi *x, double n) 
{
    if (proxy_getinlet((t_object*)x))
        x->f_phase = wrap(n, 0.0f, 1.0f);
    else
    {
        x->f_value = n;
        x->f_phase = 1;
    }
}
Example #20
0
void WrappedDataClass_anything(TTPtr self, t_symbol *msg, long argc, t_atom *argv)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
    TTObject o;
	
	if (proxy_getinlet((t_object*)x))
		wrappedModularClass_ArraySelect(self, msg, argc, argv);
	else
        data_list(self, msg, argc, argv);
}
Example #21
0
void split_float(t_split *x, double value)
{
	long inlet_number = proxy_getinlet((t_object*)x);
	
	if (inlet_number == 1)
		x->s_low = value;
	else if (inlet_number == 2)
		x->s_high = value;
	else
		object_error((t_object*)x, "oops -- maybe you sent a number to the wrong inlet?");
}
Example #22
0
// INTEGER INPUT
void cs_int(t_cs *x, long value)
{
	long inletnum = proxy_getinlet((object *)x);
	switch(inletnum){
		case 0: x->val1 = value; break;
		case 1: x->val2 = value; break;
		case 2: x->val3 = value; break;
	}
	if(x->attr_autopack)
		cs_bang(x);	
}
Example #23
0
// This function will be called when the object receives a list in either outlet
void ppn_list(t_ppn *x, t_symbol *msg, short argc, t_atom *argv) {
    switch(proxy_getinlet((t_object *)x)) {
    case 0:
        // left inlet: call ppn_anything with "list" as the message selector
        ppn_anything(x, _sym_list, argc, argv);
        break;
    case 1:
        // right inlet: a list in the right inlet doesn't make sense, so just return
        break;
    }
}
Example #24
0
// INT input
void prime_int(t_prime *x, long value)
{
	long inletnum = proxy_getinlet((object *)x);

	if(inletnum==0){
		x->p_value = TTPrime(value);	// run the primeFunc function on the input value and store the result
		outlet_int(x->p_out, x->p_value);		// output the result
	}
	else if(inletnum==1){
		x->p_value = value;					//Set the value
	}
}
Example #25
0
// This function will be called when the object receives an int in either inlet
void ppn_int(t_ppn *x, long n) {
    // Call proxy_getinlet() to find out which inlet the message was received in
    switch(proxy_getinlet((t_object *)x)) {
    case 0:
        // left inlet: create an atom and set the contents of it to the value of n
        // then call schedule_delay().
        break;
    case 1:
        // right inlet: set the delay time to the number received.
        break;
    }
}
Example #26
0
// This will be called when the object receives a message in either inlet
void ppn_anything(t_ppn *x, t_symbol *msg, short argc, t_atom *argv) {
    switch(proxy_getinlet((t_object *)x)) {
    case 0:
        // left inlet: create a temp array and set the state as the first element, then
        // copy the contents of argv into the array and schedule it for delay.
        schedule_delay((t_object *)x, (method)ppn_callback, x->delay_time_ms, msg, argc, argv);
        break;
    case 1:
        // right inlet: we don't understand, so just return
        break;
    }
}
Example #27
0
void change_float(t_change *x, double value)
{
	long	inlet = proxy_getinlet((t_object *)x);

	if(inlet == 0){
		if((value != x->last_input_float) || (x->last_input_type != msg_float))
			outlet_float(x->change_Out[0], value);
		else
			outlet_bang(x->change_Out[1]);
	}
	x->last_input_float = value;
	x->last_input_type = msg_float;
}
Example #28
0
void Huygens_float(t_Huygens *x, double f)
{
	int index = proxy_getinlet((t_object *)x);
	
	if(index == 1)
	{
		x->f_positionX = (double)f;
	}
	else if(index == 2)
	{
		x->f_positionY = (double)f;
	}
}
Example #29
0
void Huygens_int(t_Huygens *x, long n)
{
	int index = proxy_getinlet((t_object *)x);
	
	if(index == 1)
	{
		x->f_positionX = (double)n;
	}
	else if(index == 2)
	{
		x->f_positionY = (double)n;
	}
}
Example #30
0
void cc_list(t_cc *x, t_symbol *msg, short argc, t_atom *argv){
	while(x->compiling){};
	x->ok_to_compile = 0;
	long f = 0;
	hashtab_lookup(x->ht, gensym("my_list"), (t_object **)(&f));
	if(!f){
		error("cc: doesn't respond to message list");
		goto out;
	}
	int inlet = proxy_getinlet((t_object *)x);
	((ccmethod)(f))((t_object *)x, x->user_obj, inlet, argc, argv, x->noutlets, x->outlets);
 out:
	x->ok_to_compile = 1;
}