Audio Processing Framework (APF) version 0.5.0
|
Block-based delay line. More...
#include <apf/blockdelayline.h>
Public Types | |
using | size_type = typename Container::size_type |
using | difference_type = typename Container::difference_type |
using | pointer = typename Container::pointer |
using | circulator = apf::circular_iterator< typename Container::iterator > |
Public Member Functions | |
BlockDelayLine (size_type block_size, size_type max_delay) | |
Constructor. More... | |
bool | delay_is_valid (size_type delay, size_type &corrected) const |
Check if a given delay is valid. More... | |
bool | delay_is_valid (size_type delay) const |
Return true if delay is valid. More... | |
void | advance () |
Advance the internal iterators/pointers to the next block. More... | |
template<typename Iterator > | |
void | write_block (Iterator source) |
Write a block of data to the delay line. More... | |
template<typename Iterator > | |
bool | read_block (Iterator destination, size_type delay) const |
Read a block of data from the delay line. More... | |
template<typename Iterator > | |
bool | read_block (Iterator destination, size_type delay, T weight) const |
Read from the delay line and multiply each element by a given factor. More... | |
pointer | get_write_pointer () const |
Get the write pointer. More... | |
circulator | get_read_circulator (size_type delay=0) const |
Get the read circulator. More... | |
Protected Member Functions | |
circulator | _get_data_circulator () const |
Get a circular iterator to the sample with time 0. More... | |
Protected Attributes | |
const size_type | _block_size |
Size of read/write blocks. More... | |
Block-based delay line.
This is a "write once, read many times" delay line. The write operation is simple and fast. The desired delay is specified at the more flexible read operation.
Definition at line 47 of file blockdelayline.h.
using apf::BlockDelayLine< T, Container >::size_type = typename Container::size_type |
Definition at line 50 of file blockdelayline.h.
using apf::BlockDelayLine< T, Container >::difference_type = typename Container::difference_type |
Definition at line 51 of file blockdelayline.h.
using apf::BlockDelayLine< T, Container >::pointer = typename Container::pointer |
Definition at line 52 of file blockdelayline.h.
using apf::BlockDelayLine< T, Container >::circulator = apf::circular_iterator<typename Container::iterator> |
Definition at line 53 of file blockdelayline.h.
apf::BlockDelayLine< T, Container >::BlockDelayLine | ( | size_type | block_size, |
size_type | max_delay | ||
) |
Constructor.
block_size | Block size |
max_delay | Maximum delay in samples |
Definition at line 121 of file blockdelayline.h.
References apf::BlockDelayLine< T, Container >::_block_size.
|
inline |
Check if a given delay is valid.
delay | Desired delay | |
[out] | corrected | If valid, the same as delay , if not, the maximum possible delay. |
delay
is valid. Definition at line 62 of file blockdelayline.h.
Referenced by apf::NonCausalBlockDelayLine< T, Container >::delay_is_valid(), and apf::BlockDelayLine< T, Container >::delay_is_valid().
|
inline |
Return true if delay
is valid.
Definition at line 70 of file blockdelayline.h.
References apf::BlockDelayLine< T, Container >::delay_is_valid().
|
inline |
Advance the internal iterators/pointers to the next block.
Definition at line 77 of file blockdelayline.h.
References apf::BlockDelayLine< T, Container >::_block_size.
void apf::BlockDelayLine< T, Container >::write_block | ( | Iterator | source | ) |
Write a block of data to the delay line.
Before writing, the read and write pointers are advanced to the next block. If you don't want to use this function, you can also call advance(), get the write pointer with get_write_pointer() and write directly to it.
source | Pointer/iterator where the block of data shall be read from. |
source
there must be enough data to read from! source
must be a random access iterator. If you want to use another iterator, you'll have to do it on your own (as written above). Definition at line 152 of file blockdelayline.h.
bool apf::BlockDelayLine< T, Container >::read_block | ( | Iterator | destination, |
size_type | delay | ||
) | const |
Read a block of data from the delay line.
destination | Iterator to destination |
delay | Delay in samples |
Definition at line 167 of file blockdelayline.h.
Referenced by apf::NonCausalBlockDelayLine< T, Container >::read_block().
bool apf::BlockDelayLine< T, Container >::read_block | ( | Iterator | destination, |
size_type | delay, | ||
T | weight | ||
) | const |
Read from the delay line and multiply each element by a given factor.
Definition at line 183 of file blockdelayline.h.
BlockDelayLine< T, Container >::pointer apf::BlockDelayLine< T, Container >::get_write_pointer |
Get the write pointer.
Definition at line 201 of file blockdelayline.h.
BlockDelayLine< T, Container >::circulator apf::BlockDelayLine< T, Container >::get_read_circulator | ( | size_type | delay = 0 | ) | const |
Get the read circulator.
delay | Delay in samples |
max_delay
. You are responsible for checking that! Definition at line 213 of file blockdelayline.h.
Referenced by apf::NonCausalBlockDelayLine< T, Container >::get_read_circulator().
|
inlineprotected |
Get a circular iterator to the sample with time 0.
Definition at line 98 of file blockdelayline.h.
|
protected |
Size of read/write blocks.
Definition at line 100 of file blockdelayline.h.
Referenced by apf::BlockDelayLine< T, Container >::advance(), and apf::BlockDelayLine< T, Container >::BlockDelayLine().