diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-03-03 22:47:25 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-05-31 15:30:39 -0400 |
commit | 562ec7df8fa25b78fc69880178c234cd5ee9d238 (patch) | |
tree | 8a7cc237ce735480aad2d9ecc1b843728dd87cc3 /libs/ardour/ardour/gain_control.h | |
parent | c572d4ed9e9a031dca59227fd0563803b87c2953 (diff) |
probably get the design of VCAs basically correct: use a per-master ratio model
See comments in the code for a bit more detail
Diffstat (limited to 'libs/ardour/ardour/gain_control.h')
-rw-r--r-- | libs/ardour/ardour/gain_control.h | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/libs/ardour/ardour/gain_control.h b/libs/ardour/ardour/gain_control.h index 7a4524c34c..15be6d684f 100644 --- a/libs/ardour/ardour/gain_control.h +++ b/libs/ardour/ardour/gain_control.h @@ -41,6 +41,7 @@ class LIBARDOUR_API GainControl : public AutomationControl { GainControl (Session& session, const Evoral::Parameter ¶m, boost::shared_ptr<AutomationList> al = boost::shared_ptr<AutomationList>()); + double get_value () const; void set_value (double val, PBD::Controllable::GroupControlDisposition group_override); void set_value_unchecked (double); @@ -67,18 +68,45 @@ class LIBARDOUR_API GainControl : public AutomationControl { XMLNode& get_state(); private: - void _set_value (double val, PBD::Controllable::GroupControlDisposition group_override); - - mutable Glib::Threads::Mutex master_lock; - - typedef std::set<boost::shared_ptr<GainControl> > Masters; + class MasterRecord { + public: + MasterRecord (boost::shared_ptr<GainControl> gc, uint32_t n, double r) + : _master (gc) + , _number (n) + , _ratio (r) + {} + + boost::shared_ptr<GainControl> master() const { return _master; } + double ratio () const { return _ratio; } + uint32_t number() const { return _number; } + + bool operator== (MasterRecord const& other) const { + return _number == other._number; + } + + bool operator< (MasterRecord const& other) const { + return _number < other._number; + } + + void reset_ratio (double r) { _ratio = r; } + + private: + const boost::shared_ptr<GainControl> _master; + const uint32_t _number; + double _ratio; + }; + + mutable Glib::Threads::RWLock master_lock; + typedef std::set<MasterRecord> Masters; Masters _masters; PBD::ScopedConnectionList masters_connections; - std::set<uint32_t> _masters_numbers; std::string _masters_state_string (); gain_t get_master_gain_locked () const; void master_going_away (boost::weak_ptr<VCA>); + void recompute_masters_ratios (double val); + + void _set_value (double val, PBD::Controllable::GroupControlDisposition group_override); }; } /* namespace */ |