SynthLab SDK
SynthLab::CircularBuffer< T > Class Template Reference

The CircularBuffer object implements a simple circular buffer. It uses a wrap mask to wrap the read or write index quickly. More...

#include <synthbase.h>

Public Member Functions

void flushBuffer ()
 
void createCircularBuffer (uint32_t _bufferLength)
 
void createCircularBufferPowerOfTwo (uint32_t _bufferLengthPowerOfTwo)
 
void writeBuffer (T input)
 
readBuffer (int32_t delayInSamples)
 
readBuffer (double delayInFractionalSamples)
 
void setInterpolate (bool b)
 

Detailed Description

template<typename T>
class SynthLab::CircularBuffer< T >

The CircularBuffer object implements a simple circular buffer. It uses a wrap mask to wrap the read or write index quickly.

Simple delay line object implements audio delay as a circular buffer.

Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included in Designing Audio Effects Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2018 / 09 / 7
  • used as the delay line for the Resonator object with Karplus-Strong string simluation
  • intialized with lowest oscillator value (in Hz) that the resonator can synthesize rather than the usual delay time
  • taken directly from the AudioDelay object
  • Heavily detailed in the book Designing Audio Effects Plugins in C++ 2nd Ed and at http://aspikplugins.com/sdkdocs/html/index.html
Author
Will Pirkle http://www.willpirkle.com
Remarks
This object is included in Designing Audio Effects Plugins in C++ 2nd Ed. by Will Pirkle
Version
Revision : 1.0
Date
Date : 2018 / 09 / 7

Member Function Documentation

◆ createCircularBuffer()

template<typename T>
void SynthLab::CircularBuffer< T >::createCircularBuffer ( uint32_t  _bufferLength)
inline

Create a buffer based on a target maximum in SAMPLES do NOT call from realtime audio thread; do this prior to any processing

◆ createCircularBufferPowerOfTwo()

template<typename T>
void SynthLab::CircularBuffer< T >::createCircularBufferPowerOfTwo ( uint32_t  _bufferLengthPowerOfTwo)
inline

Create a buffer based on a target maximum in SAMPLESwhere the size is pre-calculated as a power of two

◆ flushBuffer()

template<typename T>
void SynthLab::CircularBuffer< T >::flushBuffer ( )
inline

flush buffer by resetting all values to 0.0

◆ readBuffer() [1/2]

template<typename T>
T SynthLab::CircularBuffer< T >::readBuffer ( int32_t  delayInSamples)
inline

read an arbitrary location that is delayInSamples old

◆ readBuffer() [2/2]

template<typename T>
T SynthLab::CircularBuffer< T >::readBuffer ( double  delayInFractionalSamples)
inline

read an arbitrary location that includes a fractional sample

◆ setInterpolate()

template<typename T>
void SynthLab::CircularBuffer< T >::setInterpolate ( bool  b)
inline

enable or disable interpolation; usually used for diagnostics or in algorithms that require strict integer samples times

◆ writeBuffer()

template<typename T>
void SynthLab::CircularBuffer< T >::writeBuffer ( input)
inline

write a value into the buffer; this overwrites the previous oldest value in the buffer


The documentation for this class was generated from the following file: