Reinstate user Controllable values, as they are needed

for gain (which I forgot about).


git-svn-id: svn://localhost/ardour2/branches/3.0@11293 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2012-01-21 16:38:56 +00:00
parent a8bb49e5d8
commit 4381b590bb
9 changed files with 56 additions and 46 deletions

View File

@@ -423,23 +423,23 @@ Amp::GainControl::set_value (double val)
}
double
Amp::GainControl::get_value (void) const
{
return AutomationControl::get_value();
}
double
Amp::GainControl::user_to_ui (double v) const
Amp::GainControl::internal_to_interface (double v) const
{
return gain_to_slider_position (v);
}
double
Amp::GainControl::ui_to_user (double v) const
Amp::GainControl::interface_to_internal (double v) const
{
return slider_position_to_gain (v);
}
double
Amp::GainControl::internal_to_user (double v) const
{
return accurate_coefficient_to_dB (v);
}
void
Amp::setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framecnt_t nframes)
{

View File

@@ -82,10 +82,10 @@ public:
}
void set_value (double val);
double get_value (void) const;
double user_to_ui (double) const;
double ui_to_user (double) const;
double internal_to_interface (double) const;
double interface_to_internal (double) const;
double internal_to_user (double) const;
Amp* _amp;
};

View File

@@ -77,6 +77,18 @@ public:
void set_value (double);
double get_value () const;
virtual double internal_to_interface (double v) const {
return v;
}
virtual double interface_to_internal (double v) const {
return v;
}
virtual double internal_to_user (double v) const {
return v;
}
double lower() const { return parameter().min(); }
double upper() const { return parameter().max(); }
double normal() const { return parameter().normal(); }

View File

@@ -89,8 +89,8 @@ class PluginInsert : public Processor
double get_value (void) const;
XMLNode& get_state();
double user_to_ui (double) const;
double ui_to_user (double) const;
double internal_to_interface (double) const;
double interface_to_internal (double) const;
private:
PluginInsert* _plugin;

View File

@@ -1174,7 +1174,7 @@ PluginInsert::PluginControl::set_value (double user_val)
}
double
PluginInsert::PluginControl::user_to_ui (double val) const
PluginInsert::PluginControl::internal_to_interface (double val) const
{
if (_logarithmic) {
if (val > 0) {
@@ -1188,7 +1188,7 @@ PluginInsert::PluginControl::user_to_ui (double val) const
}
double
PluginInsert::PluginControl::ui_to_user (double val) const
PluginInsert::PluginControl::interface_to_internal (double val) const
{
if (_logarithmic) {
val = exp (val);

View File

@@ -43,27 +43,27 @@ class Controllable : public PBD::StatefulDestructible {
Controllable (const std::string& name, Flag f = Flag (0));
virtual ~Controllable() { Destroyed (this); }
/* We express Controllable values in one of two ways:
* 1. `UI' --- as used in some cases for the internal representation
* of the UI. This may be the same as `user', or may be something
* like the natural log of frequency in order that sliders operate
* in a logarithmic fashion.
* 2. `user' --- as passed to a plugin, and presented to the user.
/* We express Controllable values in one of three ways:
* 1. `user' --- as presented to the user (e.g. dB, Hz, etc.)
* 2. `interface' --- as used in some cases for the UI representation
* (in order to make controls behave logarithmically).
* 3. `internal' --- as passed to a processor, track, plugin, or whatever.
*
* Note that in some cases user and processor may be the same
* (and interface different) e.g. frequency, which is presented
* to the user and passed to the processor in linear terms, but
* which needs log scaling in the interface.
*
* In other cases, user and interface may be the same (and processor different)
* e.g. gain, which is presented to the user in log terms (dB)
* but passed to the processor as a linear quantity.
*/
/** Set `user' value */
/** Set `internal' value */
virtual void set_value (double) = 0;
/** @return `user' value */
/** @return `internal' value */
virtual double get_value (void) const = 0;
virtual double user_to_ui (double v) const {
return v;
}
virtual double ui_to_user (double v) const {
return v;
}
PBD::Signal0<void> LearningFinished;
static PBD::Signal3<void,PBD::Controllable*,int,int> CreateBinding;
static PBD::Signal1<void,PBD::Controllable*> DeleteBinding;