2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef __ardour_fixed_delay_h__
20 #define __ardour_fixed_delay_h__
23 #include "ardour/buffer.h"
29 class LIBARDOUR_API FixedDelay
35 void configure (const ChanCount& count, framecnt_t);
36 void set (const ChanCount& count, framecnt_t);
38 void delay (ARDOUR::DataType, uint32_t, Buffer&, const Buffer&, pframes_t, framecnt_t dst_offset = 0, framecnt_t src_offset = 0);
39 void flush() { _pending_flush = true; }
42 framecnt_t _max_delay;
49 DelayBuffer () : buf (0), pos (0) {}
50 DelayBuffer (DataType dt, size_t capacity)
51 : buf (Buffer::create (dt, capacity)), pos (0) {}
52 ~DelayBuffer () { delete buf; }
57 typedef std::vector<DelayBuffer*> BufferVec;
58 // Vector of vectors, indexed by DataType
59 std::vector<BufferVec> _buffers;
61 void ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capacity);
67 #endif // __ardour_fixed_delay_h__