40 StkFloat
lastOut(
void )
const {
return lastFrame_[0]; };
43 StkFloat
tick(
void );
59inline StkFloat Noise :: tick(
void )
61 return lastFrame_[0] = (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) - 1.0 );
66#if defined(_STK_DEBUG_)
67 if ( channel >= frames.
channels() ) {
68 oStream_ <<
"Noise::tick(): channel and StkFrames arguments are incompatible!";
69 handleError( StkError::FUNCTION_ARGUMENT );
73 StkFloat *samples = &frames[channel];
74 unsigned int hop = frames.
channels();
75 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
76 *samples = (StkFloat) ( 2.0 * rand() / (RAND_MAX + 1.0) - 1.0 );
78 lastFrame_[0] = *(samples-hop);
STK abstract unit generator parent class.
Definition Generator.h:21
STK noise generator.
Definition Noise.h:22
Noise(unsigned int seed=0)
Default constructor that can also take a specific seed value.
StkFloat lastOut(void) const
Return the last computed output value.
Definition Noise.h:40
StkFloat tick(void)
Compute and return one output sample.
Definition Noise.h:59
void setSeed(unsigned int seed=0)
Seed the random number generator with a specific seed value.
An STK class to handle vectorized audio data.
Definition Stk.h:279
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition Stk.h:416
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition Stk.h:419
The STK namespace.
Definition ADSR.h:6