diff options
author | Carl Hetherington <carl@carlh.net> | 2012-01-21 16:38:45 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-01-21 16:38:45 +0000 |
commit | a8bb49e5d89f2689d6aeb61381e3c4bd3560d859 (patch) | |
tree | 92ee741951ce07175db1be21c412269e7fdde042 /libs/ardour/amp.cc | |
parent | 0c30881ad4025564d4438ff96c5b322cdfbe7757 (diff) |
Add a send amp's gain control as a send controllable.
Tweak AutomationControl now that PBD::Controllable has
a default implementation of user_to_ui and ui_to_user.
Add correct implementations of these methods to
Amp::GainControl. Hence allow SendProcessorEntry to
use the generic mini-fader-adding code from
ProcessorEntry.
git-svn-id: svn://localhost/ardour2/branches/3.0@11292 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/amp.cc')
-rw-r--r-- | libs/ardour/amp.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index bbbaa9b331..01a31329cf 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -42,8 +42,11 @@ Amp::Amp (Session& s) , _apply_gain_automation(false) , _current_gain(1.0) { - boost::shared_ptr<AutomationList> gl(new AutomationList(Evoral::Parameter(GainAutomation))); - _gain_control = boost::shared_ptr<GainControl>( new GainControl(X_("gaincontrol"), s, this, Evoral::Parameter(GainAutomation), gl )); + Evoral::Parameter p (GainAutomation); + /* gain range of -inf to +6dB, default 0dB */ + p.set_range (0, 1.99526231f, 1, false); + boost::shared_ptr<AutomationList> gl (new AutomationList (p)); + _gain_control = boost::shared_ptr<GainControl> (new GainControl (X_("gaincontrol"), s, this, p, gl)); add_control(_gain_control); } @@ -371,8 +374,6 @@ Amp::set_gain (gain_t val, void *src) val = 1.99526231f; } - //cerr << "set desired gain to " << val << " when curgain = " << _gain_control->get_value () << endl; - if (src != _gain_control.get()) { _gain_control->set_value (val); // bit twisty, this will come back and call us again @@ -427,6 +428,18 @@ Amp::GainControl::get_value (void) const return AutomationControl::get_value(); } +double +Amp::GainControl::user_to_ui (double v) const +{ + return gain_to_slider_position (v); +} + +double +Amp::GainControl::ui_to_user (double v) const +{ + return slider_position_to_gain (v); +} + void Amp::setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framecnt_t nframes) { |