mirror of
https://github.com/thestk/stk
synced 2026-01-15 22:11:52 +00:00
Version 4.2.0
This commit is contained in:
committed by
Stephen Sinclair
parent
cf06b7598b
commit
a6381b9d38
@@ -6,7 +6,7 @@
|
||||
C rand() function. The quality of the rand()
|
||||
function varies from one OS to another.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
Noise :: Noise() : Stk()
|
||||
Noise :: Noise() : Generator()
|
||||
{
|
||||
// Seed the random number generator with system time.
|
||||
this->setSeed( 0 );
|
||||
lastOutput = (MY_FLOAT) 0.0;
|
||||
lastOutput_ = (StkFloat) 0.0;
|
||||
}
|
||||
|
||||
Noise :: Noise( unsigned int seed ) : Stk()
|
||||
Noise :: Noise( unsigned int seed ) : Generator()
|
||||
{
|
||||
// Seed the random number generator
|
||||
this->setSeed( seed );
|
||||
lastOutput = (MY_FLOAT) 0.0;
|
||||
lastOutput_ = (StkFloat) 0.0;
|
||||
}
|
||||
|
||||
Noise :: ~Noise()
|
||||
@@ -40,23 +40,20 @@ void Noise :: setSeed( unsigned int seed )
|
||||
srand( seed );
|
||||
}
|
||||
|
||||
MY_FLOAT Noise :: tick()
|
||||
StkFloat Noise :: tick()
|
||||
{
|
||||
lastOutput = (MY_FLOAT) (2.0 * rand() / (RAND_MAX + 1.0) );
|
||||
lastOutput -= 1.0;
|
||||
return lastOutput;
|
||||
lastOutput_ = (StkFloat) (2.0 * rand() / (RAND_MAX + 1.0) );
|
||||
lastOutput_ -= 1.0;
|
||||
return lastOutput_;
|
||||
}
|
||||
|
||||
MY_FLOAT *Noise :: tick(MY_FLOAT *vector, unsigned int vectorSize)
|
||||
StkFloat *Noise :: tick(StkFloat *vector, unsigned int vectorSize)
|
||||
{
|
||||
for (unsigned int i=0; i<vectorSize; i++)
|
||||
vector[i] = tick();
|
||||
|
||||
return vector;
|
||||
return Generator::tick( vector, vectorSize );
|
||||
}
|
||||
|
||||
MY_FLOAT Noise :: lastOut() const
|
||||
StkFrames& Noise :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
return lastOutput;
|
||||
return Generator::tick( frames, channel );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user