summaryrefslogtreecommitdiff
path: root/libs/ardour/amp.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-01-12 22:04:18 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-01-18 12:11:08 -0500
commit55094b723774086d0f54d688b1ca73a4df82b93e (patch)
tree3a6ab7c98e693906f3bbb96c2252502b7cf005ad /libs/ardour/amp.cc
parentd1033819bd09d8a46ec602a586ddba0e10f803d6 (diff)
move Amp::GainControl out into its own source module and out of Amp
Diffstat (limited to 'libs/ardour/amp.cc')
-rw-r--r--libs/ardour/amp.cc66
1 files changed, 1 insertions, 65 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc
index 1d4ffc1cd7..8dac6d73fc 100644
--- a/libs/ardour/amp.cc
+++ b/libs/ardour/amp.cc
@@ -26,6 +26,7 @@
#include "ardour/amp.h"
#include "ardour/audio_buffer.h"
#include "ardour/buffer_set.h"
+#include "ardour/gain_control.h"
#include "ardour/midi_buffer.h"
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
@@ -390,71 +391,6 @@ Amp::set_state (const XMLNode& node, int version)
return 0;
}
-Amp::GainControl::GainControl (Session& session, const Evoral::Parameter &param, boost::shared_ptr<AutomationList> al)
- : AutomationControl (session, param, ParameterDescriptor(param),
- al ? al : boost::shared_ptr<AutomationList> (new AutomationList (param)),
- param.type() == GainAutomation ? X_("gaincontrol") : X_("trimcontrol")) {
-
- alist()->reset_default (1.0);
-
- lower_db = accurate_coefficient_to_dB (_desc.lower);
- range_db = accurate_coefficient_to_dB (_desc.upper) - lower_db;
-}
-
-void
-Amp::GainControl::set_value (double val, PBD::Controllable::GroupControlDisposition /* group_override */)
-{
- if (writable()) {
- set_value_unchecked (val);
- }
-}
-
-void
-Amp::GainControl::set_value_unchecked (double val)
-{
- AutomationControl::set_value (std::max (std::min (val, (double)_desc.upper), (double)_desc.lower), Controllable::NoGroup);
- _session.set_dirty ();
-}
-
-double
-Amp::GainControl::internal_to_interface (double v) const
-{
- if (_desc.type == GainAutomation) {
- return gain_to_slider_position (v);
- } else {
- return (accurate_coefficient_to_dB (v) - lower_db) / range_db;
- }
-}
-
-double
-Amp::GainControl::interface_to_internal (double v) const
-{
- if (_desc.type == GainAutomation) {
- return slider_position_to_gain (v);
- } else {
- return dB_to_coefficient (lower_db + v * range_db);
- }
-}
-
-double
-Amp::GainControl::internal_to_user (double v) const
-{
- return accurate_coefficient_to_dB (v);
-}
-
-double
-Amp::GainControl::user_to_internal (double u) const
-{
- return dB_to_coefficient (u);
-}
-
-std::string
-Amp::GainControl::get_user_string () const
-{
- char theBuf[32]; sprintf( theBuf, _("%3.1f dB"), accurate_coefficient_to_dB (get_value()));
- return std::string(theBuf);
-}
-
/** Write gain automation for this cycle into the buffer previously passed in to
* set_gain_automation_buffer (if we are in automation playback mode and the
* transport is rolling).