mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 20:56:28 +01:00
Fix crash when showing UI for plugins with output control ports.
This commit is contained in:
parent
23d95e1bca
commit
21dde8f2a7
2 changed files with 28 additions and 17 deletions
|
|
@ -249,23 +249,26 @@ GenericPluginUI::build ()
|
||||||
|
|
||||||
/* Don't show latency control ports */
|
/* Don't show latency control ports */
|
||||||
|
|
||||||
if (plugin->describe_parameter (Evoral::Parameter(PluginAutomation, 0, i)) == X_("latency")) {
|
const Evoral::Parameter param(PluginAutomation, 0, i);
|
||||||
|
if (plugin->describe_parameter (param) == X_("latency")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin->describe_parameter (Evoral::Parameter(PluginAutomation, 0, i)) == X_("hidden")) {
|
if (plugin->describe_parameter (param) == X_("hidden")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float value = plugin->get_parameter(i);
|
||||||
|
|
||||||
ControlUI* cui;
|
ControlUI* cui;
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::AutomationControl> c
|
boost::shared_ptr<ARDOUR::AutomationControl> c
|
||||||
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
|
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
|
||||||
insert->control(Evoral::Parameter(PluginAutomation, 0, i)));
|
insert->control(param));
|
||||||
|
|
||||||
ParameterDescriptor desc;
|
ParameterDescriptor desc;
|
||||||
plugin->get_parameter_descriptor(i, desc);
|
plugin->get_parameter_descriptor(i, desc);
|
||||||
if ((cui = build_control_ui (desc, c, plugin->parameter_is_input(i))) == 0) {
|
if ((cui = build_control_ui (param, desc, c, value, plugin->parameter_is_input(i))) == 0) {
|
||||||
error << string_compose(_("Plugin Editor: could not build control element for port %1"), i) << endmsg;
|
error << string_compose(_("Plugin Editor: could not build control element for port %1"), i) << endmsg;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -283,17 +286,18 @@ GenericPluginUI::build ()
|
||||||
const Plugin::PropertyDescriptors& descs = plugin->get_supported_properties();
|
const Plugin::PropertyDescriptors& descs = plugin->get_supported_properties();
|
||||||
for (Plugin::PropertyDescriptors::const_iterator d = descs.begin(); d != descs.end(); ++d) {
|
for (Plugin::PropertyDescriptors::const_iterator d = descs.begin(); d != descs.end(); ++d) {
|
||||||
const ParameterDescriptor& desc = d->second;
|
const ParameterDescriptor& desc = d->second;
|
||||||
|
const Evoral::Parameter param(PluginPropertyAutomation, 0, desc.key);
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::AutomationControl> c
|
boost::shared_ptr<ARDOUR::AutomationControl> c
|
||||||
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
|
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
|
||||||
insert->control(Evoral::Parameter(PluginPropertyAutomation, 0, desc.key)));
|
insert->control(param));
|
||||||
|
|
||||||
if (!c) {
|
if (!c) {
|
||||||
error << string_compose(_("Plugin Editor: no control for property %1"), desc.key) << endmsg;
|
error << string_compose(_("Plugin Editor: no control for property %1"), desc.key) << endmsg;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlUI* cui = build_control_ui(desc, c, true);
|
ControlUI* cui = build_control_ui(param, desc, c, c->get_value(), true);
|
||||||
if (!cui) {
|
if (!cui) {
|
||||||
error << string_compose(_("Plugin Editor: could not build control element for property %1"),
|
error << string_compose(_("Plugin Editor: could not build control element for property %1"),
|
||||||
desc.key) << endmsg;
|
desc.key) << endmsg;
|
||||||
|
|
@ -450,8 +454,9 @@ GenericPluginUI::build ()
|
||||||
button_table.show_all ();
|
button_table.show_all ();
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericPluginUI::ControlUI::ControlUI ()
|
GenericPluginUI::ControlUI::ControlUI (const Evoral::Parameter& p)
|
||||||
: automate_button (X_("")) // force creation of a label
|
: param(p)
|
||||||
|
, automate_button (X_("")) // force creation of a label
|
||||||
, file_button(NULL)
|
, file_button(NULL)
|
||||||
{
|
{
|
||||||
automate_button.set_name ("PluginAutomateButton");
|
automate_button.set_name ("PluginAutomateButton");
|
||||||
|
|
@ -531,16 +536,19 @@ GenericPluginUI::print_parameter (char *buf, uint32_t len, uint32_t param)
|
||||||
plugin->print_parameter (param, buf, len);
|
plugin->print_parameter (param, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Build a ControlUI for a parameter/property.
|
||||||
|
* Note that mcontrol may be NULL for outputs.
|
||||||
|
*/
|
||||||
GenericPluginUI::ControlUI*
|
GenericPluginUI::ControlUI*
|
||||||
GenericPluginUI::build_control_ui (const ParameterDescriptor& desc,
|
GenericPluginUI::build_control_ui (const Evoral::Parameter& param,
|
||||||
|
const ParameterDescriptor& desc,
|
||||||
boost::shared_ptr<AutomationControl> mcontrol,
|
boost::shared_ptr<AutomationControl> mcontrol,
|
||||||
|
float value,
|
||||||
bool is_input)
|
bool is_input)
|
||||||
{
|
{
|
||||||
ControlUI* control_ui = 0;
|
ControlUI* control_ui = 0;
|
||||||
|
|
||||||
const float value = mcontrol->get_value();
|
control_ui = manage (new ControlUI (param));
|
||||||
|
|
||||||
control_ui = manage (new ControlUI ());
|
|
||||||
control_ui->combo = 0;
|
control_ui->combo = 0;
|
||||||
control_ui->control = mcontrol;
|
control_ui->control = mcontrol;
|
||||||
control_ui->update_pending = false;
|
control_ui->update_pending = false;
|
||||||
|
|
@ -932,7 +940,7 @@ void
|
||||||
GenericPluginUI::output_update ()
|
GenericPluginUI::output_update ()
|
||||||
{
|
{
|
||||||
for (vector<ControlUI*>::iterator i = output_controls.begin(); i != output_controls.end(); ++i) {
|
for (vector<ControlUI*>::iterator i = output_controls.begin(); i != output_controls.end(); ++i) {
|
||||||
float val = (*i)->control->get_value();
|
float val = plugin->get_parameter ((*i)->parameter().id());
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf (buf, sizeof(buf), "%.2f", val);
|
snprintf (buf, sizeof(buf), "%.2f", val);
|
||||||
(*i)->display_label->set_text (buf);
|
(*i)->display_label->set_text (buf);
|
||||||
|
|
|
||||||
|
|
@ -226,9 +226,10 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
|
||||||
/* FIXME: Unify with AutomationController */
|
/* FIXME: Unify with AutomationController */
|
||||||
struct ControlUI : public Gtk::HBox {
|
struct ControlUI : public Gtk::HBox {
|
||||||
|
|
||||||
boost::shared_ptr<ARDOUR::AutomationControl> control;
|
const Evoral::Parameter parameter() const { return param; }
|
||||||
|
|
||||||
Evoral::Parameter parameter() { return control->parameter(); }
|
Evoral::Parameter param;
|
||||||
|
boost::shared_ptr<ARDOUR::AutomationControl> control;
|
||||||
|
|
||||||
/* input */
|
/* input */
|
||||||
|
|
||||||
|
|
@ -252,7 +253,7 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
|
||||||
Gtk::VBox* vbox;
|
Gtk::VBox* vbox;
|
||||||
MeterInfo* meterinfo;
|
MeterInfo* meterinfo;
|
||||||
|
|
||||||
ControlUI ();
|
ControlUI (const Evoral::Parameter& param);
|
||||||
~ControlUI ();
|
~ControlUI ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -262,8 +263,10 @@ class GenericPluginUI : public PlugUIBase, public Gtk::VBox
|
||||||
void output_update();
|
void output_update();
|
||||||
|
|
||||||
void build ();
|
void build ();
|
||||||
ControlUI* build_control_ui (const ARDOUR::ParameterDescriptor& desc,
|
ControlUI* build_control_ui (const Evoral::Parameter& param,
|
||||||
|
const ARDOUR::ParameterDescriptor& desc,
|
||||||
boost::shared_ptr<ARDOUR::AutomationControl> mcontrol,
|
boost::shared_ptr<ARDOUR::AutomationControl> mcontrol,
|
||||||
|
float value,
|
||||||
bool is_input);
|
bool is_input);
|
||||||
|
|
||||||
void ui_parameter_changed (ControlUI* cui);
|
void ui_parameter_changed (ControlUI* cui);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue