SoundFontInfoLib  2.21.6
Library for parsing and rendering SF2 files
SF2::Render::DelayBuffer< T > Class Template Reference

Circular buffer that acts as a delay for samples. More...

#include <DelayBuffer.hpp>

Public Member Functions

 DelayBuffer (double sizeInSamples)
 Construct new buffer. More...
 
void clear ()
 Clear the buffer by setting all entries to zero. More...
 
void setSizeInSamples (double sizeInSamples)
 Resize the buffer. More...
 
void write (T value)
 Place a sample in the buffer, overwriting the oldest. More...
 
size_t size () const
 Obtain the size of the buffer. More...
 
readFromOffset (int offset) const
 Read the value at the given offset from the newest value. More...
 
read (double delay) const
 Read the value at the given offset from the newest value. More...
 

Detailed Description

template<typename T>
class SF2::Render::DelayBuffer< T >

Circular buffer that acts as a delay for samples.

Constructor & Destructor Documentation

◆ DelayBuffer()

template<typename T >
SF2::Render::DelayBuffer< T >::DelayBuffer ( double  sizeInSamples)
inline

Construct new buffer.

Parameters
sizeInSamplesnumber of samples to hold in the buffer

References SF2::Render::DelayBuffer< T >::clear().

Member Function Documentation

◆ clear()

template<typename T >
void SF2::Render::DelayBuffer< T >::clear ( )
inline

Clear the buffer by setting all entries to zero.

Referenced by SF2::Render::DelayBuffer< T >::DelayBuffer(), and SF2::Render::DelayBuffer< T >::setSizeInSamples().

◆ read()

template<typename T >
T SF2::Render::DelayBuffer< T >::read ( double  delay) const
inline

Read the value at the given offset from the newest value.

Parameters
delaythe offset from the most recently written sample
Returns
the value from the buffer

References SF2::Render::DelayBuffer< T >::readFromOffset().

◆ readFromOffset()

template<typename T >
T SF2::Render::DelayBuffer< T >::readFromOffset ( int  offset) const
inline

Read the value at the given offset from the newest value.

Parameters
offsetthe offset from the most recently written sample
Returns
the value from the buffer

Referenced by SF2::Render::DelayBuffer< T >::read().

◆ setSizeInSamples()

template<typename T >
void SF2::Render::DelayBuffer< T >::setSizeInSamples ( double  sizeInSamples)
inline

Resize the buffer.

Parameters
sizeInSamplesnew number of samples to hold

References SF2::Render::DelayBuffer< T >::clear().

◆ size()

template<typename T >
size_t SF2::Render::DelayBuffer< T >::size ( ) const
inline

Obtain the size of the buffer.

Returns
buffer size

◆ write()

template<typename T >
void SF2::Render::DelayBuffer< T >::write ( value)
inline

Place a sample in the buffer, overwriting the oldest.

Parameters
valuethe value to write

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