Ardour
9.0-pre0-386-g96ef4d20f2
|
#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 |
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.
|
private |
Definition at line 104 of file fixed_delay.h.
ARDOUR::FixedDelay::FixedDelay | ( | ) |
ARDOUR::FixedDelay::~FixedDelay | ( | ) |
|
private |
void ARDOUR::FixedDelay::configure | ( | const ChanCount & | count, |
samplecnt_t | max_delay, | ||
bool | shrink = true |
||
) |
initial configuration, usually done after instantiation
count | Channel Count (audio+midi) |
max_delay | the maximum number of samples to delay |
shrink | when false already allocated buffers are kept if both channel-count and max-delay requirements are satisified |
|
inline |
Definition at line 86 of file fixed_delay.h.
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.
dt | datatype |
id | buffer number (starting at 0) |
out | output buffer to write data to |
in | input buffer to read data from |
n_samples | number of samples to process (must be <= 8192) |
dst_offset | offset in output buffer to start writing to |
src_offset | offset in input buffer to start reading from |
|
private |
void ARDOUR::FixedDelay::flush | ( | ) |
zero all buffers
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).
count | channels to be processed |
delay | number of audio samples to delay |
|
private |
Definition at line 90 of file fixed_delay.h.
|
private |
Definition at line 106 of file fixed_delay.h.
|
private |
Definition at line 92 of file fixed_delay.h.
|
private |
Definition at line 91 of file fixed_delay.h.
|
private |
Definition at line 89 of file fixed_delay.h.