throw failed_constructor();
}
- // set_automatable ();
+ set_automatable ();
{
Glib::Mutex::Lock em (_session.engine().process_lock());
}
void
-PluginInsert::auto_state_changed (Parameter which)
+PluginInsert::auto_state_changed (Evoral::Parameter which)
{
if (which.type() != PluginAutomation)
return;
boost::shared_ptr<AutomationControl> c
- = boost::dynamic_pointer_cast<AutomationControl>(control (which));
+ = boost::dynamic_pointer_cast<AutomationControl>(data().control (which));
if (c && ((AutomationList*)c->list().get())->automation_state() != Off) {
_plugins[0]->set_parameter (which.id(), c->list()->eval (_session.transport_frame()));
void
PluginInsert::set_automatable ()
{
- set<Parameter> a = _plugins.front()->automatable ();
+ set<Evoral::Parameter> a = _plugins.front()->automatable ();
Plugin::ParameterDescriptor desc;
- for (set<Parameter>::iterator i = a.begin(); i != a.end(); ++i) {
+ for (set<Evoral::Parameter>::iterator i = a.begin(); i != a.end(); ++i) {
if (i->type() == PluginAutomation) {
can_automate (*i);
_plugins.front()->get_parameter_descriptor(i->id(), desc);
- Parameter param(*i);
+ Evoral::Parameter param(*i);
param.set_range(desc.lower, desc.upper, _plugins.front()->default_value(i->id()));
boost::shared_ptr<AutomationList> list(new AutomationList(param));
- add_control(boost::shared_ptr<AutomationControl>(new PluginControl(*this, list)));
+ add_control(boost::shared_ptr<AutomationControl>(new PluginControl(this, *i, list)));
}
}
}
void
-PluginInsert::parameter_changed (Parameter which, float val)
+PluginInsert::parameter_changed (Evoral::Parameter which, float val)
{
if (which.type() != PluginAutomation)
return;
uint32_t n = 0;
- for (Controls::iterator li = _controls.begin(); li != _controls.end(); ++li, ++n) {
+ for (Controls::iterator li = data().controls().begin(); li != data().controls().end(); ++li, ++n) {
boost::shared_ptr<AutomationControl> c
= boost::dynamic_pointer_cast<AutomationControl>(li->second);
}
void
-PluginInsert::set_parameter (Parameter param, float val)
+PluginInsert::set_parameter (Evoral::Parameter param, float val)
{
if (param.type() != PluginAutomation)
return;
_plugins[0]->set_parameter (param.id(), val);
- boost::shared_ptr<Evoral::Control> c = 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 "
+ << EventTypeMap::instance().to_symbol(param) << endmsg;
+ }
_session.set_dirty();
}
float
-PluginInsert::get_parameter (Parameter param)
+PluginInsert::get_parameter (Evoral::Parameter param)
{
if (param.type() != PluginAutomation)
return 0.0;
void
PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset)
{
- ControlEvent next_event (0, 0.0f);
+ Evoral::ControlEvent next_event (0, 0.0f);
nframes_t now = _session.transport_frame ();
nframes_t end = now + nframes;
- Glib::Mutex::Lock lm (_control_lock, Glib::TRY_LOCK);
+ Glib::Mutex::Lock lm (data().control_lock(), Glib::TRY_LOCK);
if (!lm.locked()) {
connect_and_run (bufs, nframes, offset, false);
return;
}
- if (!find_next_event (now, end, next_event)) {
+ if (!data().find_next_event (now, end, next_event)) {
/* no events have a time within the relevant range */
offset += cnt;
now += cnt;
- if (!find_next_event (now, end, next_event)) {
+ if (!data().find_next_event (now, end, next_event)) {
break;
}
}
}
float
-PluginInsert::default_parameter_value (Evoral::Parameter param)
+PluginInsert::default_parameter_value (const Evoral::Parameter& param)
{
if (param.type() != PluginAutomation)
return 1.0;
/* add port automation state */
XMLNode *autonode = new XMLNode(port_automation_node_name);
- set<Parameter> automatable = _plugins[0]->automatable();
+ set<Evoral::Parameter> automatable = _plugins[0]->automatable();
- for (set<Parameter>::iterator x = automatable.begin(); x != automatable.end(); ++x) {
+ for (set<Evoral::Parameter>::iterator x = automatable.begin(); x != automatable.end(); ++x) {
/*XMLNode* child = new XMLNode("port");
snprintf(buf, sizeof(buf), "%" PRIu32, *x);
child->add_child_nocopy (automation_list (*x).state (full));
autonode->add_child_nocopy (*child);
*/
- autonode->add_child_nocopy (((AutomationList*)control(*x)->list().get())->state (full));
+ autonode->add_child_nocopy (((AutomationList*)data().control(*x)->list().get())->state (full));
}
node.add_child_nocopy (*autonode);
}
boost::shared_ptr<AutomationControl> c = boost::dynamic_pointer_cast<AutomationControl>(
- control(Parameter(PluginAutomation, port_id), true));
+ data().control(Evoral::Parameter(PluginAutomation, port_id), true));
if (!child->children().empty()) {
c->alist()->set_state (*child->children().front());
}
string
-PluginInsert::describe_parameter (Parameter param)
+PluginInsert::describe_parameter (Evoral::Parameter param)
{
if (param.type() != PluginAutomation)
return Automatable::describe_parameter(param);
}
}
-PluginInsert::PluginControl::PluginControl (PluginInsert& p, boost::shared_ptr<AutomationList> list)
- : AutomationControl (p.session(), list, p.describe_parameter(list->parameter()))
+PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Parameter ¶m, boost::shared_ptr<AutomationList> list)
+ : AutomationControl (p->session(), param, list, p->describe_parameter(param))
, _plugin (p)
- , _list (list)
{
Plugin::ParameterDescriptor desc;
- p.plugin(0)->get_parameter_descriptor (list->parameter().id(), desc);
+ p->plugin(0)->get_parameter_descriptor (param.id(), desc);
_logarithmic = desc.logarithmic;
_toggled = desc.toggled;
}
}
- for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugin._plugins.begin();
- i != _plugin._plugins.end(); ++i) {
+ for (vector<boost::shared_ptr<Plugin> >::iterator i = _plugin->_plugins.begin();
+ i != _plugin->_plugins.end(); ++i) {
(*i)->set_parameter (_list->parameter().id(), val);
}
{
/* FIXME: probably should be taking out some lock here.. */
- float val = _plugin.get_parameter (_list->parameter());
+ float val = _plugin->get_parameter (_list->parameter());
return val;