From a8bb49e5d89f2689d6aeb61381e3c4bd3560d859 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 21 Jan 2012 16:38:45 +0000 Subject: 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 --- libs/ardour/amp.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'libs/ardour/amp.cc') 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 gl(new AutomationList(Evoral::Parameter(GainAutomation))); - _gain_control = boost::shared_ptr( 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 gl (new AutomationList (p)); + _gain_control = boost::shared_ptr (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) { -- cgit v1.2.3