diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audioengine.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/control_protocol.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/control_protocol_manager.h | 18 | ||||
-rw-r--r-- | libs/ardour/ardour/io.h | 15 |
4 files changed, 29 insertions, 20 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 9fe3ce5424..36dbbd1dbe 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -202,6 +202,8 @@ class AudioEngine : public sigc::trackable sigc::slot<int,jack_nframes_t> freewheel_action; bool reconnect_on_halt; int _usecs_per_cycle; + jack_nframes_t last_meter_point; + jack_nframes_t meter_interval; typedef std::set<Port*> Ports; Ports ports; @@ -232,9 +234,13 @@ class AudioEngine : public sigc::trackable int jack_sample_rate_callback (jack_nframes_t); static void halted (void *); - static void meter (Port *port, jack_nframes_t nframes); int connect_to_jack (std::string client_name); + + static void* _meter_thread (void* arg); + void* meter_thread (); + pthread_t meter_thread_id; + void maybe_start_metering_thread (); }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/control_protocol.h b/libs/ardour/ardour/control_protocol.h index c2ab8736b7..64658fc199 100644 --- a/libs/ardour/ardour/control_protocol.h +++ b/libs/ardour/ardour/control_protocol.h @@ -30,7 +30,6 @@ class ControlProtocol : public sigc::trackable { void set_active (bool yn); bool get_active() const { return active_thread > 0; } - bool send() const { return _send != 0; } bool send_route_feedback () const { return _send & SendRoute; } bool send_global_feedback () const { return _send & SendGlobal; } @@ -77,9 +76,10 @@ class ControlProtocol : public sigc::trackable { extern "C" { struct ControlProtocolDescriptor { - const char* name; - void* ptr; - void* module; + const char* name; /* descriptive */ + const char* id; /* unique and version-specific */ + void* ptr; /* protocol can store a value here */ + void* module; /* not for public access */ ControlProtocol* (*initialize)(ControlProtocolDescriptor*,Session*); void (*destroy)(ControlProtocolDescriptor*,ControlProtocol*); diff --git a/libs/ardour/ardour/control_protocol_manager.h b/libs/ardour/ardour/control_protocol_manager.h index f0b7846978..b06c3024b6 100644 --- a/libs/ardour/ardour/control_protocol_manager.h +++ b/libs/ardour/ardour/control_protocol_manager.h @@ -4,12 +4,15 @@ #include <string> #include <list> +#include <sigc++/sigc++.h> + #include <pbd/lockmonitor.h> namespace ARDOUR { class ControlProtocol; class ControlProtocolDescriptor; +class Session; struct ControlProtocolInfo { ControlProtocolDescriptor* descriptor; @@ -18,7 +21,7 @@ struct ControlProtocolInfo { std::string path; }; -class ControlProtocolManager + class ControlProtocolManager : public sigc::trackable { public: ControlProtocolManager (); @@ -26,19 +29,24 @@ class ControlProtocolManager static ControlProtocolManager& instance() { return *_instance; } + void set_session (Session&); void discover_control_protocols (std::string search_path); - void startup (Session&); + void foreach_known_protocol (sigc::slot<void,const ControlProtocolInfo*>); + + ControlProtocol* instantiate (ControlProtocolInfo&); + int teardown (ControlProtocolInfo&); - ControlProtocol* instantiate (Session&, std::string protocol_name); - int teardown (std::string protocol_name); + std::list<ControlProtocolInfo*> control_protocol_info; private: static ControlProtocolManager* _instance; + Session* _session; PBD::Lock protocols_lock; - std::list<ControlProtocolInfo*> control_protocol_info; std::list<ControlProtocol*> control_protocols; + void drop_session (); + int control_protocol_discover (std::string path); ControlProtocolDescriptor* get_descriptor (std::string path); }; diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index c67473dcc0..8321e9afda 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -198,19 +198,14 @@ class IO : public Stateful, public ARDOUR::StateManager /* Peak metering */ float peak_input_power (uint32_t n) { - if (n < std::max(_ninputs, _noutputs)) { - float x = _stored_peak_power[n]; - if(x > 0.0) { - return 20 * fast_log10(x); - } else { - return minus_infinity(); - } + if (n < std::max (_ninputs, _noutputs)) { + return _visible_peak_power[n]; } else { return minus_infinity(); } } - static sigc::signal<void> GrabPeakPower; + static sigc::signal<void> Meter; /* automation */ @@ -278,7 +273,7 @@ class IO : public Stateful, public ARDOUR::StateManager vector<Port*> _outputs; vector<Port*> _inputs; vector<float> _peak_power; - vector<float> _stored_peak_power; + vector<float> _visible_peak_power; string _name; Connection* _input_connection; Connection* _output_connection; @@ -394,7 +389,7 @@ class IO : public Stateful, public ARDOUR::StateManager int make_connections (const XMLNode&); void setup_peak_meters (); - void grab_peak_power (); + void meter (); bool ensure_inputs_locked (uint32_t, bool clear, void *src); bool ensure_outputs_locked (uint32_t, bool clear, void *src); |