24 mDivisor(1.0f / (float) 0x7fffffff) {
30 Scalable((float)ampl, (float)offset),
33 mDivisor(1.0f / (float) 0x7fffffff) {
39 Scalable((float)ampl, (float)offset),
42 mDivisor(1.0f / (float) 0x7fffffff) {
47 logMsg(
"a Noise generator");
57 sample* out = outputBuffer.buffer(outBufNum);
58 unsigned numFrames = outputBuffer.mNumFrames;
63 logMsg(
"WhiteNoise nextBuffer");
65 for (
unsigned i = 0; i < numFrames; i++) {
67 *out++ = ((((float) generateRandomNumber()) * mDivisor) * scaleValue) + offsetValue;
103 for (i=0; i<numRows; i++ )
mPinkRows[i] = 0;
120 while((n & 1) == 0 ) {
139 static float pinkMax = 0, pinkMin = 0;
140 if (output > pinkMax ) pinkMax = output;
141 else if (output < pinkMin ) pinkMin = output;
149 unsigned numFrames = outputBuffer.mNumFrames;
153 logMsg(
"SineAsScaled nextBuffer");
156 for (
unsigned i = 0; i < numFrames; i++ ) {
157 *out++ = (nextPink() * scaleValue) + offsetValue;
sample * SampleBuffer
1-channel buffer data type, vector of (sample)
#define UPDATE_SCALABLE_CONTROLS
void logMsg(const char *format,...)
These are the public logging messages.
sample nextPink()
returns the next pink noise sample
int mPinkIndex
Incremented each sample.
call monoNextBuffer multiple times
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
int generateRandomNumber()
returns the next pseudo-random number
void initialize(int numRows)
set up PinkNoise for N rows of generators
Abstract Noise class - inherits from UnitGenerator & Scalable, and provides constructors and basic ps...
virtual void dump()
pretty-print the receiver
int mPinkRunningSum
Used to optimize summing of generators.
Scalable – mix-in class with scale and offset control inputs (may be constants or generators)...
int mPinkIndexMask
Index wrapped by ANDing with this mask.
int mPinkRows[PINK_MAX_RANDOM_ROWS]
Pink noise generator rows.
float mPinkScalar
Used to scale within range of -1.0 to +1.0.
float sample
(could be changed to int, or double)
#define PINK_RANDOM_SHIFT
void setCopyPolicy(BufferCopyPolicy ch)
get/set the receiver's buffer copy policy
#define LOAD_SCALABLE_CONTROLS
Load the scale/offset-related values at the start.
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
void dump()
Tell me more about what is happening.
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
Destructor.
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
Destructor.
virtual void dump()
pretty-print the receiver's input/controls map
Base class of CSL exceptions (written upper-case). Has a string message.
#define DECLARE_SCALABLE_CONTROLS
Macros for all the Scalable UnitGenerators (note that these don't end with ";")