Ejemplo n.º 1
0
StkFrames& Generator :: tick( StkFrames& frames, unsigned int channel )
{
  if ( channel >= frames.channels() ) {
    errorString_ << "Generator::tick(): channel and StkFrames arguments are incompatible!";
    handleError( StkError::FUNCTION_ARGUMENT );
  }

  if ( frames.channels() == 1 ) {
    for ( unsigned int i=0; i<frames.frames(); i++ )
      frames[i] = computeSample();
  }
  else if ( frames.interleaved() ) {
    unsigned int hop = frames.channels();
    unsigned int index = channel;
    for ( unsigned int i=0; i<frames.frames(); i++ ) {
      frames[index] = computeSample();
      index += hop;
    }
  }
  else {
    unsigned int iStart = channel * frames.frames();
    for ( unsigned int i=0; i<frames.frames(); i++, iStart++ )
      frames[iStart] = computeSample();
  }

  return frames;
}
Ejemplo n.º 2
0
void WvOut :: tick( const StkFrames& frames, unsigned int channel )
{
  if ( channel >= frames.channels() ) {
    errorString_ << "WvOut::tick(): channel argument (" << channel << ") is incompatible with StkFrames argument!";
    handleError( StkError::FUNCTION_ARGUMENT );
  }

  if ( frames.channels() == 1 ) {
    for ( unsigned int i=0; i<frames.frames(); i++ )
      computeSample( frames[i] );
  }
  else if ( frames.interleaved() ) {
    unsigned int hop = frames.channels();
    unsigned int index = channel;
    for ( unsigned int i=0; i<frames.frames(); i++ ) {
      computeSample( frames[index] );
      index += hop;
    }
  }
  else {
    unsigned int iStart = channel * frames.frames();
    for ( unsigned int i=0; i<frames.frames(); i++ )
      computeSample( frames[iStart++] );
  }
}
Ejemplo n.º 3
0
Sample UniformSampler::getNextSample()
{
	Sample seed(getDimension());
	for(int i=0;i<getDimension();i++)seed[i]=0.0;
	Sample aux=getNextNormalizedSample(iteration, seed, 1.0);
	iteration++;
	for(int j=0;j<getDimension();j++)
		normalizedSample[j]=aux[j];
	return computeSample();
}
Ejemplo n.º 4
0
//////GAUSSIAN SAMPLER
Sample GaussianSampler::getNextSample()
{
	int number=iteration;
	double cellsize=0.5F, cov;
	while(number>0){
		number/=L_n;
		cellsize/=2;
	}
	if(iteration==0)cellsize=0.25;

	cov=cellsize*cellsize;
	UniformSampler::getNextSample();
	for(int j=0;j<getDimension();j++)
		normalizedSample[j]=sampleGaussian(6,normalizedSample[j],cov);
	return computeSample();
}
Ejemplo n.º 5
0
float CrossfadingDelayLine::tick(float sample) {
	float retval = computeSample();
	advance(sample);
	return retval;
}
float InterpolatedDelayLine::tick(float sample) {
	float retval = computeSample();
	advance(sample);
	return retval;
}
Ejemplo n.º 7
0
////RANDOM SAMPLER: example of how to construct a simple n dimensional sampler 
Sample RandomSampler::getNextSample()
{
	for(int i=0;i<getDimension();i++)
		normalizedSample[i]=(double) rand() / (double) RAND_MAX;
	return computeSample();
}
Ejemplo n.º 8
0
StkFloat Generator :: tick( void )
{
  return computeSample();
}
Ejemplo n.º 9
0
StkFloat Instrmnt :: tick( void )
{
  return computeSample();
}