Who needs PIs for Plugin GUIs?

Use abstract base class for plugin UIs wherever possible
This commit is contained in:
Robin Gareus 2022-04-04 20:48:56 +02:00
parent 74a673ce17
commit 9cbf3ae4ad
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
24 changed files with 295 additions and 274 deletions

View file

@ -54,7 +54,7 @@
namespace ARDOUR { namespace ARDOUR {
class AUPlugin; class AUPlugin;
class PluginInsert; class PlugInsertBase;
class IOProcessor; class IOProcessor;
} }
@ -77,7 +77,7 @@ class AUPluginUI;
class AUPluginUI : public PlugUIBase, public Gtk::VBox class AUPluginUI : public PlugUIBase, public Gtk::VBox
{ {
public: public:
AUPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>); AUPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>);
~AUPluginUI (); ~AUPluginUI ();
gint get_preferred_width () { return req_width; } gint get_preferred_width () { return req_width; }

View file

@ -393,8 +393,8 @@ static void interposed_drawIfNeeded (id receiver, SEL selector, NSRect rect)
} }
@end @end
AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert) AUPluginUI::AUPluginUI (boost::shared_ptr<PlugInsertBase> pib)
: PlugUIBase (insert) : PlugUIBase (pib)
, automation_mode_label (_("Automation")) , automation_mode_label (_("Automation"))
, preset_label (_("Presets")) , preset_label (_("Presets"))
, resizable (false) , resizable (false)
@ -415,7 +415,7 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
set_popdown_strings (automation_mode_selector, automation_mode_strings); set_popdown_strings (automation_mode_selector, automation_mode_strings);
automation_mode_selector.set_active_text (automation_mode_strings.front()); automation_mode_selector.set_active_text (automation_mode_strings.front());
if ((au = boost::dynamic_pointer_cast<AUPlugin> (insert->plugin())) == 0) { if ((au = boost::dynamic_pointer_cast<AUPlugin> (pib->plugin())) == 0) {
error << _("unknown type of editor-supplying plugin (note: no AudioUnit support in this version of ardour)") << endmsg; error << _("unknown type of editor-supplying plugin (note: no AudioUnit support in this version of ardour)") << endmsg;
throw failed_constructor (); throw failed_constructor ();
} }
@ -427,13 +427,7 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
top_box.set_spacing (6); top_box.set_spacing (6);
top_box.set_border_width (6); top_box.set_border_width (6);
bool for_auditioner = false;
if (insert->session().the_auditioner()) {
for_auditioner = insert->session().the_auditioner()->the_instrument() == insert;
}
if (!for_auditioner) {
add_common_widgets (&top_box); add_common_widgets (&top_box);
}
set_spacing (0); set_spacing (0);
pack_start (top_box, false, false); pack_start (top_box, false, false);
@ -819,7 +813,7 @@ AUPluginUI::cocoa_view_resized ()
plugin_requested_resize = 1; plugin_requested_resize = 1;
ProcessorWindowProxy* wp = insert->window_proxy(); ProcessorWindowProxy* wp = _pi ? _pi->window_proxy() : NULL;
if (wp) { if (wp) {
/* Once a plugin has requested a resize of its own window, do /* Once a plugin has requested a resize of its own window, do
* NOT save the window. The user may save state with the plugin * NOT save the window. The user may save state with the plugin
@ -1289,9 +1283,9 @@ AUPluginUI::stop_updating (GdkEventAny*)
} }
PlugUIBase* PlugUIBase*
create_au_gui (boost::shared_ptr<PluginInsert> plugin_insert, VBox** box) create_au_gui (boost::shared_ptr<PlugInsertBase> pib, VBox** box)
{ {
AUPluginUI* aup = new AUPluginUI (plugin_insert); AUPluginUI* aup = new AUPluginUI (pib);
(*box) = aup; (*box) = aup;
return aup; return aup;
} }

View file

@ -47,7 +47,6 @@
#include "midi++/midnam_patch.h" #include "midi++/midnam_patch.h"
#include "ardour/auditioner.h"
#include "ardour/midi_patch_manager.h" #include "ardour/midi_patch_manager.h"
#include "ardour/midi_track.h" #include "ardour/midi_track.h"
#include "ardour/plugin.h" #include "ardour/plugin.h"
@ -85,8 +84,8 @@ using namespace ArdourWidgets;
using namespace Gtk; using namespace Gtk;
using namespace ARDOUR_UI_UTILS; using namespace ARDOUR_UI_UTILS;
GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrollable) GenericPluginUI::GenericPluginUI (boost::shared_ptr<PlugInsertBase> pib, bool scrollable)
: PlugUIBase (pi) : PlugUIBase (pib)
, automation_menu (0) , automation_menu (0)
, is_scrollable(scrollable) , is_scrollable(scrollable)
, _plugin_pianokeyboard_expander (_("MIDI Keyboard (audition only)")) , _plugin_pianokeyboard_expander (_("MIDI Keyboard (audition only)"))
@ -94,11 +93,6 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
, _piano_velocity (*manage (new Adjustment (100, 1, 127, 1, 16))) , _piano_velocity (*manage (new Adjustment (100, 1, 127, 1, 16)))
, _piano_channel (*manage (new Adjustment (0, 1, 16, 1, 1))) , _piano_channel (*manage (new Adjustment (0, 1, 16, 1, 1)))
{ {
bool for_auditioner = false;
if (insert->session().the_auditioner()) {
for_auditioner = insert->session().the_auditioner()->the_instrument() == insert;
}
set_name ("PluginEditor"); set_name ("PluginEditor");
set_border_width (6); set_border_width (6);
//set_homogeneous (false); //set_homogeneous (false);
@ -109,7 +103,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
smaller_hbox->set_spacing (6); smaller_hbox->set_spacing (6);
smaller_hbox->set_border_width (0); smaller_hbox->set_border_width (0);
if (for_auditioner) { if (_pib->ui_elements () == PlugInsertBase::NoGUIToolbar) {
Gtk::Label* spacer = manage (new Gtk::Label()); Gtk::Label* spacer = manage (new Gtk::Label());
smaller_hbox->pack_start(*spacer); smaller_hbox->pack_start(*spacer);
} else { } else {
@ -127,8 +121,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch)); automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch));
automation_latch_all_button.set_name (X_("generic button")); automation_latch_all_button.set_name (X_("generic button"));
if (!for_auditioner) { /*auditioner is not run when it isn't auditioning; so the piano keyboard, cpu usage, and other features are not applicable */ if (_pib->ui_elements () & PlugInsertBase::MIDIKeyboard) {
if (pi->is_instrument ()) {
_piano = new APianoKeyboard (); _piano = new APianoKeyboard ();
_piano->set_can_focus (); _piano->set_can_focus ();
@ -152,25 +145,48 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
_plugin_pianokeyboard_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &GenericPluginUI::toggle_pianokeyboard)); _plugin_pianokeyboard_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &GenericPluginUI::toggle_pianokeyboard));
pack_end (_plugin_pianokeyboard_expander, false, false); pack_end (_plugin_pianokeyboard_expander, false, false);
} else { } else if (_pi && _pi->ui_elements () != PlugInsertBase::NoGUIToolbar) {
pack_end (plugin_analysis_expander, false, false); pack_end (plugin_analysis_expander, false, false);
} }
if (insert->provides_stats ()) { if (_pib->provides_stats ()) {
pack_end (cpuload_expander, false, false); pack_end (cpuload_expander, false, false);
} }
if (!plugin->get_docs().empty()) { if (!plugin->get_docs().empty()) {
pack_end (description_expander, false, false); pack_end (description_expander, false, false);
} }
}
settings_box.set_homogeneous (false); settings_box.set_homogeneous (false);
settings_box.set_spacing (0); settings_box.set_spacing (0);
settings_box.set_border_width (0); settings_box.set_border_width (0);
settings_box.pack_start (*smaller_hbox, false, false); settings_box.pack_start (*smaller_hbox, false, false);
if (pi->controls().size() > 0) { bool has_automatables = false;
for (size_t i = 0; i < plugin->parameter_count(); ++i) {
if (!plugin->parameter_is_control (i)) {
continue;
}
if (!plugin->parameter_is_input (i)) {
continue;
}
const Evoral::Parameter param(PluginAutomation, 0, i);
boost::shared_ptr<ARDOUR::AutomationControl> c (boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(_pib->control (param)));
if (!c) {
continue;
}
if (c->flags () & Controllable::HiddenControl) {
continue;
}
if (c->flags () & Controllable::NotAutomatable) {
continue;
}
has_automatables = true;
break;
}
if (_pi && has_automatables) {
HBox* automation_hbox = manage (new HBox); HBox* automation_hbox = manage (new HBox);
automation_hbox->set_spacing (6); automation_hbox->set_spacing (6);
Label* l = manage (new Label (_("All Automation"))); Label* l = manage (new Label (_("All Automation")));
@ -185,8 +201,12 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
main_contents.pack_start (settings_box, false, false); main_contents.pack_start (settings_box, false, false);
pi->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr<Processor>(pi)), gui_context()); if (_pi) {
_bypass_button.set_active (!pi->enabled()); _pi->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr<Processor>(_pi)), gui_context());
_bypass_button.set_active (!_pi->enabled());
} else {
_bypass_button.set_sensitive (false);
}
/* ScrolledWindow will wrap hpacker in a Viewport */ /* ScrolledWindow will wrap hpacker in a Viewport */
scroller.add (hpacker); scroller.add (hpacker);
@ -198,7 +218,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
prefheight = -1; prefheight = -1;
build (); build ();
if (insert->plugin()->has_midnam() && insert->plugin()->knows_bank_patch()) { if (_pib->plugin()->has_midnam() && _pib->plugin()->knows_bank_patch()) {
build_midi_table (); build_midi_table ();
} }
@ -336,9 +356,7 @@ GenericPluginUI::build ()
ControlUI* cui; ControlUI* cui;
boost::shared_ptr<ARDOUR::AutomationControl> c boost::shared_ptr<ARDOUR::AutomationControl> c (boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(_pib->control (param)));
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
insert->control(param));
if (c && c->flags () & Controllable::HiddenControl) { if (c && c->flags () & Controllable::HiddenControl) {
continue; continue;
@ -366,9 +384,7 @@ GenericPluginUI::build ()
const ParameterDescriptor& desc = d->second; const ParameterDescriptor& desc = d->second;
const Evoral::Parameter param(PluginPropertyAutomation, 0, desc.key); 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>(_pib->control (param)));
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
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;
@ -396,9 +412,9 @@ GenericPluginUI::build ()
plugin->announce_property_values(); plugin->announce_property_values();
} }
if (control_uis.empty ()) { if (control_uis.empty () && _pi) {
if (has_descriptive_presets ()) { if (has_descriptive_presets ()) {
preset_gui = new PluginPresetsUI (insert); preset_gui = new PluginPresetsUI (_pi); // XXX
hpacker.pack_start (*preset_gui, true, true); hpacker.pack_start (*preset_gui, true, true);
} }
} else { } else {
@ -644,7 +660,7 @@ GenericPluginUI::build_midi_table ()
ArdourWidgets::Frame* frame = manage (new ArdourWidgets::Frame); ArdourWidgets::Frame* frame = manage (new ArdourWidgets::Frame);
frame->set_name ("BaseFrame"); frame->set_name ("BaseFrame");
if (dynamic_cast<MidiTrack*> (insert->owner())) { if (_pi && dynamic_cast<MidiTrack*> (_pi->owner())) {
frame->set_label (_("MIDI Programs (sent to track)")); frame->set_label (_("MIDI Programs (sent to track)"));
} else { } else {
frame->set_label (_("MIDI Programs (volatile)")); frame->set_label (_("MIDI Programs (volatile)"));
@ -664,16 +680,16 @@ GenericPluginUI::build_midi_table ()
pgm_table->attach (*cui, col + 1, col + 2, row, row+1, SHRINK, SHRINK); pgm_table->attach (*cui, col + 1, col + 2, row, row+1, SHRINK, SHRINK);
} }
insert->plugin ()->read_midnam(); _pib->plugin ()->read_midnam();
midi_refill_patches (); midi_refill_patches ();
insert->plugin()->BankPatchChange.connect ( _pib->plugin()->BankPatchChange.connect (
midi_connections, invalidator (*this), midi_connections, invalidator (*this),
boost::bind (&GenericPluginUI::midi_bank_patch_change, this, _1), boost::bind (&GenericPluginUI::midi_bank_patch_change, this, _1),
gui_context()); gui_context());
insert->plugin()->UpdatedMidnam.connect ( _pib->plugin()->UpdatedMidnam.connect (
midi_connections, invalidator (*this), midi_connections, invalidator (*this),
boost::bind (&GenericPluginUI::midi_refill_patches, this), boost::bind (&GenericPluginUI::midi_refill_patches, this),
gui_context()); gui_context());
@ -686,7 +702,7 @@ GenericPluginUI::midi_refill_patches ()
pgm_names.clear (); pgm_names.clear ();
const std::string model = insert->plugin ()->midnam_model (); const std::string model = _pib->plugin ()->midnam_model ();
std::string mode; std::string mode;
const std::list<std::string> device_modes = MIDI::Name::MidiPatchManager::instance().custom_device_mode_names_by_model (model); const std::list<std::string> device_modes = MIDI::Name::MidiPatchManager::instance().custom_device_mode_names_by_model (model);
if (device_modes.size() > 0) { if (device_modes.size() > 0) {
@ -722,7 +738,7 @@ void
GenericPluginUI::midi_bank_patch_change (uint8_t chn) GenericPluginUI::midi_bank_patch_change (uint8_t chn)
{ {
assert (chn < 16 && midi_pgmsel.size() == 16); assert (chn < 16 && midi_pgmsel.size() == 16);
uint32_t bankpgm = insert->plugin()->bank_patch (chn); uint32_t bankpgm = _pib->plugin()->bank_patch (chn);
if (bankpgm == UINT32_MAX) { if (bankpgm == UINT32_MAX) {
midi_pgmsel[chn]->set_text (_("--Unset--")); midi_pgmsel[chn]->set_text (_("--Unset--"));
} else { } else {
@ -742,7 +758,7 @@ GenericPluginUI::midi_bank_patch_select (uint8_t chn, uint32_t bankpgm)
{ {
int bank = bankpgm >> 7; int bank = bankpgm >> 7;
int pgm = bankpgm & 127; int pgm = bankpgm & 127;
MidiTrack* mt = dynamic_cast<MidiTrack*> (insert->owner()); MidiTrack* mt = _pi ? dynamic_cast<MidiTrack*> (_pi->owner()) : NULL;
if (mt) { if (mt) {
/* send to track */ /* send to track */
boost::shared_ptr<AutomationControl> bank_msb = mt->automation_control(Evoral::Parameter (MidiCCAutomation, chn, MIDI_CTL_MSB_BANK), true); boost::shared_ptr<AutomationControl> bank_msb = mt->automation_control(Evoral::Parameter (MidiCCAutomation, chn, MIDI_CTL_MSB_BANK), true);
@ -757,15 +773,15 @@ GenericPluginUI::midi_bank_patch_select (uint8_t chn, uint32_t bankpgm)
event[0] = (MIDI_CMD_CONTROL | chn); event[0] = (MIDI_CMD_CONTROL | chn);
event[1] = 0x00; event[1] = 0x00;
event[2] = bank >> 7; event[2] = bank >> 7;
insert->write_immediate_event (Evoral::MIDI_EVENT, 3, event); _pib->write_immediate_event (Evoral::MIDI_EVENT, 3, event);
event[1] = 0x20; event[1] = 0x20;
event[2] = bank & 127; event[2] = bank & 127;
insert->write_immediate_event (Evoral::MIDI_EVENT, 3, event); _pib->write_immediate_event (Evoral::MIDI_EVENT, 3, event);
event[0] = (MIDI_CMD_PGM_CHANGE | chn); event[0] = (MIDI_CMD_PGM_CHANGE | chn);
event[1] = pgm; event[1] = pgm;
insert->write_immediate_event (Evoral::MIDI_EVENT, 2, event); _pib->write_immediate_event (Evoral::MIDI_EVENT, 2, event);
} }
} }
@ -817,13 +833,18 @@ GenericPluginUI::set_short_autostate (ControlUI* cui, bool value)
void void
GenericPluginUI::automation_state_changed (ControlUI* cui) GenericPluginUI::automation_state_changed (ControlUI* cui)
{ {
AutoState state;
if (_pi) {
/* don't lock to avoid deadlock because we're triggered by
* AutomationControl::Changed() while the automation lock is taken
*/
state = _pi->get_parameter_automation_state (cui->parameter());
} else {
state = ARDOUR::Off;
}
/* update button label */ /* update button label */
// don't lock to avoid deadlock because we're triggered by
// AutomationControl::Changed() while the automation lock is taken
AutoState state = insert->get_parameter_automation_state (cui->parameter());
cui->automate_button.set_active((state != ARDOUR::Off)); cui->automate_button.set_active((state != ARDOUR::Off));
if (cui->short_autostate) { if (cui->short_autostate) {
@ -1014,7 +1035,7 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param,
} }
if (mcontrol->flags () & Controllable::NotAutomatable) { if (!_pi || mcontrol->flags () & Controllable::NotAutomatable) {
control_ui->automate_button.set_sensitive (false); control_ui->automate_button.set_sensitive (false);
set_tooltip(control_ui->automate_button, _("This control cannot be automated")); set_tooltip(control_ui->automate_button, _("This control cannot be automated"));
} else { } else {
@ -1130,6 +1151,7 @@ GenericPluginUI::knob_size_request(Gtk::Requisition* req, ControlUI* cui) {
bool bool
GenericPluginUI::astate_button_event (GdkEventButton* ev, ControlUI* cui) GenericPluginUI::astate_button_event (GdkEventButton* ev, ControlUI* cui)
{ {
assert (_pi);
if (ev->button != 1) { if (ev->button != 1) {
return true; return true;
} }
@ -1157,7 +1179,7 @@ GenericPluginUI::astate_button_event (GdkEventButton* ev, ControlUI* cui)
sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Latch, cui))); sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Latch, cui)));
anchored_menu_popup (automation_menu, &cui->automate_button, anchored_menu_popup (automation_menu, &cui->automate_button,
GainMeterBase::astate_string (insert->get_parameter_automation_state (cui->parameter())), GainMeterBase::astate_string (_pi->get_parameter_automation_state (cui->parameter())),
1, ev->time); 1, ev->time);
return true; return true;
@ -1174,7 +1196,9 @@ GenericPluginUI::set_all_automation (AutoState as)
void void
GenericPluginUI::set_automation_state (AutoState state, ControlUI* cui) GenericPluginUI::set_automation_state (AutoState state, ControlUI* cui)
{ {
insert->set_parameter_automation_state (cui->parameter(), state); if (_pi) {
_pi->set_parameter_automation_state (cui->parameter(), state);
}
} }
void void
@ -1239,7 +1263,7 @@ void
GenericPluginUI::control_combo_changed (ControlUI* cui, float value) GenericPluginUI::control_combo_changed (ControlUI* cui, float value)
{ {
if (!cui->ignore_change) { if (!cui->ignore_change) {
insert->automation_control (cui->parameter())->set_value (value, Controllable::NoGroup); cui->combo->get_controllable ()->set_value (value, Controllable::NoGroup);
} }
} }
@ -1268,7 +1292,7 @@ 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 = plugin->get_parameter ((*i)->parameter().id()); float val = plugin->get_parameter ((*i)->parameter().id());
char buf[32]; char buf[32];
boost::shared_ptr<ReadOnlyControl> c = insert->control_output ((*i)->parameter().id()); boost::shared_ptr<ReadOnlyControl> c = _pib->control_output ((*i)->parameter().id());
const std::string& str = ARDOUR::value_as_string(c->desc(), Variant(val)); const std::string& str = ARDOUR::value_as_string(c->desc(), Variant(val));
size_t len = str.copy(buf, 31); size_t len = str.copy(buf, 31);
buf[len] = '\0'; buf[len] = '\0';
@ -1322,7 +1346,7 @@ GenericPluginUI::toggle_pianokeyboard ()
void void
GenericPluginUI::note_on_event_handler (int note, int) GenericPluginUI::note_on_event_handler (int note, int)
{ {
MidiTrack* mt = dynamic_cast<MidiTrack*> (insert->owner()); MidiTrack* mt = _pi ? dynamic_cast<MidiTrack*> (_pi->owner()) : NULL;
_piano->grab_focus (); _piano->grab_focus ();
uint8_t channel = _piano_channel.get_value_as_int () - 1; uint8_t channel = _piano_channel.get_value_as_int () - 1;
uint8_t event[3]; uint8_t event[3];
@ -1332,14 +1356,14 @@ GenericPluginUI::note_on_event_handler (int note, int)
if (mt) { if (mt) {
mt->write_immediate_event (Evoral::MIDI_EVENT, 3, event); mt->write_immediate_event (Evoral::MIDI_EVENT, 3, event);
} else { } else {
insert->write_immediate_event (Evoral::MIDI_EVENT, 3, event); _pib->write_immediate_event (Evoral::MIDI_EVENT, 3, event);
} }
} }
void void
GenericPluginUI::note_off_event_handler (int note) GenericPluginUI::note_off_event_handler (int note)
{ {
MidiTrack* mt = dynamic_cast<MidiTrack*> (insert->owner()); MidiTrack* mt = _pi ? dynamic_cast<MidiTrack*> (_pi->owner()) : NULL;
uint8_t channel = _piano_channel.get_value_as_int () - 1; uint8_t channel = _piano_channel.get_value_as_int () - 1;
uint8_t event[3]; uint8_t event[3];
event[0] = (MIDI_CMD_NOTE_OFF | channel); event[0] = (MIDI_CMD_NOTE_OFF | channel);
@ -1348,6 +1372,6 @@ GenericPluginUI::note_off_event_handler (int note)
if (mt) { if (mt) {
mt->write_immediate_event (Evoral::MIDI_EVENT, 3, event); mt->write_immediate_event (Evoral::MIDI_EVENT, 3, event);
} else { } else {
insert->write_immediate_event (Evoral::MIDI_EVENT, 3, event); _pib->write_immediate_event (Evoral::MIDI_EVENT, 3, event);
} }
} }

View file

@ -25,8 +25,8 @@
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include "ardour/auditioner.h"
#include "ardour/lv2_plugin.h" #include "ardour/lv2_plugin.h"
#include "ardour/plugin_insert.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "pbd/error.h" #include "pbd/error.h"
@ -73,9 +73,9 @@ LV2PluginUI::write_from_ui(void* controller,
} }
} else if (format == URIMap::instance().urids.atom_eventTransfer) { } else if (format == URIMap::instance().urids.atom_eventTransfer) {
const int cnt = me->_pi->get_count(); const int cnt = me->_pib->get_count();
for (int i=0; i < cnt; i++ ) { for (int i=0; i < cnt; i++ ) {
boost::shared_ptr<LV2Plugin> lv2i = boost::dynamic_pointer_cast<LV2Plugin> (me->_pi->plugin(i)); boost::shared_ptr<LV2Plugin> lv2i = boost::dynamic_pointer_cast<LV2Plugin> (me->_pib->plugin(i));
lv2i->write_from_ui(port_index, format, buffer_size, (const uint8_t*)buffer); lv2i->write_from_ui(port_index, format, buffer_size, (const uint8_t*)buffer);
} }
} }
@ -296,10 +296,10 @@ LV2PluginUI::output_update()
_updates.clear (); _updates.clear ();
} }
LV2PluginUI::LV2PluginUI(boost::shared_ptr<PluginInsert> pi, LV2PluginUI::LV2PluginUI(boost::shared_ptr<PlugInsertBase> pib,
boost::shared_ptr<LV2Plugin> lv2p) boost::shared_ptr<LV2Plugin> lv2p)
: PlugUIBase(pi) : PlugUIBase(pib)
, _pi(pi) , _pib(pib)
, _lv2(lv2p) , _lv2(lv2p)
, _gui_widget(NULL) , _gui_widget(NULL)
, _values_last_sent_to_ui(NULL) , _values_last_sent_to_ui(NULL)
@ -309,13 +309,7 @@ LV2PluginUI::LV2PluginUI(boost::shared_ptr<PluginInsert> pi,
_ardour_buttons_box.set_spacing (6); _ardour_buttons_box.set_spacing (6);
_ardour_buttons_box.set_border_width (6); _ardour_buttons_box.set_border_width (6);
bool for_auditioner = false;
if (insert->session().the_auditioner()) {
for_auditioner = insert->session().the_auditioner()->the_instrument() == insert;
}
if (!for_auditioner) {
add_common_widgets (&_ardour_buttons_box); add_common_widgets (&_ardour_buttons_box);
}
plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&LV2PluginUI::queue_port_update, this), gui_context ()); plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&LV2PluginUI::queue_port_update, this), gui_context ());
} }
@ -479,7 +473,7 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title)
_values_last_sent_to_ui[port] = _lv2->get_parameter(port); _values_last_sent_to_ui[port] = _lv2->get_parameter(port);
_controllables[port] = boost::dynamic_pointer_cast<ARDOUR::AutomationControl> ( _controllables[port] = boost::dynamic_pointer_cast<ARDOUR::AutomationControl> (
insert->control(Evoral::Parameter(PluginAutomation, 0, port))); _pib->control(Evoral::Parameter(PluginAutomation, 0, port)));
if (_lv2->parameter_is_control(port) && _lv2->parameter_is_input(port)) { if (_lv2->parameter_is_control(port) && _lv2->parameter_is_input(port)) {
if (_controllables[port]) { if (_controllables[port]) {

View file

@ -38,21 +38,20 @@
#include "ardour/types.h" #include "ardour/types.h"
#include "plugin_ui.h" #include "plugin_ui.h"
#include "ardour/plugin_insert.h" #include "ardour/plug_insert_base.h"
#include "lv2_external_ui.h" #include "lv2_external_ui.h"
#include "lv2/lv2plug.in/ns/extensions/ui/ui.h" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h"
namespace ARDOUR { namespace ARDOUR {
class PluginInsert;
class LV2Plugin; class LV2Plugin;
} }
class LV2PluginUI : public PlugUIBase, public Gtk::VBox class LV2PluginUI : public PlugUIBase, public Gtk::VBox
{ {
public: public:
LV2PluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, LV2PluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>,
boost::shared_ptr<ARDOUR::LV2Plugin>); boost::shared_ptr<ARDOUR::LV2Plugin>);
~LV2PluginUI (); ~LV2PluginUI ();
@ -72,13 +71,13 @@ private:
typedef boost::shared_ptr<ARDOUR::AutomationControl> ControllableRef; typedef boost::shared_ptr<ARDOUR::AutomationControl> ControllableRef;
boost::shared_ptr<ARDOUR::PluginInsert> _pi; boost::shared_ptr<ARDOUR::PlugInsertBase> _pib;
boost::shared_ptr<ARDOUR::LV2Plugin> _lv2; boost::shared_ptr<ARDOUR::LV2Plugin> _lv2;
std::vector<int> _output_ports; std::vector<int> _output_ports;
sigc::connection _screen_update_connection; sigc::connection _screen_update_connection;
sigc::connection _message_update_connection; sigc::connection _message_update_connection;
Gtk::Widget* _gui_widget; Gtk::Widget* _gui_widget;
/** a box containing the focus, bypass, delete, save / add preset buttons etc. */ /** a box containing the focus, bypa s, delete, save / add preset buttons etc. */
Gtk::HBox _ardour_buttons_box; Gtk::HBox _ardour_buttons_box;
float* _values_last_sent_to_ui; float* _values_last_sent_to_ui;
std::vector<ControllableRef> _controllables; std::vector<ControllableRef> _controllables;
@ -92,6 +91,7 @@ private:
struct lv2_external_ui* _external_ui_ptr; struct lv2_external_ui* _external_ui_ptr;
LV2_Feature _parent_feature; LV2_Feature _parent_feature;
void* _inst; void* _inst;
typedef std::set<uint32_t> Updates; typedef std::set<uint32_t> Updates;
Updates _updates; Updates _updates;

View file

@ -33,8 +33,8 @@ using namespace Gtk;
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD; using namespace PBD;
LXVSTPluginUI::LXVSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VSTPlugin> lxvp) LXVSTPluginUI::LXVSTPluginUI (boost::shared_ptr<PlugInsertBase> pib, boost::shared_ptr<VSTPlugin> lxvp)
: VSTPluginUI (pi, lxvp) : VSTPluginUI (pib, lxvp)
{ {
vstfx_run_editor (_vst->state ()); vstfx_run_editor (_vst->state ());
} }

View file

@ -26,14 +26,14 @@
#ifdef LXVST_SUPPORT #ifdef LXVST_SUPPORT
namespace ARDOUR { namespace ARDOUR {
class PluginInsert; class PlugInsertBase;
class LXVSTPlugin; class LXVSTPlugin;
} }
class LXVSTPluginUI : public VSTPluginUI class LXVSTPluginUI : public VSTPluginUI
{ {
public: public:
LXVSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VSTPlugin>); LXVSTPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>, boost::shared_ptr<ARDOUR::VSTPlugin>);
~LXVSTPluginUI (); ~LXVSTPluginUI ();
int get_preferred_height (); int get_preferred_height ();

View file

@ -18,7 +18,7 @@
#include "gtkmm2ext/utils.h" #include "gtkmm2ext/utils.h"
#include "ardour/session.h" #include "ardour/audioengine.h"
#include "plugin_dspload_ui.h" #include "plugin_dspload_ui.h"
#include "timers.h" #include "timers.h"
@ -28,8 +28,8 @@
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace Gtk; using namespace Gtk;
PluginLoadStatsGui::PluginLoadStatsGui (boost::shared_ptr<ARDOUR::PluginInsert> insert) PluginLoadStatsGui::PluginLoadStatsGui (boost::shared_ptr<ARDOUR::PlugInsertBase> pib)
: _insert (insert) : _pib (pib)
, _lbl_min ("", ALIGN_END, ALIGN_CENTER) , _lbl_min ("", ALIGN_END, ALIGN_CENTER)
, _lbl_max ("", ALIGN_END, ALIGN_CENTER) , _lbl_max ("", ALIGN_END, ALIGN_CENTER)
, _lbl_avg ("", ALIGN_END, ALIGN_CENTER) , _lbl_avg ("", ALIGN_END, ALIGN_CENTER)
@ -81,7 +81,7 @@ PluginLoadStatsGui::stop_updating () {
void void
PluginLoadStatsGui::update_cpu_label() PluginLoadStatsGui::update_cpu_label()
{ {
if (_insert->get_stats (_min, _max, _avg, _dev)) { if (_pib->get_stats (_min, _max, _avg, _dev)) {
_valid = true; _valid = true;
_lbl_min.set_text (string_compose (_("%1 [ms]"), rint (_min / 10.) / 100.)); _lbl_min.set_text (string_compose (_("%1 [ms]"), rint (_min / 10.) / 100.));
_lbl_max.set_text (string_compose (_("%1 [ms]"), rint (_max / 10.) / 100.)); _lbl_max.set_text (string_compose (_("%1 [ms]"), rint (_max / 10.) / 100.));
@ -124,7 +124,7 @@ PluginLoadStatsGui::draw_bar (GdkEventExpose* ev)
const int w = x1 - x0; const int w = x1 - x0;
const int h = y1 - y0; const int h = y1 - y0;
const double cycle_ms = 1000. * _insert->session().get_block_size() / (double)_insert->session().nominal_sample_rate(); const double cycle_ms = ARDOUR::AudioEngine::instance()->usecs_per_cycle () / 1000.0;
const double base_mult = std::max (1.0, cycle_ms / 2.0); const double base_mult = std::max (1.0, cycle_ms / 2.0);
const double log_base = log1p (base_mult); const double log_base = log1p (base_mult);

View file

@ -27,12 +27,12 @@
#include "widgets/ardour_button.h" #include "widgets/ardour_button.h"
#include "ardour/plugin_insert.h" #include "ardour/plug_insert_base.h"
class PluginLoadStatsGui : public Gtk::Table class PluginLoadStatsGui : public Gtk::Table
{ {
public: public:
PluginLoadStatsGui (boost::shared_ptr<ARDOUR::PluginInsert>); PluginLoadStatsGui (boost::shared_ptr<ARDOUR::PlugInsertBase>);
void start_updating (); void start_updating ();
void stop_updating (); void stop_updating ();
@ -44,10 +44,10 @@ private:
void update_cpu_label (); void update_cpu_label ();
bool draw_bar (GdkEventExpose*); bool draw_bar (GdkEventExpose*);
void clear_stats () { void clear_stats () {
_insert->clear_stats (); _pib->clear_stats ();
} }
boost::shared_ptr<ARDOUR::PluginInsert> _insert; boost::shared_ptr<ARDOUR::PlugInsertBase> _pib;
sigc::connection update_cpu_label_connection; sigc::connection update_cpu_label_connection;
Gtk::Label _lbl_min; Gtk::Label _lbl_min;

View file

@ -21,6 +21,8 @@
#include <gtkmm/viewport.h> #include <gtkmm/viewport.h>
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/plugin_insert.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
#include "plugin_dspload_ui.h" #include "plugin_dspload_ui.h"

View file

@ -71,7 +71,7 @@
# include "vst3_hwnd_plugin_ui.h" # include "vst3_hwnd_plugin_ui.h"
# elif defined (__APPLE__) # elif defined (__APPLE__)
# include "vst3_plugin_ui.h" # include "vst3_plugin_ui.h"
extern VST3PluginUI* create_mac_vst3_gui (boost::shared_ptr<ARDOUR::PluginInsert>, Gtk::VBox**); extern VST3PluginUI* create_mac_vst3_gui (boost::shared_ptr<ARDOUR::PlugInsertBase>, Gtk::VBox**);
# else # else
# include "vst3_x11_plugin_ui.h" # include "vst3_x11_plugin_ui.h"
# endif # endif
@ -106,7 +106,7 @@ using namespace Gtk;
PluginUIWindow* PluginUIWindow::the_plugin_window = 0; PluginUIWindow* PluginUIWindow::the_plugin_window = 0;
PluginUIWindow::PluginUIWindow ( PluginUIWindow::PluginUIWindow (
boost::shared_ptr<PluginInsert> insert, boost::shared_ptr<PlugInsertBase> pib,
bool scrollable, bool scrollable,
bool editor) bool editor)
: ArdourWindow (string()) : ArdourWindow (string())
@ -122,22 +122,22 @@ PluginUIWindow::PluginUIWindow (
Label* label = manage (new Label()); Label* label = manage (new Label());
label->set_markup ("<b>THIS IS THE PLUGIN UI</b>"); label->set_markup ("<b>THIS IS THE PLUGIN UI</b>");
if (editor && insert->plugin()->has_editor()) { if (editor && pib->plugin()->has_editor()) {
switch (insert->type()) { switch (pib->type()) {
case ARDOUR::Windows_VST: case ARDOUR::Windows_VST:
have_gui = create_windows_vst_editor (insert); have_gui = create_windows_vst_editor (pib);
break; break;
case ARDOUR::LXVST: case ARDOUR::LXVST:
have_gui = create_lxvst_editor (insert); have_gui = create_lxvst_editor (pib);
break; break;
case ARDOUR::MacVST: case ARDOUR::MacVST:
have_gui = create_mac_vst_editor (insert); have_gui = create_mac_vst_editor (pib);
break; break;
case ARDOUR::AudioUnit: case ARDOUR::AudioUnit:
have_gui = create_audiounit_editor (insert); have_gui = create_audiounit_editor (pib);
break; break;
case ARDOUR::LADSPA: case ARDOUR::LADSPA:
@ -145,11 +145,11 @@ PluginUIWindow::PluginUIWindow (
break; break;
case ARDOUR::LV2: case ARDOUR::LV2:
have_gui = create_lv2_editor (insert); have_gui = create_lv2_editor (pib);
break; break;
case ARDOUR::VST3: case ARDOUR::VST3:
have_gui = create_vst3_editor (insert); have_gui = create_vst3_editor (pib);
break; break;
default: default:
@ -166,7 +166,7 @@ PluginUIWindow::PluginUIWindow (
} }
if (!have_gui) { if (!have_gui) {
GenericPluginUI* pu = new GenericPluginUI (insert, scrollable); GenericPluginUI* pu = new GenericPluginUI (pib, scrollable);
_pluginui = pu; _pluginui = pu;
_pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
@ -180,7 +180,7 @@ PluginUIWindow::PluginUIWindow (
set_name ("PluginEditor"); set_name ("PluginEditor");
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
insert->DropReferences.connect (death_connection, invalidator (*this), boost::bind (&PluginUIWindow::plugin_going_away, this), gui_context()); pib->DropReferences.connect (death_connection, invalidator (*this), boost::bind (&PluginUIWindow::plugin_going_away, this), gui_context());
gint h = _pluginui->get_preferred_height (); gint h = _pluginui->get_preferred_height ();
gint w = _pluginui->get_preferred_width (); gint w = _pluginui->get_preferred_width ();
@ -260,9 +260,9 @@ PluginUIWindow::set_title(const std::string& title)
bool bool
#ifdef WINDOWS_VST_SUPPORT #ifdef WINDOWS_VST_SUPPORT
PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PluginInsert> insert) PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PlugInsertBase> pib)
#else #else
PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PluginInsert>) PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PlugInsertBase>)
#endif #endif
{ {
#ifndef WINDOWS_VST_SUPPORT #ifndef WINDOWS_VST_SUPPORT
@ -271,12 +271,12 @@ PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PluginInsert>)
boost::shared_ptr<WindowsVSTPlugin> vp; boost::shared_ptr<WindowsVSTPlugin> vp;
if ((vp = boost::dynamic_pointer_cast<WindowsVSTPlugin> (insert->plugin())) == 0) { if ((vp = boost::dynamic_pointer_cast<WindowsVSTPlugin> (pib->plugin())) == 0) {
error << string_compose (_("unknown type of editor-supplying plugin (note: no VST support in this version of %1)"), PROGRAM_NAME) error << string_compose (_("unknown type of editor-supplying plugin (note: no VST support in this version of %1)"), PROGRAM_NAME)
<< endmsg; << endmsg;
throw failed_constructor (); throw failed_constructor ();
} else { } else {
WindowsVSTPluginUI* vpu = new WindowsVSTPluginUI (insert, vp, GTK_WIDGET(this->gobj())); WindowsVSTPluginUI* vpu = new WindowsVSTPluginUI (pib, vp, GTK_WIDGET(this->gobj()));
_pluginui = vpu; _pluginui = vpu;
_pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
@ -290,9 +290,9 @@ PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PluginInsert>)
bool bool
#ifdef LXVST_SUPPORT #ifdef LXVST_SUPPORT
PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PluginInsert> insert) PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PlugInsertBase> pib)
#else #else
PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PluginInsert>) PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PlugInsertBase>)
#endif #endif
{ {
#ifndef LXVST_SUPPORT #ifndef LXVST_SUPPORT
@ -301,12 +301,12 @@ PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PluginInsert>)
boost::shared_ptr<LXVSTPlugin> lxvp; boost::shared_ptr<LXVSTPlugin> lxvp;
if ((lxvp = boost::dynamic_pointer_cast<LXVSTPlugin> (insert->plugin())) == 0) { if ((lxvp = boost::dynamic_pointer_cast<LXVSTPlugin> (pib->plugin())) == 0) {
error << string_compose (_("unknown type of editor-supplying plugin (note: no linuxVST support in this version of %1)"), PROGRAM_NAME) error << string_compose (_("unknown type of editor-supplying plugin (note: no linuxVST support in this version of %1)"), PROGRAM_NAME)
<< endmsg; << endmsg;
throw failed_constructor (); throw failed_constructor ();
} else { } else {
LXVSTPluginUI* lxvpu = new LXVSTPluginUI (insert, lxvp); LXVSTPluginUI* lxvpu = new LXVSTPluginUI (pib, lxvp);
_pluginui = lxvpu; _pluginui = lxvpu;
_pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
@ -320,21 +320,21 @@ PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PluginInsert>)
bool bool
#ifdef MACVST_SUPPORT #ifdef MACVST_SUPPORT
PluginUIWindow::create_mac_vst_editor (boost::shared_ptr<PluginInsert> insert) PluginUIWindow::create_mac_vst_editor (boost::shared_ptr<PlugInsertBase> pib)
#else #else
PluginUIWindow::create_mac_vst_editor (boost::shared_ptr<PluginInsert>) PluginUIWindow::create_mac_vst_editor (boost::shared_ptr<PlugInsertBase>)
#endif #endif
{ {
#ifndef MACVST_SUPPORT #ifndef MACVST_SUPPORT
return false; return false;
#else #else
boost::shared_ptr<MacVSTPlugin> mvst; boost::shared_ptr<MacVSTPlugin> mvst;
if ((mvst = boost::dynamic_pointer_cast<MacVSTPlugin> (insert->plugin())) == 0) { if ((mvst = boost::dynamic_pointer_cast<MacVSTPlugin> (pib->plugin())) == 0) {
error << string_compose (_("unknown type of editor-supplying plugin (note: no MacVST support in this version of %1)"), PROGRAM_NAME) error << string_compose (_("unknown type of editor-supplying plugin (note: no MacVST support in this version of %1)"), PROGRAM_NAME)
<< endmsg; << endmsg;
throw failed_constructor (); throw failed_constructor ();
} }
VSTPluginUI* vpu = create_mac_vst_gui (insert); VSTPluginUI* vpu = create_mac_vst_gui (pib);
_pluginui = vpu; _pluginui = vpu;
_pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
add (*vpu); add (*vpu);
@ -348,29 +348,29 @@ PluginUIWindow::create_mac_vst_editor (boost::shared_ptr<PluginInsert>)
bool bool
#ifdef VST3_SUPPORT #ifdef VST3_SUPPORT
PluginUIWindow::create_vst3_editor (boost::shared_ptr<PluginInsert> insert) PluginUIWindow::create_vst3_editor (boost::shared_ptr<PlugInsertBase> pib)
#else #else
PluginUIWindow::create_vst3_editor (boost::shared_ptr<PluginInsert>) PluginUIWindow::create_vst3_editor (boost::shared_ptr<PlugInsertBase>)
#endif #endif
{ {
#ifndef VST3_SUPPORT #ifndef VST3_SUPPORT
return false; return false;
#else #else
boost::shared_ptr<VST3Plugin> vst3; boost::shared_ptr<VST3Plugin> vst3;
if ((vst3 = boost::dynamic_pointer_cast<VST3Plugin> (insert->plugin())) == 0) { if ((vst3 = boost::dynamic_pointer_cast<VST3Plugin> (pib->plugin())) == 0) {
error << _("create_vst3_editor called on non-VST3 plugin") << endmsg; error << _("create_vst3_editor called on non-VST3 plugin") << endmsg;
throw failed_constructor (); throw failed_constructor ();
} else { } else {
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
VST3HWNDPluginUI* pui = new VST3HWNDPluginUI (insert, vst3); VST3HWNDPluginUI* pui = new VST3HWNDPluginUI (pib, vst3);
add (*pui); add (*pui);
#elif defined (__APPLE__) #elif defined (__APPLE__)
VBox* box; VBox* box;
VST3PluginUI* pui = create_mac_vst3_gui (insert, &box); VST3PluginUI* pui = create_mac_vst3_gui (pib, &box);
add (*box); add (*box);
Application::instance()->ActivationChanged.connect (mem_fun (*this, &PluginUIWindow::app_activated)); Application::instance()->ActivationChanged.connect (mem_fun (*this, &PluginUIWindow::app_activated));
#else #else
VST3X11PluginUI* pui = new VST3X11PluginUI (insert, vst3); VST3X11PluginUI* pui = new VST3X11PluginUI (pib, vst3);
add (*pui); add (*pui);
#endif #endif
_pluginui = pui; _pluginui = pui;
@ -384,16 +384,16 @@ PluginUIWindow::create_vst3_editor (boost::shared_ptr<PluginInsert>)
bool bool
#ifdef AUDIOUNIT_SUPPORT #ifdef AUDIOUNIT_SUPPORT
PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert> insert) PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PlugInsertBase> pib)
#else #else
PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert>) PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PlugInsertBase>)
#endif #endif
{ {
#ifndef AUDIOUNIT_SUPPORT #ifndef AUDIOUNIT_SUPPORT
return false; return false;
#else #else
VBox* box; VBox* box;
_pluginui = create_au_gui (insert, &box); _pluginui = create_au_gui (pib, &box);
_pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused)); _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
add (*box); add (*box);
@ -432,16 +432,16 @@ PluginUIWindow::app_activated (bool)
} }
bool bool
PluginUIWindow::create_lv2_editor(boost::shared_ptr<PluginInsert> insert) PluginUIWindow::create_lv2_editor(boost::shared_ptr<PlugInsertBase> pib)
{ {
#ifdef HAVE_SUIL #ifdef HAVE_SUIL
boost::shared_ptr<LV2Plugin> vp; boost::shared_ptr<LV2Plugin> vp;
if ((vp = boost::dynamic_pointer_cast<LV2Plugin> (insert->plugin())) == 0) { if ((vp = boost::dynamic_pointer_cast<LV2Plugin> (pib->plugin())) == 0) {
error << _("create_lv2_editor called on non-LV2 plugin") << endmsg; error << _("create_lv2_editor called on non-LV2 plugin") << endmsg;
throw failed_constructor (); throw failed_constructor ();
} else { } else {
LV2PluginUI* lpu = new LV2PluginUI (insert, vp); LV2PluginUI* lpu = new LV2PluginUI (pib, vp);
_pluginui = lpu; _pluginui = lpu;
add (*lpu); add (*lpu);
lpu->package (*this); lpu->package (*this);
@ -523,9 +523,9 @@ PluginUIWindow::plugin_going_away ()
death_connection.disconnect (); death_connection.disconnect ();
} }
PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi) PlugUIBase::PlugUIBase (boost::shared_ptr<PlugInsertBase> pib)
: insert (pi) : _pib (pib)
, plugin (insert->plugin()) , plugin (pib->plugin())
, _add_button (_("Add")) , _add_button (_("Add"))
, _save_button (_("Save")) , _save_button (_("Save"))
, _delete_button (_("Delete")) , _delete_button (_("Delete"))
@ -543,10 +543,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
, preset_gui (0) , preset_gui (0)
, preset_dialog (0) , preset_dialog (0)
{ {
bool for_auditioner = false; _pi = boost::dynamic_pointer_cast<ARDOUR::PluginInsert> (_pib); /* may be NULL */
if (insert->session().the_auditioner()) {
for_auditioner = insert->session().the_auditioner()->the_instrument() == insert;
}
_preset_modified.set_size_request (16, -1); _preset_modified.set_size_request (16, -1);
_preset_combo.set_text("(default)"); _preset_combo.set_text("(default)");
@ -593,15 +590,18 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
_pin_management_button.set_icon (ArdourIcon::PluginPinout); _pin_management_button.set_icon (ArdourIcon::PluginPinout);
_pin_management_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::manage_pins)); _pin_management_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::manage_pins));
insert->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&PlugUIBase::processor_active_changed, this, boost::weak_ptr<Processor>(insert)), gui_context());
_bypass_button.set_name ("plugin bypass button"); _bypass_button.set_name ("plugin bypass button");
_bypass_button.set_text (_("Bypass")); _bypass_button.set_text (_("Bypass"));
_bypass_button.set_icon (ArdourIcon::PluginBypass); _bypass_button.set_icon (ArdourIcon::PluginBypass);
_bypass_button.set_active (!pi->enabled ());
_bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release), false); _bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release), false);
if (_pi) {
_pi->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&PlugUIBase::processor_active_changed, this, boost::weak_ptr<Processor>(_pi)), gui_context());
_bypass_button.set_active (!_pi->enabled ());
} else {
_bypass_button.set_sensitive (false);
}
_focus_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::focus_toggled)); _focus_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::focus_toggled));
_focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); _focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
@ -624,18 +624,17 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
cpuload_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_cpuload_display)); cpuload_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_cpuload_display));
cpuload_expander.set_expanded(false); cpuload_expander.set_expanded(false);
insert->DropReferences.connect (death_connection, invalidator (*this), boost::bind (&PlugUIBase::plugin_going_away, this), gui_context()); _pib->DropReferences.connect (death_connection, invalidator (*this), boost::bind (&PlugUIBase::plugin_going_away, this), gui_context());
if (!for_auditioner) { /*auditioner can skip these signal-callbacks because these widgets are not shown anyway */ if (_pib->ui_elements () & PlugInsertBase::PluginPreset) {
plugin->PresetAdded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ()); plugin->PresetAdded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ());
plugin->PresetRemoved.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ()); plugin->PresetRemoved.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ());
plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::update_preset, this), gui_context ()); plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::update_preset, this), gui_context ());
plugin->PresetDirty.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::update_preset_modified, this), gui_context ()); plugin->PresetDirty.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::update_preset_modified, this), gui_context ());
}
insert->AutomationStateChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::automation_state_changed, this), gui_context()); if (_pi && _pi->ui_elements () != PlugInsertBase::NoGUIToolbar) {
_pi->AutomationStateChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::automation_state_changed, this), gui_context());
insert->LatencyChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::set_latency_label, this), gui_context()); _pi->LatencyChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::set_latency_label, this), gui_context());
automation_state_changed(); automation_state_changed();
} }
} }
@ -658,40 +657,56 @@ PlugUIBase::plugin_going_away ()
{ {
drop_connections (); drop_connections ();
/* drop references to the plugin/insert */ /* drop references to the plugin/insert */
insert.reset (); _pib.reset ();
_pi.reset ();
plugin.reset (); plugin.reset ();
} }
void void
PlugUIBase::add_common_widgets (Gtk::HBox* b, bool with_focus) PlugUIBase::add_common_widgets (Gtk::HBox* b, bool with_focus)
{ {
PlugInsertBase::UIElements const ui_elements = _pib->ui_elements ();
if (ui_elements == PlugInsertBase::NoGUIToolbar) {
return;
}
if (with_focus) { if (with_focus) {
b->pack_end (_focus_button, false, false); b->pack_end (_focus_button, false, false);
} }
if (ui_elements & PlugInsertBase::BypassEnable) {
b->pack_end (_bypass_button, false, false, with_focus ? 4 : 0); b->pack_end (_bypass_button, false, false, with_focus ? 4 : 0);
}
if (insert->controls().size() > 0) { if (_pib->controls().size() > 0) {
b->pack_end (_reset_button, false, false, 4); b->pack_end (_reset_button, false, false, 4);
} }
if (has_descriptive_presets ()) { if (has_descriptive_presets ()) {
b->pack_end (_preset_browser_button, false, false); b->pack_end (_preset_browser_button, false, false);
} }
if (ui_elements & PlugInsertBase::PluginPreset) {
b->pack_end (_delete_button, false, false); b->pack_end (_delete_button, false, false);
b->pack_end (_save_button, false, false); b->pack_end (_save_button, false, false);
b->pack_end (_add_button, false, false); b->pack_end (_add_button, false, false);
b->pack_end (_preset_combo, false, false); b->pack_end (_preset_combo, false, false);
b->pack_end (_preset_modified, false, false); b->pack_end (_preset_modified, false, false);
b->pack_end (_pin_management_button, false, false); }
if (_pi) {
b->pack_end (_pin_management_button, false, false);
b->pack_start (_latency_button, false, false, 4); b->pack_start (_latency_button, false, false, 4);
}
} }
void void
PlugUIBase::set_latency_label () PlugUIBase::set_latency_label ()
{ {
samplecnt_t const l = insert->effective_latency (); if (!_pi) {
float const sr = insert->session().sample_rate (); return;
}
samplecnt_t const l = _pi->effective_latency ();
float const sr = _pi->session().sample_rate ();
_latency_button.set_text (samples_as_time_string (l, sr, true)); _latency_button.set_text (samples_as_time_string (l, sr, true));
} }
@ -699,8 +714,9 @@ PlugUIBase::set_latency_label ()
void void
PlugUIBase::latency_button_clicked () PlugUIBase::latency_button_clicked ()
{ {
assert (_pi);
if (!latency_gui) { if (!latency_gui) {
latency_gui = new LatencyGUI (*(insert.get()), insert->session().sample_rate(), insert->session().get_block_size()); latency_gui = new LatencyGUI (*(_pi.get()), _pi->session().sample_rate(), _pi->session().get_block_size());
latency_dialog = new ArdourWindow (_("Edit Latency")); latency_dialog = new ArdourWindow (_("Edit Latency"));
/* use both keep-above and transient for to try cover as many /* use both keep-above and transient for to try cover as many
different WM's as possible. different WM's as possible.
@ -735,7 +751,7 @@ PlugUIBase::preset_selected (Plugin::PresetRecord preset)
return; return;
} }
if (!preset.label.empty()) { if (!preset.label.empty()) {
insert->load_preset (preset); _pib->load_preset (preset);
} else { } else {
// blank selected = no preset // blank selected = no preset
plugin->clear_preset(); plugin->clear_preset();
@ -786,19 +802,19 @@ PlugUIBase::delete_plugin_setting ()
void void
PlugUIBase::automation_state_changed () PlugUIBase::automation_state_changed ()
{ {
_reset_button.set_sensitive (insert->can_reset_all_parameters()); _reset_button.set_sensitive (_pib->can_reset_all_parameters());
} }
void void
PlugUIBase::reset_plugin_parameters () PlugUIBase::reset_plugin_parameters ()
{ {
insert->reset_parameters_to_default (); _pib->reset_parameters_to_default ();
} }
bool bool
PlugUIBase::has_descriptive_presets () const PlugUIBase::has_descriptive_presets () const
{ {
std::vector<Plugin::PresetRecord> presets = insert->plugin()->get_presets(); std::vector<Plugin::PresetRecord> presets = _pib->plugin()->get_presets();
for (std::vector<Plugin::PresetRecord>::const_iterator i = presets.begin(); i != presets.end(); ++i) { for (std::vector<Plugin::PresetRecord>::const_iterator i = presets.begin(); i != presets.end(); ++i) {
if (i->valid && !i->description.empty()) { if (i->valid && !i->description.empty()) {
return true; return true;
@ -810,6 +826,9 @@ PlugUIBase::has_descriptive_presets () const
void void
PlugUIBase::browse_presets () PlugUIBase::browse_presets ()
{ {
if (!_pi) {
return;
}
if (!preset_dialog) { if (!preset_dialog) {
if (preset_gui) { if (preset_gui) {
/* Do not allow custom window, if preset_gui is used. /* Do not allow custom window, if preset_gui is used.
@ -823,7 +842,7 @@ PlugUIBase::browse_presets ()
if (win) { if (win) {
preset_dialog->set_transient_for (*win); preset_dialog->set_transient_for (*win);
} }
preset_gui = new PluginPresetsUI (insert); preset_gui = new PluginPresetsUI (_pi);
preset_dialog->add (*preset_gui); preset_dialog->add (*preset_gui);
} }
preset_dialog->show_all (); preset_dialog->show_all ();
@ -832,7 +851,8 @@ PlugUIBase::browse_presets ()
void void
PlugUIBase::manage_pins () PlugUIBase::manage_pins ()
{ {
PluginPinWindowProxy* proxy = insert->pinmgr_proxy (); assert (_pi);
PluginPinWindowProxy* proxy = _pi->pinmgr_proxy ();
if (proxy) { if (proxy) {
proxy->get (true); proxy->get (true);
proxy->present (); proxy->present ();
@ -843,10 +863,11 @@ PlugUIBase::manage_pins ()
bool bool
PlugUIBase::bypass_button_release (GdkEventButton*) PlugUIBase::bypass_button_release (GdkEventButton*)
{ {
assert (_pi);
bool view_says_bypassed = (_bypass_button.active_state() != 0); bool view_says_bypassed = (_bypass_button.active_state() != 0);
if (view_says_bypassed != insert->enabled ()) { if (view_says_bypassed != _pi->enabled ()) {
insert->enable (view_says_bypassed); _pi->enable (view_says_bypassed);
} }
return false; return false;
@ -910,11 +931,12 @@ PlugUIBase::toggle_description()
void void
PlugUIBase::toggle_plugin_analysis() PlugUIBase::toggle_plugin_analysis()
{ {
assert (_pi);
if (plugin_analysis_expander.get_expanded() && if (plugin_analysis_expander.get_expanded() &&
!plugin_analysis_expander.get_child()) { !plugin_analysis_expander.get_child()) {
// Create the GUI // Create the GUI
if (eqgui == 0) { if (eqgui == 0) {
eqgui = new PluginEqGui (insert); eqgui = new PluginEqGui (_pi);
} }
plugin_analysis_expander.add (*eqgui); plugin_analysis_expander.add (*eqgui);
@ -944,7 +966,7 @@ PlugUIBase::toggle_cpuload_display()
{ {
if (cpuload_expander.get_expanded() && !cpuload_expander.get_child()) { if (cpuload_expander.get_expanded() && !cpuload_expander.get_child()) {
if (stats_gui == 0) { if (stats_gui == 0) {
stats_gui = new PluginLoadStatsGui (insert); stats_gui = new PluginLoadStatsGui (_pib);
} }
cpuload_expander.add (*stats_gui); cpuload_expander.add (*stats_gui);
cpuload_expander.show_all(); cpuload_expander.show_all();
@ -967,7 +989,6 @@ PlugUIBase::toggle_cpuload_display()
toplevel->resize (wr.width, wr.height); toplevel->resize (wr.width, wr.height);
} }
} }
} }
void void

View file

@ -64,6 +64,7 @@
namespace ARDOUR { namespace ARDOUR {
class PluginInsert; class PluginInsert;
class PlugInsertBase;
class Plugin; class Plugin;
class WindowsVSTPlugin; class WindowsVSTPlugin;
class LXVSTPlugin; class LXVSTPlugin;
@ -90,7 +91,7 @@ class VSTPluginUI;
class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionList class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionList
{ {
public: public:
PlugUIBase (boost::shared_ptr<ARDOUR::PluginInsert>); PlugUIBase (boost::shared_ptr<ARDOUR::PlugInsertBase>);
virtual ~PlugUIBase(); virtual ~PlugUIBase();
virtual gint get_preferred_height () = 0; virtual gint get_preferred_height () = 0;
@ -117,7 +118,8 @@ public:
sigc::signal<void,bool> KeyboardFocused; sigc::signal<void,bool> KeyboardFocused;
protected: protected:
boost::shared_ptr<ARDOUR::PluginInsert> insert; boost::shared_ptr<ARDOUR::PlugInsertBase> _pib;
boost::shared_ptr<ARDOUR::PluginInsert> _pi;
boost::shared_ptr<ARDOUR::Plugin> plugin; boost::shared_ptr<ARDOUR::Plugin> plugin;
void add_common_widgets (Gtk::HBox*, bool with_focus = true); void add_common_widgets (Gtk::HBox*, bool with_focus = true);
@ -208,7 +210,7 @@ private:
class GenericPluginUI : public PlugUIBase, public Gtk::VBox class GenericPluginUI : public PlugUIBase, public Gtk::VBox
{ {
public: public:
GenericPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> plug, bool scrollable=false); GenericPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase> plug, bool scrollable=false);
~GenericPluginUI (); ~GenericPluginUI ();
gint get_preferred_height () { return prefheight; } gint get_preferred_height () { return prefheight; }
@ -342,9 +344,9 @@ private:
class PluginUIWindow : public ArdourWindow class PluginUIWindow : public ArdourWindow
{ {
public: public:
PluginUIWindow (boost::shared_ptr<ARDOUR::PluginInsert> insert, PluginUIWindow (boost::shared_ptr<ARDOUR::PlugInsertBase>,
bool scrollable=false, bool scrollable = false,
bool editor=true); bool editor = true);
~PluginUIWindow (); ~PluginUIWindow ();
PlugUIBase& pluginui() { return *_pluginui; } PlugUIBase& pluginui() { return *_pluginui; }
@ -377,12 +379,12 @@ private:
void app_activated (bool); void app_activated (bool);
void plugin_going_away (); void plugin_going_away ();
bool create_windows_vst_editor (boost::shared_ptr<ARDOUR::PluginInsert>); bool create_windows_vst_editor (boost::shared_ptr<ARDOUR::PlugInsertBase>);
bool create_lxvst_editor(boost::shared_ptr<ARDOUR::PluginInsert>); bool create_lxvst_editor(boost::shared_ptr<ARDOUR::PlugInsertBase>);
bool create_mac_vst_editor(boost::shared_ptr<ARDOUR::PluginInsert>); bool create_mac_vst_editor(boost::shared_ptr<ARDOUR::PlugInsertBase>);
bool create_audiounit_editor (boost::shared_ptr<ARDOUR::PluginInsert>); bool create_audiounit_editor (boost::shared_ptr<ARDOUR::PlugInsertBase>);
bool create_lv2_editor (boost::shared_ptr<ARDOUR::PluginInsert>); bool create_lv2_editor (boost::shared_ptr<ARDOUR::PlugInsertBase>);
bool create_vst3_editor (boost::shared_ptr<ARDOUR::PluginInsert>); bool create_vst3_editor (boost::shared_ptr<ARDOUR::PlugInsertBase>);
static PluginUIWindow* the_plugin_window; static PluginUIWindow* the_plugin_window;
}; };
@ -391,12 +393,12 @@ private:
/* this function has to be in a .mm file /* this function has to be in a .mm file
* because MacVSTPluginUI has Cocoa members * because MacVSTPluginUI has Cocoa members
*/ */
extern VSTPluginUI* create_mac_vst_gui (boost::shared_ptr<ARDOUR::PluginInsert>); extern VSTPluginUI* create_mac_vst_gui (boost::shared_ptr<ARDOUR::PlugInsertBase>);
#endif #endif
#ifdef AUDIOUNIT_SUPPORT #ifdef AUDIOUNIT_SUPPORT
/* this function has to be in a .mm file */ /* this function has to be in a .mm file */
extern PlugUIBase* create_au_gui (boost::shared_ptr<ARDOUR::PluginInsert>, Gtk::VBox**); extern PlugUIBase* create_au_gui (boost::shared_ptr<ARDOUR::PlugInsertBase>, Gtk::VBox**);
#endif #endif
#endif /* __ardour_plugin_ui_h__ */ #endif /* __ardour_plugin_ui_h__ */

View file

@ -24,7 +24,6 @@
#include "pbd/unwind.h" #include "pbd/unwind.h"
#include "ardour/plugin_insert.h"
#include "ardour/vst3_plugin.h" #include "ardour/vst3_plugin.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
@ -37,8 +36,8 @@ using namespace ARDOUR;
using namespace Steinberg; using namespace Steinberg;
VST3HWNDPluginUI::VST3HWNDPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VST3Plugin> vst3) VST3HWNDPluginUI::VST3HWNDPluginUI (boost::shared_ptr<PlugInsertBase> pib, boost::shared_ptr<VST3Plugin> vst3)
: VST3PluginUI (pi, vst3) : VST3PluginUI (pib, vst3)
{ {
/* TODO register window class, implement wndproc etc */ /* TODO register window class, implement wndproc etc */

View file

@ -29,7 +29,7 @@
class VST3HWNDPluginUI : public VST3PluginUI class VST3HWNDPluginUI : public VST3PluginUI
{ {
public: public:
VST3HWNDPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VST3Plugin>); VST3HWNDPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>, boost::shared_ptr<ARDOUR::VST3Plugin>);
~VST3HWNDPluginUI (); ~VST3HWNDPluginUI ();
bool on_window_show(const std::string&); bool on_window_show(const std::string&);

View file

@ -43,7 +43,7 @@
class VST3NSViewPluginUI : public VST3PluginUI class VST3NSViewPluginUI : public VST3PluginUI
{ {
public: public:
VST3NSViewPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VST3Plugin>); VST3NSViewPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>, boost::shared_ptr<ARDOUR::VST3Plugin>);
~VST3NSViewPluginUI (); ~VST3NSViewPluginUI ();
bool on_window_show(const std::string&); bool on_window_show(const std::string&);

View file

@ -28,7 +28,7 @@
#include "pbd/error.h" #include "pbd/error.h"
#include "pbd/unwind.h" #include "pbd/unwind.h"
#include "ardour/plugin_insert.h" #include "ardour/plug_insert_base.h"
#include "ardour/vst3_plugin.h" #include "ardour/vst3_plugin.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
@ -43,16 +43,16 @@ using namespace ARDOUR;
using namespace Steinberg; using namespace Steinberg;
VST3PluginUI* VST3PluginUI*
create_mac_vst3_gui (boost::shared_ptr<PluginInsert> plugin_insert, Gtk::VBox** box) create_mac_vst3_gui (boost::shared_ptr<PlugInsertBase> pib, Gtk::VBox** box)
{ {
VST3NSViewPluginUI* v = new VST3NSViewPluginUI (plugin_insert, boost::dynamic_pointer_cast<VST3Plugin> (plugin_insert->plugin())); VST3NSViewPluginUI* v = new VST3NSViewPluginUI (pib, boost::dynamic_pointer_cast<VST3Plugin> (pib->plugin()));
*box = v; *box = v;
return v; return v;
} }
VST3NSViewPluginUI::VST3NSViewPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VST3Plugin> vst3) VST3NSViewPluginUI::VST3NSViewPluginUI (boost::shared_ptr<PlugInsertBase> pib, boost::shared_ptr<VST3Plugin> vst3)
: VST3PluginUI (pi, vst3) : VST3PluginUI (pib, vst3)
{ {
pack_start (_gui_widget, true, true); pack_start (_gui_widget, true, true);

View file

@ -18,9 +18,8 @@
#include <glibmm/main.h> #include <glibmm/main.h>
#include "ardour/auditioner.h" #include "ardour/plug_insert_base.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/plugin_insert.h"
#include "ardour/vst3_plugin.h" #include "ardour/vst3_plugin.h"
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
@ -36,9 +35,8 @@ using namespace Steinberg;
DEF_CLASS_IID (Presonus::IPlugInViewScaling) DEF_CLASS_IID (Presonus::IPlugInViewScaling)
#endif #endif
VST3PluginUI::VST3PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VST3Plugin> vst3) VST3PluginUI::VST3PluginUI (boost::shared_ptr<PlugInsertBase> pib, boost::shared_ptr<VST3Plugin> vst3)
: PlugUIBase (pi) : PlugUIBase (pib)
, _pi (pi)
, _vst3 (vst3) , _vst3 (vst3)
, _req_width (0) , _req_width (0)
, _req_height (0) , _req_height (0)
@ -48,16 +46,10 @@ VST3PluginUI::VST3PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_pt
_ardour_buttons_box.set_spacing (6); _ardour_buttons_box.set_spacing (6);
_ardour_buttons_box.set_border_width (6); _ardour_buttons_box.set_border_width (6);
bool for_auditioner =false;
if (insert->session().the_auditioner()) {
for_auditioner = insert->session().the_auditioner()->the_instrument() == insert;
}
if (!for_auditioner) {
add_common_widgets (&_ardour_buttons_box); add_common_widgets (&_ardour_buttons_box);
}
_vst3->OnResizeView.connect (_resize_connection, invalidator (*this), boost::bind (&VST3PluginUI::resize_callback, this, _1, _2), gui_context()); _vst3->OnResizeView.connect (_resize_connection, invalidator (*this), boost::bind (&VST3PluginUI::resize_callback, this, _1, _2), gui_context());
//pi->plugin()->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&VST3PluginUI::queue_port_update, this), gui_context ()); //pib->plugin()->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&VST3PluginUI::queue_port_update, this), gui_context ());
pack_start (_ardour_buttons_box, false, false); pack_start (_ardour_buttons_box, false, false);
_ardour_buttons_box.show_all (); _ardour_buttons_box.show_all ();

View file

@ -24,14 +24,14 @@
#include "plugin_ui.h" #include "plugin_ui.h"
namespace ARDOUR { namespace ARDOUR {
class PluginInsert; class PlugInsertBase;
class VST3Plugin; class VST3Plugin;
} }
class VST3PluginUI : public PlugUIBase, public Gtk::VBox class VST3PluginUI : public PlugUIBase, public Gtk::VBox
{ {
public: public:
VST3PluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VST3Plugin>); VST3PluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>, boost::shared_ptr<ARDOUR::VST3Plugin>);
virtual ~VST3PluginUI (); virtual ~VST3PluginUI ();
gint get_preferred_height (); gint get_preferred_height ();
@ -49,7 +49,6 @@ protected:
bool forward_scroll_event (GdkEventScroll*); bool forward_scroll_event (GdkEventScroll*);
boost::shared_ptr<ARDOUR::PluginInsert> _pi;
boost::shared_ptr<ARDOUR::VST3Plugin> _vst3; boost::shared_ptr<ARDOUR::VST3Plugin> _vst3;
Gtk::HBox _ardour_buttons_box; Gtk::HBox _ardour_buttons_box;

View file

@ -178,8 +178,8 @@ private:
VST3X11Runloop static_runloop; VST3X11Runloop static_runloop;
VST3X11PluginUI::VST3X11PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VST3Plugin> vst3) VST3X11PluginUI::VST3X11PluginUI (boost::shared_ptr<PlugInsertBase> pib, boost::shared_ptr<VST3Plugin> vst3)
: VST3PluginUI (pi, vst3) : VST3PluginUI (pib, vst3)
//, _runloop (new VST3X11Runloop) //, _runloop (new VST3X11Runloop)
{ {
_vst3->set_runloop (&static_runloop); _vst3->set_runloop (&static_runloop);

View file

@ -29,7 +29,7 @@
class VST3X11PluginUI : public VST3PluginUI class VST3X11PluginUI : public VST3PluginUI
{ {
public: public:
VST3X11PluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VST3Plugin>); VST3X11PluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>, boost::shared_ptr<ARDOUR::VST3Plugin>);
~VST3X11PluginUI (); ~VST3X11PluginUI ();
bool on_window_show(const std::string&); bool on_window_show(const std::string&);

View file

@ -35,21 +35,15 @@
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#endif #endif
VSTPluginUI::VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> insert, boost::shared_ptr<ARDOUR::VSTPlugin> plugin) VSTPluginUI::VSTPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase> pib, boost::shared_ptr<ARDOUR::VSTPlugin> plugin)
: PlugUIBase (insert) : PlugUIBase (pib)
, _vst (plugin) , _vst (plugin)
{ {
Gtk::HBox* box = manage (new Gtk::HBox); Gtk::HBox* box = manage (new Gtk::HBox);
box->set_spacing (6); box->set_spacing (6);
box->set_border_width (6); box->set_border_width (6);
bool for_auditioner =false;
if (insert->session().the_auditioner()) {
for_auditioner = insert->session().the_auditioner()->the_instrument() == insert;
}
if (!for_auditioner) {
add_common_widgets (box); add_common_widgets (box);
}
pack_start (*box, false, false); pack_start (*box, false, false);
box->signal_size_allocate().connect (sigc::mem_fun (*this, &VSTPluginUI::top_box_allocated)); box->signal_size_allocate().connect (sigc::mem_fun (*this, &VSTPluginUI::top_box_allocated));

View file

@ -28,7 +28,7 @@ namespace ARDOUR {
class VSTPluginUI : public PlugUIBase, public Gtk::VBox class VSTPluginUI : public PlugUIBase, public Gtk::VBox
{ {
public: public:
VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VSTPlugin>); VSTPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>, boost::shared_ptr<ARDOUR::VSTPlugin>);
virtual ~VSTPluginUI (); virtual ~VSTPluginUI ();
virtual int get_preferred_height (); virtual int get_preferred_height ();

View file

@ -22,7 +22,7 @@
#include <gtk/gtksocket.h> #include <gtk/gtksocket.h>
#include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/gui_thread.h"
#include "fst.h" #include "fst.h"
#include "ardour/plugin_insert.h" #include "ardour/plug_insert_base.h"
#include "ardour/windows_vst_plugin.h" #include "ardour/windows_vst_plugin.h"
#include "windows_vst_plugin_ui.h" #include "windows_vst_plugin_ui.h"
@ -39,8 +39,8 @@ using namespace Gtk;
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD; using namespace PBD;
WindowsVSTPluginUI::WindowsVSTPluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<VSTPlugin> vp, GtkWidget *parent) WindowsVSTPluginUI::WindowsVSTPluginUI (boost::shared_ptr<PlugInsertBase> pib, boost::shared_ptr<VSTPlugin> vp, GtkWidget *parent)
: VSTPluginUI (pi, vp) : VSTPluginUI (pib, vp)
{ {
#ifdef GDK_WINDOWING_WIN32 #ifdef GDK_WINDOWING_WIN32

View file

@ -26,7 +26,7 @@
class WindowsVSTPluginUI : public VSTPluginUI class WindowsVSTPluginUI : public VSTPluginUI
{ {
public: public:
WindowsVSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert>, boost::shared_ptr<ARDOUR::VSTPlugin>, GtkWidget *parent); WindowsVSTPluginUI (boost::shared_ptr<ARDOUR::PlugInsertBase>, boost::shared_ptr<ARDOUR::VSTPlugin>, GtkWidget *parent);
~WindowsVSTPluginUI (); ~WindowsVSTPluginUI ();
bool start_updating (GdkEventAny*) { return false; } bool start_updating (GdkEventAny*) { return false; }