Пример #1
0
	void SourcesTrajectory::erase(double aFractionnalValueBegin, double aFractionnalValueEnd)
	{
		long anIndexBegin = clip_minmax(aFractionnalValueBegin, 0., 1.) * (double)getMaximumIndexOfSlot();
		long anIndexEnd = clip_minmax(aFractionnalValueEnd, 0., 1.) * (double)getMaximumIndexOfSlot();
		for(long i = anIndexBegin; i < anIndexEnd; i++)
		{
			deleteSlot(i);
		}
	}
Пример #2
0
 Wider::Wider(unsigned int order) : Ambisonic(order)
 {
     m_wide              = NUMBEROFLINEARPOINTS - 1;
     m_wide_matrix       = new double[NUMBEROFLINEARPOINTS * m_number_of_harmonics];
     
     double weight_order = log((double)(m_order + 1));
     
     for(unsigned int j = 0; j < NUMBEROFLINEARPOINTS; j++)
     {
         m_wide_matrix[j * m_number_of_harmonics] = (1. - ((double)j / (double)(NUMBEROFLINEARPOINTS-1))) * weight_order + 1.;
     }
     for(unsigned int i = 1; i < m_number_of_harmonics; i++)
     {
         double minus =  clip_min(log((double)getHarmonicDegree(i)), 0.);
         minus = -minus;
         
         double dot	= clip_min(log((double)getHarmonicDegree(i) + 1.), 0.);
         dot += minus;
         dot  = 1. / dot;
         
         for(unsigned int j = 0; j < NUMBEROFLINEARPOINTS; j++)
         {
             double weight = (1. - ((double)j / (double)(NUMBEROFLINEARPOINTS-1))) * weight_order + 1.;
             double scale = ((double)j / (double)(NUMBEROFLINEARPOINTS-1)) * weight_order;
             double new_weight = (minus + scale) * dot;
             new_weight = clip_minmax(new_weight, 0., 1.);
             m_wide_matrix[j * m_number_of_harmonics + i] = new_weight * weight;
         }
     }
 }
Пример #3
0
	void SourcesTrajectory::playTrajectory(SourcesManager* aSouceManager, double aFractionnalValue)
	{
		aFractionnalValue = clip_minmax(aFractionnalValue, 0., 1.);
		double aFractionalIndex = aFractionnalValue * (double)getMaximumIndexOfSlot();
		
		recallFractionalSlot(aSouceManager, aFractionalIndex);
		m_last_slot_stored = aFractionalIndex-1;
	}
Пример #4
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);
}
Пример #5
0
t_max_err angles_set(t_hoa_vector *x, t_object *attr, long argc, t_atom *argv)
{
    if(argc && argv)
    {
        for(int i = 0; i < argc && i < x->f_vector->getNumberOfChannels(); i++)
        {
            if(atom_gettype(argv+i) == A_LONG || atom_gettype(argv+i) == A_FLOAT);
               x->f_vector->setChannelAzimuth(i, clip_minmax(atom_getfloat(argv+i), -360., 360.) / 360. * HOA_2PI);
        }
    }
    return MAX_ERR_NONE;
}
Пример #6
0
 void Wider::setWideningValue(const double value)
 {
      m_wide = clip_minmax(value, 0., 1.) * (double)(NUMBEROFLINEARPOINTS - 1);
 }
Пример #7
0
void *hoa_map_new(t_symbol *s, long argc, t_atom *argv)
{
	// @arg 0 @name ambisonic-order @optional 0 @type int @digest The ambisonic order of decomposition
	// @description First argument is the ambisonic order of decomposition.
	
	// @arg 1 @name number-of-sources @optional 0 @type int @digest The number of sources
	// @description Second argument is the number of sources to spatialize.
	// If there is a single source, <o>hoa.2d.map~</o> object owns 3 inlets, the first one correspond to the signal to encode, the two other ones are usefull  to control source position at signal rate. If you have more than one source to spatialize, the number of signal inlets will be equal to the number of sources to encode, and coordinates will be given with list messages.
	
	t_hoa_map *x = NULL;
	int	order = 1;
    int numberOfSources = 1;
    t_symbol* temp_mode;
	
    x = (t_hoa_map *)object_alloc(hoa_map_class);
	if (x)
	{
		x->f_ramp       = 100;
        x->f_mode       = hoa_sym_polar;
		
		if(argc && 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, MAX_CHANNELS);
		
		if(argc > 2 && atom_gettype(argv+2) == A_SYM)
		{
			temp_mode = atom_getsym(argv+2);
			if(temp_mode == hoa_sym_cartesian)
				x->f_mode = hoa_sym_cartesian;
			else if(temp_mode == hoa_sym_polar)
				x->f_mode = hoa_sym_polar;
		}
		
		x->f_map        = new Hoa2D::Map(order, numberOfSources);
		x->f_lines      = new PolarLines(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.);
        }
        
        if(x->f_map->getNumberOfSources() == 1)
            x->f_sig_ins    = new double[3 * 8192];
        else
            x->f_sig_ins    = new double[x->f_map->getNumberOfSources() * 8192];
        
        x->f_sig_outs   = new double[x->f_map->getNumberOfHarmonics() * 8192];
		
		if(x->f_map->getNumberOfSources() == 1)
            dsp_setup((t_pxobject *)x, 3);
        else
            dsp_setup((t_pxobject *)x, x->f_map->getNumberOfSources());
		
		for (int i = 0; i < x->f_map->getNumberOfHarmonics(); i++)
			outlet_new(x, "signal");
        
	}
	
	return (x);
}
Пример #8
0
	void SourcesManager::setZoom(double aZoom)
	{
		m_zoom = clip_minmax(aZoom, 1. / m_maximum_radius, 1.);
	}