From 8e747504412c62f27c599f3f5e001ff3e2e36a82 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 20 Sep 2007 02:43:59 +0000 Subject: Fix voice-specific polyphony controls. Restore patch polyphony correctly on client reattach. Fix crash on multiple polyphony changes w/ LV2 plugins. git-svn-id: http://svn.drobilla.net/lad/ingen@737 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/ControlPanel.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/libs/gui/ControlPanel.cpp') diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp index 5a4fbb95..be524814 100644 --- a/src/libs/gui/ControlPanel.cpp +++ b/src/libs/gui/ControlPanel.cpp @@ -39,9 +39,11 @@ ControlPanel::ControlPanel(BaseObjectType* cobject, const Glib::RefPtrget_widget("control_panel_specific_voice_radio", _specific_voice_radio); xml->get_widget("control_panel_voice_spinbutton", _voice_spinbutton); - _all_voices_radio->signal_toggled().connect(sigc::mem_fun(this, &ControlPanel::all_voices_selected)); - _specific_voice_radio->signal_toggled().connect(sigc::mem_fun(this, &ControlPanel::specific_voice_selected)); - _voice_spinbutton->signal_value_changed().connect(sigc::mem_fun(this, &ControlPanel::voice_selected)); + _all_voices_radio->signal_toggled().connect( + sigc::mem_fun(this, &ControlPanel::all_voices_selected)); + + _specific_voice_radio->signal_toggled().connect( + sigc::mem_fun(this, &ControlPanel::specific_voice_selected)); show_all(); } @@ -60,15 +62,23 @@ ControlPanel::init(SharedPtr node, uint32_t poly) assert(node != NULL); assert(poly > 0); - if (poly > 1) { + if (node->polyphonic()) { _voice_spinbutton->set_range(0, poly - 1); + _voice_control_box->show(); } else { - remove(*_voice_control_box); + //remove(*_voice_control_box); + _voice_control_box->hide(); } for (PortModelList::const_iterator i = node->ports().begin(); i != node->ports().end(); ++i) { add_port(*i); } + + if (node->parent()) + ((PatchModel*)node->parent().get())->signal_polyphony.connect( + sigc::mem_fun(this, &ControlPanel::polyphony_changed)); + else + cerr << "[ControlPanel] No parent, polyphonic controls disabled" << endl; _callback_enabled = true; } @@ -254,8 +264,10 @@ ControlPanel::specific_voice_selected() void -ControlPanel::voice_selected() +ControlPanel::polyphony_changed(uint32_t poly) { + cerr << "POLY CHANGED" << endl; + _voice_spinbutton->set_range(0, poly - 1); } -- cgit v1.2.1