summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-01-21 16:38:45 +0000
committerCarl Hetherington <carl@carlh.net>2012-01-21 16:38:45 +0000
commita8bb49e5d89f2689d6aeb61381e3c4bd3560d859 (patch)
tree92ee741951ce07175db1be21c412269e7fdde042 /libs
parent0c30881ad4025564d4438ff96c5b322cdfbe7757 (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')
-rw-r--r--libs/ardour/amp.cc21
-rw-r--r--libs/ardour/ardour/amp.h3
-rw-r--r--libs/ardour/ardour/automation_control.h11
-rw-r--r--libs/ardour/send.cc2
4 files changed, 23 insertions, 14 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)
{
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<Pannable> p, boost::shared_ptr<MuteMas
_amp.reset (new Amp (_session));
_meter.reset (new PeakMeter (_session));
+
+ add_control (_amp->gain_control ());
}
Send::~Send ()