13
0

Plugin automation fixes from torbenh.

git-svn-id: svn://localhost/ardour2/branches/3.0@3826 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2008-09-29 01:22:21 +00:00
parent f387fef0c0
commit 7eadc684a5
6 changed files with 21 additions and 18 deletions

View File

@ -218,7 +218,7 @@ GenericPluginUI::build ()
continue;
}
if (cui->control || cui->clickbox || cui->combo) {
if (cui->controller || cui->clickbox || cui->combo) {
box->pack_start (*cui, false, false);
@ -461,9 +461,8 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat
}
/* create the controller */
control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), mcontrol);
control_ui->controller = AutomationController::create(insert, mcontrol->parameter(), mcontrol);
/* XXX this code is not right yet, because it doesn't handle
the absence of bounds in any sensible fashion.
*/
@ -664,7 +663,9 @@ GenericPluginUI::update_control_display (ControlUI* cui)
}
}
cui->controller->display_effective_value();
if( cui->controller ) {
cui->controller->display_effective_value();
}
/*} else {

View File

@ -81,14 +81,14 @@ class PluginInsert : public Processor
struct PluginControl : public AutomationControl
{
PluginControl (PluginInsert& p, boost::shared_ptr<AutomationList> list);
PluginControl (PluginInsert* p, const Parameter &param,
boost::shared_ptr<AutomationList> list = boost::shared_ptr<AutomationList>());
void set_value (float val);
float get_value (void) const;
private:
PluginInsert& _plugin;
boost::shared_ptr<AutomationList> _list;
PluginInsert* _plugin;
bool _logarithmic;
bool _toggled;
};

View File

@ -28,6 +28,7 @@
#include <ardour/session.h>
#include <ardour/automatable.h>
#include <ardour/midi_track.h>
#include <ardour/plugin_insert.h>
#include "i18n.h"
@ -394,6 +395,8 @@ Automatable::control_factory(const Evoral::Parameter& param)
Evoral::Control* control = NULL;
if (param.type() >= MidiCCAutomation && param.type() <= MidiChannelPressureAutomation) {
control = new MidiTrack::MidiControl((MidiTrack*)this, param);
} else if (param.type() == PluginAutomation) {
control = new PluginInsert::PluginControl((PluginInsert*)this, param);
} else {
control = new AutomationControl(_a_session, param);
}

View File

@ -388,7 +388,7 @@ AutomationList::set_state (const XMLNode& node)
}
if ((prop = node.property (X_("automation-id"))) != 0){
_parameter = Parameter(prop->value());
_parameter = Evoral::Parameter(prop->value());
} else {
warning << "Legacy session: automation list has no automation-id property.";
}

View File

@ -37,7 +37,7 @@ PeakMeter::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_f
{
uint32_t n = 0;
uint32_t meterable = std::min(bufs.count().n_total(), (uint32_t)_peak_power.size());
uint32_t limit = std::min (meterable, bufs.count().n_midi());
uint32_t limit = std::min (meterable, (uint32_t)bufs.count().n_midi());
// Meter what we have (midi)
for ( ; n < limit; ++n) {

View File

@ -80,7 +80,7 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node)
throw failed_constructor();
}
// set_automatable ();
set_automatable ();
{
Glib::Mutex::Lock em (_session.engine().process_lock());
@ -229,7 +229,7 @@ PluginInsert::set_automatable ()
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)));
}
}
}
@ -852,13 +852,12 @@ PluginInsert::type ()
}
}
PluginInsert::PluginControl::PluginControl (PluginInsert& p, boost::shared_ptr<AutomationList> list)
: AutomationControl (p.session(), list->parameter(), list, p.describe_parameter(list->parameter()))
PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Parameter &param, 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;
}
@ -892,8 +891,8 @@ PluginInsert::PluginControl::set_value (float val)
}
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);
}
@ -905,7 +904,7 @@ PluginInsert::PluginControl::get_value (void) const
{
/* 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;