Ardour  9.0-pre0-386-g96ef4d20f2
ARDOUR::FixedDelay Class Reference

#include <fixed_delay.h>

Classes

struct  DelayBuffer
 

Public Member Functions

 FixedDelay ()
 
 ~FixedDelay ()
 
void configure (const ChanCount &count, samplecnt_t max_delay, bool shrink=true)
 
void set (const ChanCount &count, samplecnt_t delay)
 
void delay (ARDOUR::DataType dt, uint32_t id, Buffer &out, const Buffer &in, pframes_t n_samples, samplecnt_t dst_offset=0, samplecnt_t src_offset=0)
 
void flush ()
 
samplecnt_t delay () const
 

Private Types

typedef std::vector< DelayBuffer * > BufferVec
 

Private Member Functions

void ensure_buffers (DataType type, size_t num_buffers, size_t buffer_capacity)
 
void clear ()
 

Private Attributes

samplecnt_t _max_delay
 
samplecnt_t _buf_size
 
samplecnt_t _delay
 
ChanCount _count
 
std::vector< BufferVec_buffers
 

Detailed Description

Multichannel Audio/Midi Delay Line

This is an efficient delay line operating directly on Ardour buffers. The drawback is that there is no thread safety: All calls need to be executed in the same thread.

After configuration, the delay can be changed safely up to the maximum configured delay but doing so flushes the buffer. There is no de-clicking (see ARDOUR::Delayline for those cases).

Increasing the delay above the max configured or requesting more buffers will allocate the required space (not realtime safe).

All buffers part of the set are treated separately.

Definition at line 43 of file fixed_delay.h.

Member Typedef Documentation

◆ BufferVec

typedef std::vector<DelayBuffer*> ARDOUR::FixedDelay::BufferVec
private

Definition at line 104 of file fixed_delay.h.

Constructor & Destructor Documentation

◆ FixedDelay()

ARDOUR::FixedDelay::FixedDelay ( )

◆ ~FixedDelay()

ARDOUR::FixedDelay::~FixedDelay ( )

Member Function Documentation

◆ clear()

void ARDOUR::FixedDelay::clear ( )
private

◆ configure()

void ARDOUR::FixedDelay::configure ( const ChanCount count,
samplecnt_t  max_delay,
bool  shrink = true 
)

initial configuration, usually done after instantiation

Parameters
countChannel Count (audio+midi)
max_delaythe maximum number of samples to delay
shrinkwhen false already allocated buffers are kept if both channel-count and max-delay requirements are satisified

◆ delay() [1/2]

samplecnt_t ARDOUR::FixedDelay::delay ( ) const
inline
Returns
configured delay time in samples

Definition at line 86 of file fixed_delay.h.

◆ delay() [2/2]

void ARDOUR::FixedDelay::delay ( ARDOUR::DataType  dt,
uint32_t  id,
Buffer out,
const Buffer in,
pframes_t  n_samples,
samplecnt_t  dst_offset = 0,
samplecnt_t  src_offset = 0 
)

process a channel

Read N samples from the input buffer, delay them by the configured delay-time and write the delayed samples to the output buffer at the given offset.

Parameters
dtdatatype
idbuffer number (starting at 0)
outoutput buffer to write data to
ininput buffer to read data from
n_samplesnumber of samples to process (must be <= 8192)
dst_offsetoffset in output buffer to start writing to
src_offsetoffset in input buffer to start reading from

◆ ensure_buffers()

void ARDOUR::FixedDelay::ensure_buffers ( DataType  type,
size_t  num_buffers,
size_t  buffer_capacity 
)
private

◆ flush()

void ARDOUR::FixedDelay::flush ( )

zero all buffers

◆ set()

void ARDOUR::FixedDelay::set ( const ChanCount count,
samplecnt_t  delay 
)

set delay time and update active process buffers

This calls configure with shrink = false and sets the current delay time if the delay time mismatches, the buffers are silenced (zeroed).

Parameters
countchannels to be processed
delaynumber of audio samples to delay

Member Data Documentation

◆ _buf_size

samplecnt_t ARDOUR::FixedDelay::_buf_size
private

Definition at line 90 of file fixed_delay.h.

◆ _buffers

std::vector<BufferVec> ARDOUR::FixedDelay::_buffers
private

Definition at line 106 of file fixed_delay.h.

◆ _count

ChanCount ARDOUR::FixedDelay::_count
private

Definition at line 92 of file fixed_delay.h.

◆ _delay

samplecnt_t ARDOUR::FixedDelay::_delay
private

Definition at line 91 of file fixed_delay.h.

◆ _max_delay

samplecnt_t ARDOUR::FixedDelay::_max_delay
private

Definition at line 89 of file fixed_delay.h.


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