Remove unused concept of user' values. Make user_to_ui

and ui_to_user virtual members of PBD::Controllable.


git-svn-id: svn://localhost/ardour2/branches/3.0@11286 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington
2012-01-20 18:02:36 +00:00
parent 24978033ef
commit d03d0363a4
4 changed files with 15 additions and 36 deletions

View File

@@ -594,7 +594,7 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat
}
adj->set_value (pc->plugin_to_ui (plugin->get_parameter (port_index)));
adj->set_value (pc->user_to_ui (plugin->get_parameter (port_index)));
/* XXX memory leak: SliderController not destroyed by ControlUI
destructor, and manage() reports object hierarchy

View File

@@ -91,12 +91,8 @@ class PluginInsert : public Processor
double user_to_ui (double) const;
double ui_to_user (double) const;
double plugin_to_ui (double) const;
double plugin_to_user (double) const;
private:
double user_to_plugin (double) const;
PluginInsert* _plugin;
bool _logarithmic;
bool _sr_dependent;

View File

@@ -1161,27 +1161,18 @@ PluginInsert::PluginControl::set_value (double user_val)
{
/* FIXME: probably should be taking out some lock here.. */
double const plugin_val = user_to_plugin (user_val);
for (Plugins::iterator i = _plugin->_plugins.begin(); i != _plugin->_plugins.end(); ++i) {
(*i)->set_parameter (_list->parameter().id(), plugin_val);
(*i)->set_parameter (_list->parameter().id(), user_val);
}
boost::shared_ptr<Plugin> iasp = _plugin->_impulseAnalysisPlugin.lock();
if (iasp) {
iasp->set_parameter (_list->parameter().id(), plugin_val);
iasp->set_parameter (_list->parameter().id(), user_val);
}
AutomationControl::set_value (user_val);
}
double
PluginInsert::PluginControl::user_to_plugin (double val) const
{
/* no known transformations at this time */
return val;
}
double
PluginInsert::PluginControl::user_to_ui (double val) const
{
@@ -1206,20 +1197,6 @@ PluginInsert::PluginControl::ui_to_user (double val) const
return val;
}
/** Convert plugin values to UI values. See pbd/controllable.h */
double
PluginInsert::PluginControl::plugin_to_ui (double val) const
{
return user_to_ui (plugin_to_user (val));
}
double
PluginInsert::PluginControl::plugin_to_user (double val) const
{
/* no known transformations at this time */
return val;
}
XMLNode&
PluginInsert::PluginControl::get_state ()
{
@@ -1237,8 +1214,7 @@ double
PluginInsert::PluginControl::get_value () const
{
/* FIXME: probably should be taking out some lock here.. */
return plugin_to_user (_plugin->get_parameter (_list->parameter()));
return _plugin->get_parameter (_list->parameter());
}
boost::shared_ptr<Plugin>

View File

@@ -43,13 +43,12 @@ 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 three ways:
* 1. `user' --- as presented to the user (e.g. dB, Hz etc.)
* 2. `UI' --- as used in some cases for the internal representation
/* 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.
* 3. `plugin' --- as passed to a plugin.
* 2. `user' --- as passed to a plugin, and presented to the user.
*/
/** Set `user' value */
@@ -57,6 +56,14 @@ class Controllable : public PBD::StatefulDestructible {
/** @return `user' 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;