Ardour  9.0-pre0-582-g084a23a80d
delayline.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
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.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #include <memory>
22 
23 #include "ardour/types.h"
24 #include "ardour/processor.h"
25 
26 namespace ARDOUR {
27 
28 class BufferSet;
29 class ChanCount;
30 class Session;
31 
35 public:
36 
37  DelayLine (Session& s, const std::string& name);
39 
40  bool set_name (const std::string& str);
41  bool set_delay (samplecnt_t signal_delay);
42  samplecnt_t delay () { return _pending_delay; }
43 
44  /* processor interface */
45  bool display_to_user () const { return false; }
46  void run (BufferSet&, samplepos_t, samplepos_t, double, pframes_t, bool);
49  void flush ();
50 
51 protected:
52  XMLNode& state () const;
53 
54 private:
56 
57  void write_to_rb (Sample* rb, Sample* src, samplecnt_t); // honor _woff, _bsiz.
58  void read_from_rb (Sample* rb, Sample* dst, samplecnt_t); // honor _roff, _bsiz
59 
60  friend class IO;
61 
64  samplecnt_t _delay, _pending_delay;
67 
68  typedef std::vector<std::shared_ptr<Sample[]>> AudioDlyBuf;
69  typedef std::vector<std::shared_ptr<MidiBuffer>> MidiDlyBuf;
70 
73 
74 #ifndef NDEBUG
75  Glib::Threads::Mutex _set_delay_mutex;
76 #endif
77 };
78 
79 } // namespace ARDOUR
80 
bool display_to_user() const
Definition: delayline.h:45
DelayLine(Session &s, const std::string &name)
samplecnt_t delay()
Definition: delayline.h:42
samplecnt_t _bsiz_mask
Definition: delayline.h:63
bool set_name(const std::string &str)
void allocate_pending_buffers(samplecnt_t, ChanCount const &)
void write_to_rb(Sample *rb, Sample *src, samplecnt_t)
MidiDlyBuf _midi_buf
Definition: delayline.h:72
std::vector< std::shared_ptr< Sample[]> > AudioDlyBuf
Definition: delayline.h:68
void run(BufferSet &, samplepos_t, samplepos_t, double, pframes_t, bool)
bool can_support_io_configuration(const ChanCount &in, ChanCount &out)
samplecnt_t _delay
Definition: delayline.h:64
bool set_delay(samplecnt_t signal_delay)
void read_from_rb(Sample *rb, Sample *dst, samplecnt_t)
bool configure_io(ChanCount in, ChanCount out)
samplecnt_t _bsiz
Definition: delayline.h:62
XMLNode & state() const
Glib::Threads::Mutex _set_delay_mutex
Definition: delayline.h:75
sampleoffset_t _roff
Definition: delayline.h:65
AudioDlyBuf _buf
Definition: delayline.h:71
std::vector< std::shared_ptr< MidiBuffer > > MidiDlyBuf
Definition: delayline.h:69
Definition: io.h:72
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
uint32_t pframes_t
Temporal::samplecnt_t samplecnt_t
Temporal::sampleoffset_t sampleoffset_t
Temporal::samplepos_t samplepos_t