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 +++++++++++++++++---- libs/ardour/ardour/amp.h | 3 +++ libs/ardour/ardour/automation_control.h | 11 +---------- libs/ardour/send.cc | 2 ++ 4 files changed, 23 insertions(+), 14 deletions(-) (limited to 'libs') 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) { diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 35f084d04c..b811cca173 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -84,6 +84,9 @@ public: void set_value (double val); double get_value (void) const; + double user_to_ui (double) const; + double ui_to_user (double) const; + Amp* _amp; }; diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index e9801111d1..7e375de3ed 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -79,19 +79,10 @@ public: double lower() const { return parameter().min(); } double upper() const { return parameter().max(); } + double normal() const { return parameter().normal(); } const ARDOUR::Session& session() const { return _session; } - /** Convert user values to UI values. See pbd/controllable.h */ - virtual double user_to_ui (double val) const { - return val; - } - - /** Convert UI values to user values. See pbd/controllable.h */ - virtual double ui_to_user (double val) const { - return val; - } - protected: ARDOUR::Session& _session; diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index bacb381fe5..332f53556c 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -81,6 +81,8 @@ Send::Send (Session& s, boost::shared_ptr p, boost::shared_ptrgain_control ()); } Send::~Send () -- cgit v1.2.3