Ardour  9.0-pre0-582-g084a23a80d
monitor_port.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 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 #ifndef _ardour_monitor_port_h_
20 #define _ardour_monitor_port_h_
21 
22 #include <memory>
23 #include <set>
24 
26 
27 #include "pbd/rcu.h"
28 #include <pbd/signals.h>
29 
30 #include "ardour/audio_buffer.h"
31 #include "ardour/port_engine.h"
32 
33 namespace ARDOUR {
34 
36 {
37 public:
38  MonitorPort (const MonitorPort&) = delete;
39  MonitorPort& operator= (const MonitorPort&) = delete;
41 
43  bool silent () const;
45 
46  void add_port (std::string const&);
47  void remove_port (std::string const&, bool instantly = false);
48  bool monitoring (std::string const& = "") const;
49  void active_monitors (std::list <std::string>&) const;
50  void set_active_monitors (std::list <std::string> const&);
51  void clear_ports (bool instantly);
52 
53  PBD::Signal<void(std::string, bool)> MonitorInputChanged;
54 
55 protected:
56  friend class PortManager;
59 
60 private:
61  struct MonitorInfo {
63  {
64  gain = 0;
65  remove = false;
66  }
67 
68  float gain;
69  bool remove;
70  };
71 
72  void collect (std::shared_ptr<MonitorInfo>, Sample*, pframes_t, std::string const&);
74 
75  typedef std::map<std::string, std::shared_ptr<MonitorInfo> > MonitorPorts;
77 
83  bool _silent;
84 };
85 
86 }
87 
88 #endif
AudioBuffer & get_audio_buffer(pframes_t)
bool silent() const
PBD::Signal< void(std::string, bool)> MonitorInputChanged
Definition: monitor_port.h:53
bool monitoring(std::string const &="") const
void collect(std::shared_ptr< MonitorInfo >, Sample *, pframes_t, std::string const &)
void clear_ports(bool instantly)
void add_port(std::string const &)
void active_monitors(std::list< std::string > &) const
void finalize(pframes_t)
void set_buffer_size(pframes_t)
MonitorPort(const MonitorPort &)=delete
void set_active_monitors(std::list< std::string > const &)
SerializedRCUManager< MonitorPorts > _monitor_ports
Definition: monitor_port.h:76
ArdourZita::VMResampler _src
Definition: monitor_port.h:79
std::map< std::string, std::shared_ptr< MonitorInfo > > MonitorPorts
Definition: monitor_port.h:75
void remove_port(std::string const &, bool instantly=false)
void monitor(PortEngine &, pframes_t)
AudioBuffer * _buffer
Definition: monitor_port.h:78
#define LIBARDOUR_API
PBD::PropertyDescriptor< gain_t > gain
uint32_t pframes_t