Fix shadowing problem with *Control::set_value.
Fix nasty situation when setting value on a plugin automation control that's playing back. git-svn-id: svn://localhost/ardour2/branches/3.0@3823 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
edbe4a3307
commit
598c3cc958
@ -68,7 +68,13 @@ public:
|
||||
return ((ARDOUR::AutomationList*)_list.get())->stop_touch();
|
||||
}
|
||||
|
||||
/** Set the value and do the right thing based on automation state
|
||||
* (e.g. record if necessary, etc.)
|
||||
*/
|
||||
void set_value(float val);
|
||||
|
||||
/** Get the current effective value based on automation state.
|
||||
*/
|
||||
float get_value() const;
|
||||
|
||||
protected:
|
||||
|
@ -45,7 +45,7 @@ class Parameter : public Evoral::Parameter
|
||||
{
|
||||
public:
|
||||
Parameter(AutomationType type = NullAutomation, uint32_t id=0, uint8_t channel=0)
|
||||
: Evoral::Parameter((uint32_t)type, id, channel)
|
||||
: Evoral::Parameter((uint32_t)type, channel, id)
|
||||
{
|
||||
init_metadata(type);
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ Automatable::automation_snapshot (nframes_t now, bool force)
|
||||
boost::shared_ptr<AutomationControl> c
|
||||
= boost::dynamic_pointer_cast<AutomationControl>(i->second);
|
||||
if (c->automation_write()) {
|
||||
c->list()->rt_add (now, i->second->user_value());
|
||||
c->list()->rt_add (now, i->second->user_float());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,13 +41,11 @@ AutomationControl::AutomationControl(
|
||||
}
|
||||
|
||||
|
||||
/** Get the currently effective value (ie the one that corresponds to current output)
|
||||
*/
|
||||
float
|
||||
AutomationControl::get_value() const
|
||||
{
|
||||
bool from_list = _list && ((AutomationList*)_list.get())->automation_playback();
|
||||
return Control::get_value(from_list, _session.transport_frame());
|
||||
return Control::get_float(from_list, _session.transport_frame());
|
||||
}
|
||||
|
||||
|
||||
@ -57,7 +55,7 @@ AutomationControl::set_value(float value)
|
||||
bool to_list = _list && _session.transport_stopped()
|
||||
&& ((AutomationList*)_list.get())->automation_playback();
|
||||
|
||||
Control::set_value(value, to_list, _session.transport_frame());
|
||||
Control::set_float(value, to_list, _session.transport_frame());
|
||||
|
||||
Changed(); /* EMIT SIGNAL */
|
||||
}
|
||||
|
@ -368,9 +368,15 @@ PluginInsert::set_parameter (Parameter param, float val)
|
||||
|
||||
_plugins[0]->set_parameter (param.id(), val);
|
||||
|
||||
boost::shared_ptr<Evoral::Control> c = data().control (param);
|
||||
if (c)
|
||||
c->set_value(val);
|
||||
boost::shared_ptr<AutomationControl> ac
|
||||
= boost::dynamic_pointer_cast<AutomationControl>(data().control(param));
|
||||
|
||||
if (ac) {
|
||||
ac->set_value(val);
|
||||
} else {
|
||||
warning << "set_parameter called for nonexistant parameter "
|
||||
<< param.symbol() << endmsg;
|
||||
}
|
||||
|
||||
_session.set_dirty();
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ public:
|
||||
Control(const Parameter& parameter, boost::shared_ptr<ControlList>);
|
||||
virtual ~Control() {}
|
||||
|
||||
void set_value(float val, bool to_list=false, nframes_t frame=0);
|
||||
float get_value(bool from_list=false, nframes_t frame=0) const;
|
||||
float user_value() const;
|
||||
virtual void set_float(float val, bool to_list=false, nframes_t frame=0);
|
||||
virtual float get_float(bool from_list=false, nframes_t frame=0) const;
|
||||
virtual float user_float() const;
|
||||
|
||||
void set_list(boost::shared_ptr<ControlList>);
|
||||
|
||||
|
@ -35,7 +35,7 @@ Control::Control(const Parameter& parameter, boost::shared_ptr<ControlList> list
|
||||
/** Get the currently effective value (ie the one that corresponds to current output)
|
||||
*/
|
||||
float
|
||||
Control::get_value(bool from_list, nframes_t frame) const
|
||||
Control::get_float(bool from_list, nframes_t frame) const
|
||||
{
|
||||
if (from_list)
|
||||
return _list->eval(frame);
|
||||
@ -45,7 +45,7 @@ Control::get_value(bool from_list, nframes_t frame) const
|
||||
|
||||
|
||||
void
|
||||
Control::set_value(float value, bool to_list, nframes_t frame)
|
||||
Control::set_float(float value, bool to_list, nframes_t frame)
|
||||
{
|
||||
_user_value = value;
|
||||
|
||||
@ -61,7 +61,7 @@ Control::set_value(float value, bool to_list, nframes_t frame)
|
||||
* to the AutomationList.
|
||||
*/
|
||||
float
|
||||
Control::user_value() const
|
||||
Control::user_float() const
|
||||
{
|
||||
return _user_value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user