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; }
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++] ); } }
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(); }
//////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(); }
float CrossfadingDelayLine::tick(float sample) { float retval = computeSample(); advance(sample); return retval; }
float InterpolatedDelayLine::tick(float sample) { float retval = computeSample(); advance(sample); return retval; }
////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(); }
StkFloat Generator :: tick( void ) { return computeSample(); }
StkFloat Instrmnt :: tick( void ) { return computeSample(); }