26 template <
unsigned int NUM_BUFFER_SAMPLES,
class T =
int8_t>
32 T delay_array[NUM_BUFFER_SAMPLES];
33 unsigned int _write_pos;
34 unsigned int _delaytime_cells;
49 AudioDelay(
unsigned int delaytime_cells): _write_pos(0), _delaytime_cells(delaytime_cells)
59 T
next(T in_value,
unsigned int delaytime_cells)
61 ++_write_pos &= (NUM_BUFFER_SAMPLES - 1);
62 unsigned int read_pos = (_write_pos - delaytime_cells) & (NUM_BUFFER_SAMPLES - 1);
65 delay_array[_write_pos] = in_value;
66 int8_t delay_sig = delay_array[read_pos] ;
79 ++_write_pos &= (NUM_BUFFER_SAMPLES - 1);
80 unsigned int read_pos = (_write_pos - _delaytime_cells) & (NUM_BUFFER_SAMPLES - 1);
83 delay_array[_write_pos] = in_value;
84 T delay_sig = delay_array[read_pos] ;
94 void set(
unsigned int delaytime_cells){
95 _delaytime_cells = delaytime_cells;
104 T
read(
unsigned int delaytime_cells)
106 unsigned int read_pos = (_write_pos - delaytime_cells) & (NUM_BUFFER_SAMPLES - 1);
107 return delay_array[read_pos];