diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-17 21:47:20 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-17 21:47:20 +0000 |
commit | 01e006e46e6d4dd0ab25e08bd44d13dd1e195886 (patch) | |
tree | 3ed1b959caa20fd0e117de2fcfa557738ae5aa86 /libs/ardour | |
parent | cb8bc87a542e35794a12e76a23594e63b3bad521 (diff) |
some changes to try to make the monitor section gain controls work as intended, and along the way start to rationalize MotionFeedback/VolumeController classes
git-svn-id: svn://localhost/ardour2/branches/3.0@9746 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/dB.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/monitor_processor.h | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/proxy_controllable.h | 8 | ||||
-rw-r--r-- | libs/ardour/monitor_processor.cc | 17 |
4 files changed, 20 insertions, 12 deletions
diff --git a/libs/ardour/ardour/dB.h b/libs/ardour/ardour/dB.h index 209ab11edc..e5865aabd8 100644 --- a/libs/ardour/ardour/dB.h +++ b/libs/ardour/ardour/dB.h @@ -34,4 +34,6 @@ static inline float accurate_coefficient_to_dB (float coeff) { return 20.0f * log10 (coeff); } +static const double zero_db_as_fraction = 0.781787; + #endif /* __ardour_dB_h__ */ diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h index 023dacb619..5b724b5e8d 100644 --- a/libs/ardour/ardour/monitor_processor.h +++ b/libs/ardour/ardour/monitor_processor.h @@ -20,6 +20,7 @@ #ifndef __ardour_monitor_processor_h__ #define __ardour_monitor_processor_h__ +#include <algorithm> #include <iostream> #include <vector> @@ -52,7 +53,7 @@ public: void set_value (double v) { T newval = (T) v; if (newval != _value) { - _value = newval; + _value = std::max (_lower, std::min (_upper, newval)); Changed(); /* EMIT SIGNAL */ } } @@ -68,7 +69,7 @@ public: MPControl& operator=(const T& v) { if (v != _value) { - _value = v; + _value = std::max (_lower, std::min (_upper, v)); Changed (); /* EMIT SIGNAL */ } return *this; diff --git a/libs/ardour/ardour/proxy_controllable.h b/libs/ardour/ardour/proxy_controllable.h index cbbdcbd6ca..169f60f9f5 100644 --- a/libs/ardour/ardour/proxy_controllable.h +++ b/libs/ardour/ardour/proxy_controllable.h @@ -33,18 +33,18 @@ namespace ARDOUR { class ProxyControllable : public PBD::Controllable { public: ProxyControllable (const std::string& name, PBD::Controllable::Flag flags, - boost::function1<void,double> setter, + boost::function1<bool,double> setter, boost::function0<double> getter) : PBD::Controllable (name, flags) , _setter (setter) , _getter (getter) {} - void set_value (double v) { _setter (v); } - double get_value () const { return _getter (); } + void set_value (double v) { if (_setter (v)) { Changed(); /* EMIT SIGNAL */ } } + double get_value () const { return _getter (); } private: - boost::function1<void,double> _setter; + boost::function1<bool,double> _setter; boost::function0<double> _getter; }; diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc index 57d4a57c74..1125dedc64 100644 --- a/libs/ardour/monitor_processor.cc +++ b/libs/ardour/monitor_processor.cc @@ -34,11 +34,11 @@ MonitorProcessor::MonitorProcessor (Session& s) , _dim_all_ptr (new MPControl<bool> (false, _("monitor dim"), Controllable::Toggle)) , _cut_all_ptr (new MPControl<bool> (false, _("monitor cut"), Controllable::Toggle)) , _mono_ptr (new MPControl<bool> (false, _("monitor mono"), Controllable::Toggle)) - , _dim_level_ptr (new MPControl<volatile gain_t> - (0.2, _("monitor mono"), Controllable::Flag (0), 0.0f, 1.0f)) - , _solo_boost_level_ptr (new MPControl<volatile gain_t> - (1.0, _("monitor mono"), Controllable::Flag (0), 1.0f, 3.0f)) - + , _dim_level_ptr (new MPControl<volatile gain_t> /* units in dB */ + (-12.0, _("monitor dim level"), Controllable::Flag (0), -20.0f, 0.0f)) + , _solo_boost_level_ptr (new MPControl<volatile gain_t> /* units in dB */ + (0.0, _("monitor solo boost level"), Controllable::Flag (0), 0.0, 20.0)) + , _dim_all_control (_dim_all_ptr) , _cut_all_control (_cut_all_ptr) , _mono_control (_mono_ptr) @@ -255,7 +255,8 @@ MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t / gain_t solo_boost; if (_session.listening() || _session.soloing()) { - solo_boost = _solo_boost_level; + /* solo boost controller is in dB */ + solo_boost = dB_to_coefficient (_solo_boost_level); } else { solo_boost = 1.0; } @@ -266,6 +267,10 @@ MonitorProcessor::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t / gain_t dim_level = (global_dim == 1.0 ? (_channels[chn]->dim ? dim_level_this_time : 1.0) : 1.0); + /* dim level is in dB */ + + dim_level = dB_to_coefficient (dim_level); + if (_channels[chn]->soloed) { target_gain = _channels[chn]->polarity * _channels[chn]->cut * dim_level * global_cut * global_dim * solo_boost; } else { |