X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fmonitor_processor.h;h=023dacb619a57d373c4eba6c60b6eb2877d84102;hb=a473d630eb165272992e90f8d854b1d66ec0be63;hp=e453551b0be5bd7d4eaca23229553d9a5ecbae26;hpb=ece5093234e4c185cf536d2b4e5edfeb90622409;p=ardour.git diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h index e453551b0b..023dacb619 100644 --- a/libs/ardour/ardour/monitor_processor.h +++ b/libs/ardour/ardour/monitor_processor.h @@ -36,180 +36,178 @@ namespace ARDOUR { class Session; -template class MPControl : public PBD::Controllable { - public: - MPControl (T initial, const std::string& name, PBD::Controllable::Flag flag, - float lower = 0.0f, float upper = 1.0f) - : PBD::Controllable (name, flag) - , _value (initial) - , _lower (lower) - , _upper (upper) - {} - - /* Controllable API */ - - void set_value (double v) { - T newval = (T) v; - if (newval != _value) { - _value = newval; - Changed(); /* EMIT SIGNAL */ - } - } - - double get_value () const { - return (float) _value; - } - - double lower () const { return _lower; } - double upper () const { return _upper; } - - /* "access as T" API */ - - MPControl& operator=(const T& v) { - if (v != _value) { - _value = v; - Changed (); /* EMIT SIGNAL */ - } - return *this; - } - - bool operator==(const T& v) const { - return _value == v; - } - - bool operator<(const T& v) const { - return _value < v; - } - - bool operator<=(const T& v) const { - return _value <= v; - } - - bool operator>(const T& v) const { - return _value > v; - } - - bool operator>=(const T& v) const { - return _value >= v; - } - - operator T() const { return _value; } - T val() const { return _value; } - - protected: - T _value; - T _lower; - T _upper; +template +class MPControl : public PBD::Controllable { +public: + MPControl (T initial, const std::string& name, PBD::Controllable::Flag flag, + float lower = 0.0f, float upper = 1.0f) + : PBD::Controllable (name, flag) + , _value (initial) + , _lower (lower) + , _upper (upper) + {} + + /* Controllable API */ + + void set_value (double v) { + T newval = (T) v; + if (newval != _value) { + _value = newval; + Changed(); /* EMIT SIGNAL */ + } + } + + double get_value () const { + return (float) _value; + } + + double lower () const { return _lower; } + double upper () const { return _upper; } + + /* "access as T" API */ + + MPControl& operator=(const T& v) { + if (v != _value) { + _value = v; + Changed (); /* EMIT SIGNAL */ + } + return *this; + } + + bool operator==(const T& v) const { + return _value == v; + } + + bool operator<(const T& v) const { + return _value < v; + } + + bool operator<=(const T& v) const { + return _value <= v; + } + + bool operator>(const T& v) const { + return _value > v; + } + + bool operator>=(const T& v) const { + return _value >= v; + } + + operator T() const { return _value; } + T val() const { return _value; } + +protected: + T _value; + T _lower; + T _upper; }; class MonitorProcessor : public Processor { - public: - MonitorProcessor (Session&); - ~MonitorProcessor (); +public: + MonitorProcessor (Session&); + ~MonitorProcessor (); - bool display_to_user() const; + bool display_to_user() const; - void run (BufferSet& /*bufs*/, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t /*nframes*/, bool /*result_required*/); + void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t /*nframes*/, bool /*result_required*/); - XMLNode& state (bool full); - int set_state (const XMLNode&, int /* version */); + XMLNode& state (bool full); + int set_state (const XMLNode&, int /* version */); - bool configure_io (ChanCount in, ChanCount out); + bool configure_io (ChanCount in, ChanCount out); bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; - void set_cut_all (bool); - void set_dim_all (bool); - void set_polarity (uint32_t, bool invert); - void set_cut (uint32_t, bool cut); - void set_dim (uint32_t, bool dim); - void set_solo (uint32_t, bool); - void set_mono (bool); - - void set_dim_level (gain_t); - void set_solo_boost_level (gain_t); - - gain_t dim_level() const { return _dim_level; } - gain_t solo_boost_level() const { return _solo_boost_level; } - - bool dimmed (uint32_t chn) const; - bool soloed (uint32_t chn) const; - bool inverted (uint32_t chn) const; - bool cut (uint32_t chn) const; - bool cut_all () const; - bool dim_all () const; - bool mono () const; - - PBD::Signal0 Changed; - - boost::shared_ptr channel_cut_control (uint32_t) const; - boost::shared_ptr channel_dim_control (uint32_t) const; - boost::shared_ptr channel_polarity_control (uint32_t) const; - boost::shared_ptr channel_solo_control (uint32_t) const; - - boost::shared_ptr dim_control () const { return _dim_all_control; } - boost::shared_ptr cut_control () const { return _cut_all_control; } - boost::shared_ptr mono_control () const { return _mono_control; } - boost::shared_ptr dim_level_control () const { return _dim_level_control; } - boost::shared_ptr solo_boost_control () const { return _solo_boost_level_control; } - - private: - struct ChannelRecord { - gain_t current_gain; - - /* pointers - created first, but managed by boost::shared_ptr<> */ - - MPControl* cut_ptr; - MPControl* dim_ptr; - MPControl* polarity_ptr; - MPControl* soloed_ptr; - - /* shared ptr access and lifetime management, for external users */ - - boost::shared_ptr cut_control; - boost::shared_ptr dim_control; - boost::shared_ptr polarity_control; - boost::shared_ptr soloed_control; - - /* typed controllables for internal use */ - - MPControl& cut; - MPControl& dim; - MPControl& polarity; - MPControl& soloed; - - ChannelRecord (uint32_t); - }; - - std::vector _channels; - - uint32_t solo_cnt; - - /* pointers - created first, but managed by boost::shared_ptr<> */ - - MPControl* _dim_all_ptr; - MPControl* _cut_all_ptr; - MPControl* _mono_ptr; - MPControl* _dim_level_ptr; - MPControl* _solo_boost_level_ptr; - - /* shared ptr access and lifetime management, for external users */ - - boost::shared_ptr _dim_all_control; - boost::shared_ptr _cut_all_control; - boost::shared_ptr _mono_control; - boost::shared_ptr _dim_level_control; - boost::shared_ptr _solo_boost_level_control; - - /* typed controllables for internal use */ - - MPControl& _dim_all; - MPControl& _cut_all; - MPControl& _mono; - MPControl& _dim_level; - MPControl& _solo_boost_level; - - void allocate_channels (uint32_t); + void set_cut_all (bool); + void set_dim_all (bool); + void set_polarity (uint32_t, bool invert); + void set_cut (uint32_t, bool cut); + void set_dim (uint32_t, bool dim); + void set_solo (uint32_t, bool); + void set_mono (bool); + + gain_t dim_level() const { return _dim_level; } + gain_t solo_boost_level() const { return _solo_boost_level; } + + bool dimmed (uint32_t chn) const; + bool soloed (uint32_t chn) const; + bool inverted (uint32_t chn) const; + bool cut (uint32_t chn) const; + bool cut_all () const; + bool dim_all () const; + bool mono () const; + + PBD::Signal0 Changed; + + boost::shared_ptr channel_cut_control (uint32_t) const; + boost::shared_ptr channel_dim_control (uint32_t) const; + boost::shared_ptr channel_polarity_control (uint32_t) const; + boost::shared_ptr channel_solo_control (uint32_t) const; + + boost::shared_ptr dim_control () const { return _dim_all_control; } + boost::shared_ptr cut_control () const { return _cut_all_control; } + boost::shared_ptr mono_control () const { return _mono_control; } + boost::shared_ptr dim_level_control () const { return _dim_level_control; } + boost::shared_ptr solo_boost_control () const { return _solo_boost_level_control; } + +private: + struct ChannelRecord { + gain_t current_gain; + + /* pointers - created first, but managed by boost::shared_ptr<> */ + + MPControl* cut_ptr; + MPControl* dim_ptr; + MPControl* polarity_ptr; + MPControl* soloed_ptr; + + /* shared ptr access and lifetime management, for external users */ + + boost::shared_ptr cut_control; + boost::shared_ptr dim_control; + boost::shared_ptr polarity_control; + boost::shared_ptr soloed_control; + + /* typed controllables for internal use */ + + MPControl& cut; + MPControl& dim; + MPControl& polarity; + MPControl& soloed; + + ChannelRecord (uint32_t); + }; + + std::vector _channels; + + uint32_t solo_cnt; + + /* pointers - created first, but managed by boost::shared_ptr<> */ + + MPControl* _dim_all_ptr; + MPControl* _cut_all_ptr; + MPControl* _mono_ptr; + MPControl* _dim_level_ptr; + MPControl* _solo_boost_level_ptr; + + /* shared ptr access and lifetime management, for external users */ + + boost::shared_ptr _dim_all_control; + boost::shared_ptr _cut_all_control; + boost::shared_ptr _mono_control; + boost::shared_ptr _dim_level_control; + boost::shared_ptr _solo_boost_level_control; + + /* typed controllables for internal use */ + + MPControl& _dim_all; + MPControl& _cut_all; + MPControl& _mono; + MPControl& _dim_level; + MPControl& _solo_boost_level; + + void allocate_channels (uint32_t); }; } /* namespace */