42 unsigned numFrames = outputBuffer.mNumFrames;
43 sample* outputBufferPtr = outputBuffer.buffer(outBufNum);
44 sample* windowBufferPtr = mWindowBuffer.buffer(0);
45 unsigned windowBufferPos = mWindowBufferPos;
46 unsigned windowBufferSize = mWindowSize;
48 logMsg(
"Window::nextBuffer");
50 for (
unsigned i = 0; i < numFrames; i++) {
51 if (windowBufferPos > windowBufferSize)
53 *outputBufferPtr++ = windowBufferPtr[windowBufferPos++];
55 mWindowBufferPos = windowBufferPos;
62 *windowBufferPtr++ = (0.54 - 0.46*cos(
CSL_TWOPI*i/(mWindowSize - 1) ));
68 *windowBufferPtr++ =
mGain;
75 float step = 1.0f / ((float) winHalf);
76 for (
unsigned i = 0; i < winHalf; i++ ) {
77 *windowBufferPtr++ = accum;
81 *windowBufferPtr++ = accum;
90 *windowBufferPtr++ = (0.54 - 0.46*cos(i * increment));
98 *windowBufferPtr++ = 0.5 * (1 - cos(i * increment)) *
mGain;
106 *windowBufferPtr++ = (0.42 - 0.5 * cos(i * increment) + 0.08 * cos(2 * i * increment)) *
mGain;
114 *windowBufferPtr++ = (0.35875 - 0.48829 * cos(i * increment)
115 + 0.14128 * cos(2 * i * increment)
116 - 0.01168 * cos(3 * i * increment)) *
mGain;
125 *windowBufferPtr++ = (1.f - phase * phase) *
mGain;
void logMsg(const char *format,...)
These are the public logging messages.
void fillWindow()
subclasses override this to fill the buffer with corresponding function.
virtual void fillWindow()
subclasses override this to fill the buffer with corresponding function.
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
virtual SampleBuffer buffer(unsigned bufNum)
convenience accessors for sample buffers
float mGain
gain for the window
void fillWindow()
subclasses override this to fill the buffer with corresponding function.
void setGain(float gain)
Set the gain to which the window should be normalized.
void freeBuffers()
fcn to free them
void setSize(unsigned numChannels, unsigned numFrames)
Buffer mWindowBuffer
used to store the window
void dump()
Print some info about the window.
unsigned mWindowBufferPos
where am I in the window buffer
static unsigned blockSize()
the default block size
unsigned mWindowSize
length in samples of the window
float sample
(could be changed to int, or double)
void setSize(unsigned windowSize)
Set the number of samples the window spans.
void fillWindow()
subclasses override this to fill the buffer with corresponding function.
void fillWindow()
subclasses override this to fill the buffer with corresponding function.
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
void fillWindow()
subclasses override this to fill the buffer with corresponding function.
void fillWindow()
subclasses override this to fill the buffer with corresponding function.
void allocateBuffers()
fcn to malloc storage buffers
~Window()
clean-up . . . free the allocated buffer that held the window data.
void fillWindow()
subclasses override this to fill the buffer with corresponding function.
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
Returns a pointer to the window data.
Base class of CSL exceptions (written upper-case). Has a string message.
Window()
Creates a window using the default Gestalt size and a gain of 1; < Creates a window (hann) with the s...