Gin
Loading...
Searching...
No Matches
DelayLine Class Reference

Multi-channel delay line with interpolated tap reading. More...

#include <gin_delayline.h>

Public Member Functions

 DelayLine (int channels, double maximumDelay=0.001f, double sr=44100.0f)
void setSize (int channels, double maximumDelay, double sr)
int getNumChannels () const
void clear ()
float readLagrange (int ch, double t)
float readLinear (int ch, double t)
float readSample (int ch, int samplePos)
float readSampleLagrange (int ch, float samplePos)
void write (int ch, float input)
void writeFinished ()

Protected Attributes

juce::AudioSampleBuffer buffer
float *const * data = nullptr
double sampleRate = 44100.0
int writePos = 0

Detailed Description

Multi-channel delay line with interpolated tap reading.

DelayLine provides a circular buffer-based delay line that supports multiple channels and fractional delay times through interpolation. It's the building block for creating delay effects, choruses, flangers, and reverbs.

Key Features:

  • Multi-channel support (configurable channel count)
  • Linear and Lagrange interpolation for fractional delays
  • Time-based or sample-based delay reading
  • Efficient circular buffer implementation
  • Per-channel independent delay taps

Interpolation Methods:

Usage:

DelayLine delay(2, 2.0, 44100.0); // 2 channels, 2 seconds max, 44.1kHz
// Write samples
for (int ch = 0; ch < 2; ch++)
delay.write(ch, inputSample[ch]);
delay.writeFinished();
// Read with fractional delay (0.5 seconds)
float delayedL = delay.readLinear(0, 0.5);
float delayedR = delay.readLinear(1, 0.5);
DelayLine(int channels, double maximumDelay=0.001f, double sr=44100.0f)
Definition gin_delayline.h:55
See also
StereoDelay

Constructor & Destructor Documentation

◆ DelayLine()

DelayLine::DelayLine ( int channels,
double maximumDelay = 0.001f,
double sr = 44100.0f )

References setSize().

Member Function Documentation

◆ setSize()

void DelayLine::setSize ( int channels,
double maximumDelay,
double sr )

References buffer, data, sampleRate, and writePos.

Referenced by DelayLine().

◆ getNumChannels()

int DelayLine::getNumChannels ( ) const

References buffer.

◆ clear()

void DelayLine::clear ( )

References buffer, and writePos.

◆ readLagrange()

float DelayLine::readLagrange ( int ch,
double t )

◆ readLinear()

float DelayLine::readLinear ( int ch,
double t )

References buffer, data, sampleRate, and writePos.

◆ readSample()

float DelayLine::readSample ( int ch,
int samplePos )

References buffer, data, and writePos.

◆ readSampleLagrange()

float DelayLine::readSampleLagrange ( int ch,
float samplePos )

◆ write()

void DelayLine::write ( int ch,
float input )

References data, and writePos.

◆ writeFinished()

void DelayLine::writeFinished ( )

References buffer, and writePos.

Member Data Documentation

◆ buffer

juce::AudioSampleBuffer DelayLine::buffer
protected

◆ data

float* const* DelayLine::data = nullptr
protected

◆ sampleRate

double DelayLine::sampleRate = 44100.0
protected

Referenced by readLagrange(), readLinear(), and setSize().

◆ writePos

int DelayLine::writePos = 0
protected

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