Esempio n. 1
0
void *hoa_map_3D_tilde_new(t_symbol *s, long argc, t_atom *argv)
{
    t_hoa_map_3D_tilde *x = NULL;
    t_binbuf *d;
    int	order = 1;
    int numberOfSources = 1;
    
    if (!(d = binbuf_via_atoms(argc,argv)))
		return NULL;
    
    x = (t_hoa_map_3D_tilde *)eobj_new(hoa_map_3D_tilde_class);
    
	if (x)
	{
		if(atom_gettype(argv) == A_LONG)
			order = clip_min(atom_getlong(argv), 0);
        if(argc > 1 && atom_gettype(argv+1) == A_LONG)
            numberOfSources = clip_minmax(atom_getlong(argv+1), 1, 255);
        if(argc > 2 && atom_gettype(argv+2) == A_SYM)
        {
            if(atom_getsym(argv+2) == gensym("car") || atom_getsym(argv+2) == gensym("cartesian"))
                x->f_mode = 1;
            else
                x->f_mode = 0;
        }
        else
            x->f_mode = 0;
        
        x->f_ramp       = 100;
		x->f_map        = new Hoa3D::Map(order, numberOfSources);
		x->f_lines      = new MapPolarLines3D(x->f_map->getNumberOfSources());
        x->f_lines->setRamp(0.1 * sys_getsr());
        for (int i = 0; i < x->f_map->getNumberOfSources(); i++)
        {
            x->f_lines->setRadiusDirect(i, 1);
            x->f_lines->setAzimuthDirect(i, 0.);
            x->f_lines->setElevationDirect(i, 0.);
        }
        
		if(x->f_map->getNumberOfSources() == 1)
            eobj_dspsetup(x, 4, x->f_map->getNumberOfHarmonics());
        else
            eobj_dspsetup(x, x->f_map->getNumberOfSources(), x->f_map->getNumberOfHarmonics());
        
        if(x->f_map->getNumberOfSources() == 1)
            x->f_sig_ins    = new t_float[4 * SYS_MAXBLKSIZE];
        else
            x->f_sig_ins    = new t_float[x->f_map->getNumberOfSources() * SYS_MAXBLKSIZE];
		
        x->f_sig_outs       = new t_float[x->f_map->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
        x->f_lines_vector   = new float[x->f_map->getNumberOfSources() * 3];
        
        ebox_attrprocess_viabinbuf(x, d);
	}
    
	return (x);
}
Esempio n. 2
0
void *gain_new(t_symbol *s, int argc, t_atom *argv)
{
	t_gain *x =  NULL;
	t_binbuf* d;
    long flags;
	if (!(d = binbuf_via_atoms(argc,argv)))
		return NULL;
    
	x = (t_gain *)eobj_new(gain_class);
    flags = 0
    | EBOX_GROWINDI
    ;
	ebox_new((t_ebox *)x, flags);
    eobj_dspsetup((t_ebox *)x, 1, 1);
    x->f_out = (t_outlet *)floatout(x);
    
    x->f_value  = 0.;
    x->f_amp    = 1.;
    x->f_amp_old = 1.;
    x->f_amp_step = 0.;
    x->f_counter = 0;
    x->f_sample_rate = sys_getsr();
    
	ebox_attrprocess_viabinbuf(x, d);
	ebox_ready((t_ebox *)x);
	return (x);
}
void *hoa_meter_new(t_symbol *s, int argc, t_atom *argv)
{
	t_hoa_meter *x =  NULL;
	t_binbuf *d;
	long flags;
	
	if (!(d = binbuf_via_atoms(argc, argv)))
		return NULL;
    
	x = (t_hoa_meter *)eobj_new(hoa_meter_class);
    
    x->f_ramp = 0;
    x->f_meter  = new Hoa2D::Meter(4);
    x->f_vector = new Hoa2D::Vector(4);
    x->f_signals = new t_float[MAX_SPEAKER * SYS_MAXBLKSIZE];
    x->f_over_leds = new int[MAX_CHANNELS];
    
    x->f_clock = clock_new(x,(t_method)hoa_meter_tick);
	x->f_startclock = 0;
    eobj_dspsetup((t_ebox *)x, x->f_meter->getNumberOfChannels(), 0);
    
    flags = 0
    | EBOX_GROWLINK
    | EBOX_IGNORELOCKCLICK
    ;
	ebox_new((t_ebox *)x, flags);
    
    hoa_meter_deprecated(x, s, argc, argv);
	ebox_attrprocess_viabinbuf(x, d);
    
	ebox_ready((t_ebox *)x);
	return (x);
}
Esempio n. 4
0
void *number_tilde_new(t_symbol *s, int argc, t_atom *argv)
{
	t_number_tilde *x =  NULL;
	t_binbuf* d;
    long flags;

	if (!(d = binbuf_via_atoms(argc,argv)))
		return NULL;

	x = (t_number_tilde *)eobj_new(number_tilde_class);

    flags = 0
    | EBOX_GROWINDI
    | EBOX_IGNORELOCKCLICK
    ;

	ebox_new((t_ebox *)x, flags);

	eobj_dspsetup((t_ebox *)x, 1, 1);

    x->f_peaks_outlet   = floatout(x);
    x->f_peak_value     = 0.;
    x->f_clock          = clock_new(x,(t_method)number_tilde_tick);
	x->f_startclock     = 0;

	ebox_attrprocess_viabinbuf(x, d);
	ebox_ready((t_ebox *)x);

	return (x);
}
Esempio n. 5
0
void *hoa_recomposer_new(t_symbol *s, long argc, t_atom *argv)
{
    t_hoa_recomposer *x = NULL;
	int	order = 4;
    int microphones = 10;
    int mode = Hoa_Fixe;
    x = (t_hoa_recomposer *)eobj_new(hoa_recomposer_class);
    
    order = atom_getint(argv);
    microphones = atom_getint(argv+1);
    if (atom_gettype(argv+2) == A_SYM)
    {
        if(atom_getsym(argv+2) == gensym("fixe"))
            mode = Hoa_Fixe;
        else if(atom_getsym(argv+2) == gensym("fisheye"))
            mode = Hoa_Fisheye;
        else if(atom_getsym(argv+2) == gensym("free"))
            mode = Hoa_Free;
    }
    if (atom_gettype(argv+2) == A_LONG)
    {
        mode = Tools::clip(long(atom_getlong(argv+2)), 0, 2);
    }
    x->f_ambi_recomposer = new AmbisonicRecomposer(order, microphones, mode, sys_getblksize(), sys_getsr());
    
    eobj_dspsetup(x, x->f_ambi_recomposer->getNumberOfInputs(), x->f_ambi_recomposer->getNumberOfOutputs());
    
	x->f_ob.d_misc = E_NO_INPLACE;
	
   	return (x);
}
Esempio n. 6
0
void *meter_new(t_symbol *s, int argc, t_atom *argv)
{
	t_meter *x =  NULL;
	t_binbuf* d;
    long flags;
	if (!(d = binbuf_via_atoms(argc,argv)))
		return NULL;
    
	x = (t_meter *)eobj_new(meter_class);
    
    flags = 0
    | EBOX_GROWINDI
    | EBOX_IGNORELOCKCLICK
    ;
    
	ebox_new((t_ebox *)x, flags);
    eobj_dspsetup((t_ebox *)x, 1, 0);
    
    x->f_direction      = 0;
    x->f_peaks_outlet   = floatout(x);
    x->f_peak_value     = -90.;
    x->f_clock          = clock_new(x,(t_method)meter_tick);
	x->f_startclock     = 0;
    x->f_over_led_preserved = 0;
    ebox_attrprocess_viabinbuf(x, d);
	ebox_ready((t_ebox *)x);
    
	return (x);
}
Esempio n. 7
0
static void *scope_new(t_symbol *s, int argc, t_atom *argv)
{
    t_scope *x =  NULL;
    t_binbuf* d;
    long flags;
    if (!(d = binbuf_via_atoms(argc,argv)))
        return NULL;

    x = (t_scope *)eobj_new(cscope_class);
    if(x)
    {
        flags = 0
                | EBOX_GROWINDI
                | EBOX_IGNORELOCKCLICK
                ;

        ebox_new((t_ebox *)x, flags);
        eobj_dspsetup((t_ebox *)x, 2, 0);

        x->f_buffer_x = (t_sample *)calloc(80192, sizeof(t_sample));
        x->f_buffer_y = (t_sample *)calloc(80192, sizeof(t_sample));

        x->f_mode     = 0;
        x->f_index    = 0;

        x->f_clock          = clock_new(x,(t_method)scope_tick);
        x->f_startclock     = 0;

        ebox_attrprocess_viabinbuf(x, d);
        ebox_ready((t_ebox *)x);
    }
    return (x);
}
Esempio n. 8
0
void *freeverb_new(t_symbol *s, int argc, t_atom *argv)
{
	t_freeverb *x =  NULL;

	x = (t_freeverb *)eobj_new(freeverb_class);
	
    eobj_dspsetup((t_ebox *)x, 1, 1);
    
    if(argc && argv && atom_gettype(argv) == A_FLOAT)
    {
        if(!atom_getfloat(argv))
            x->f_freeverb = new Freeverb(0);
        else
            x->f_freeverb = new Freeverb(1);
    }
    else if(argc && argv && atom_gettype(argv) == A_SYMBOL)
    {
        if(atom_getsymbol(argv) == gensym("right"))
            x->f_freeverb = new Freeverb(1);
        else
            x->f_freeverb = new Freeverb(0);
    }
    else
        x->f_freeverb = new Freeverb(0);    
    
    x->f_freeverb->setdamp(initialdamp);
    x->f_freeverb->setroomsize(initialroom);
    
	return (x);
}
void *hoa_scope_3D_new(t_symbol *s, int argc, t_atom *argv)
{
	t_hoa_scope_3D *x =  NULL;
	t_binbuf *d;
	long flags;
	
	if (!(d = binbuf_via_atoms(argc, argv)))
		return NULL;

	x = (t_hoa_scope_3D *)eobj_new(hoa_scope_3D_class);
    
    x->f_order      = 1;
	x->f_startclock = 0;
	x->f_scope      = new Hoa3D::Scope(x->f_order, NUMBEROFCIRCLEPOINTS_UI2 * 0.5, NUMBEROFCIRCLEPOINTS_UI2);
    x->f_order      = x->f_scope->getDecompositionOrder();
    x->f_signals    = new t_float[x->f_scope->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
    x->f_index      = 0;
    
    eobj_dspsetup(x, x->f_scope->getNumberOfHarmonics(), 0);
    
	flags = 0
    | EBOX_IGNORELOCKCLICK
    | EBOX_GROWLINK
    ;
	ebox_new((t_ebox *)x, flags);
    
    x->f_clock = clock_new(x,(t_method)hoa_scope_3D_tick);
	x->f_startclock = 0;
    
    ebox_attrprocess_viabinbuf(x, d);
	ebox_ready((t_ebox *)x);
	
	return (x);
}
Esempio n. 10
0
void *hoa_pi_tilde_new(t_symbol *s, int argc, t_atom *argv)
{
    t_hoa_pi_tilde *x = (t_hoa_pi_tilde *)eobj_new(hoa_pi_tilde_class);
	x->p_value = 1.;
    x->p_phase = 1;
    x->p_value = atom_getfloat(argv);
    eobj_dspsetup(x, 2, 1);
    
	return(x);
}
Esempio n. 11
0
void *hoa_space_t_new(t_symbol *s, long argc, t_atom *argv)
{  
    t_hoa_space_t *x = NULL;
	int	number_of_channels = 4;
    
    x = (t_hoa_space_t *)eobj_new(hoa_space_t_class);
    
    number_of_channels = atom_getint(argv);
    x->f_ambi_space = new AmbisonicSpace(number_of_channels, sys_getblksize());
    eobj_dspsetup(x, x->f_ambi_space->getNumberOfInputs(), x->f_ambi_space->getNumberOfOutputs());
    
	x->f_ob.d_misc = E_NO_INPLACE;
    
	return (x);
}
Esempio n. 12
0
void *hoa_wider_new(t_symbol *s, long argc, t_atom *argv)
{
	t_hoa_wider *x = NULL;
	int	order = 4;
    
	 x = (t_hoa_wider *)eobj_new(hoa_wider_class);

    order = atom_getint(argv);
    x->f_ambi_wider = new AmbisonicWider(order, sys_getblksize());
    eobj_dspsetup(x, x->f_ambi_wider->getNumberOfInputs(), x->f_ambi_wider->getNumberOfOutputs());
    
	x->f_ob.d_misc = E_NO_INPLACE;
    
	return (x);
}
Esempio n. 13
0
void *hoa_converter_tilde_new(t_symbol *s, int argc, t_atom *argv)
{
    t_hoa_converter_tilde *x = NULL;
    
    if(argc < 3 || atom_gettype(argv) != A_LONG || atom_gettype(argv+1) != A_SYM || atom_gettype(argv+2) != A_SYM)
    {
        error("hoa.converter~ need 4 arguments.");
        return NULL;
    }
    
    x = (t_hoa_converter_tilde *)eobj_new(hoa_converter_tilde_class);
	
    
    eobj_dspsetup(x, 2, 1);
    
	return(x);
}
Esempio n. 14
0
void *hoa_freeverb_new(t_symbol *s, long argc, t_atom *argv)
{
	t_hoa_freeverb *x = NULL;
	int	order = 4;
    
    x = (t_hoa_freeverb *)eobj_new(hoa_freeverb_class);
	if (x)
	{
        order = atom_getint(argv);
        
		x->f_ambi_freeverb = new AmbisonicFreeverb(order, sys_getblksize(), sys_getsr());
        eobj_dspsetup(x, x->f_ambi_freeverb->getNumberOfInputs(), x->f_ambi_freeverb->getNumberOfOutputs());
        
        x->f_ob.d_misc = E_NO_INPLACE;
	}
	return (x);
}
Esempio n. 15
0
void *hoa_optim_new(t_symbol *s, long argc, t_atom *argv)
{
    t_hoa_optim *x = NULL;
    t_binbuf *d;
	int	order = 4;
    
    if (!(d = binbuf_via_atoms(argc,argv)))
		return NULL;
    
    x = (t_hoa_optim *)eobj_new(hoa_optim_class);
    if (x)
	{
		if(atom_gettype(argv) == A_LONG)
			order = atom_getlong(argv);
        if(order < 1)
            order = 1;
        
        x->f_optim = new Hoa2D::Optim(order, Hoa2D::Optim::InPhase);
		
        if(argc > 1 && atom_gettype(argv+1) == A_SYM)
        {
            if(atom_getsym(argv+1) == gensym("maxRe"))
                x->f_optim->setMode(Hoa2D::Optim::MaxRe);
            else if(atom_getsym(argv+1) == gensym("basic"))
                x->f_optim->setMode(Hoa2D::Optim::Basic);
        }
        
        hoa_optim_deprecated(x, NULL, argc, argv);
        
		eobj_dspsetup(x, x->f_optim->getNumberOfHarmonics(), x->f_optim->getNumberOfHarmonics());
        
        x->f_ins = new t_float[x->f_optim->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
        x->f_outs = new t_float[x->f_optim->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
	}
    
    ebox_attrprocess_viabinbuf(x, d);
    
   	return (x);
}
Esempio n. 16
0
void *hoa_wider_3D_new(t_symbol *s, long argc, t_atom *argv)
{
    t_hoa_wider_3D *x = NULL;
	int	order = 1;
    x = (t_hoa_wider_3D *)eobj_new(hoa_wider_3D_class);
	if (x)
	{
		if(atom_gettype(argv) == A_LONG)
			order = atom_getlong(argv);
		if(order < 1)
            order = 1;
        
		x->f_wider = new Hoa3D::Wider(order);
		
        eobj_dspsetup(x, x->f_wider->getNumberOfHarmonics() + 1, x->f_wider->getNumberOfHarmonics());
        
		x->f_ins = new t_float[x->f_wider->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
        x->f_outs = new t_float[x->f_wider->getNumberOfHarmonics() * SYS_MAXBLKSIZE];
	}
    
	return (x);
}
Esempio n. 17
0
void *hoa_intilde_new(t_symbol *s, long argc, t_atom *argv)
{
    t_hoa_in_tilde *x = NULL;
    
    x = (t_hoa_in_tilde *)eobj_new(hoa_intilde_class);
	if(x)
	{
        eobj_dspsetup(x, 0, 1);
        x->f_extra = 0;
        x->f_signal = NULL;
        if(argc > 1 && argv && atom_gettype(argv) == A_SYM && atom_gettype(argv+1) == A_FLOAT && atom_getsym(argv) == gensym("extra") && atom_getfloat(argv+1) > 0)
        {
            x->f_extra = atom_getfloat(argv+1);
        }
        else if(argc && argv)
        {
            pd_error(x, "wrong argument.");
            eobj_free(x);
            return NULL;
        }
	}
    
	return x;
}
Esempio n. 18
0
void *hoa_grain_new(t_symbol *s, long argc, t_atom *argv)
{
    t_hoa_grain *x = NULL;
	int	order = 4;
    bool mode = 1;
    
    x = (t_hoa_grain *)eobj_new(hoa_grain_class);
    
    order = atom_getint(argv);
    if(atom_getsym(argv+1) == gensym("no"))
        mode = 0;
    
    x->f_ambi_grain = new AmbisonicsGrain(order, mode, 5000, sys_getblksize(), sys_getsr());
    eobj_dspsetup(x, x->f_ambi_grain->getNumberOfInputs(), x->f_ambi_grain->getNumberOfOutputs());
    hoa_grain_buffer_set(x, atom_getsymbol(argv+2));
    x->f_ambi_grain->setGrainSize(20.);
    x->f_ambi_grain->setDelayTime(100.);
    x->f_ambi_grain->setRarefaction(0.);
    x->f_ambi_grain->setFeedback(0.95);
    
	x->f_ob.d_misc = E_NO_INPLACE;
    
    return (x);
}