From 1c746982c4d1b18308ce549852d8ecd83d612db5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 20 May 2008 00:30:50 +0000 Subject: Fix various problems with control port values. Fix control port feedback issues with LV2 plugin UIs. git-svn-id: http://svn.drobilla.net/lad/ingen@1218 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/ConnectWindow.cpp | 2 ++ src/libs/gui/ControlGroups.cpp | 2 +- src/libs/gui/NodeModule.cpp | 1 - src/libs/gui/Port.cpp | 15 +++++++++------ src/libs/gui/Port.hpp | 4 ++-- src/libs/gui/UploadPatchWindow.cpp | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src/libs/gui') diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index 11da988d..7bf34c01 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -155,6 +155,8 @@ ConnectWindow::set_connected_to(SharedPtr engine) _progress_label->set_text(string("Disconnected")); } + + App::instance().world()->engine = engine.get(); } diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp index 114bb79d..f0f5aa13 100644 --- a/src/libs/gui/ControlGroups.cpp +++ b/src/libs/gui/ControlGroups.cpp @@ -249,7 +249,7 @@ SliderControlGroup::update_value_from_slider() if (_port_model->is_integer()) { value = lrintf(value); - if (value == lrintf(_port_model->value())) + if (value == lrintf(_port_model->value().get_float())) change = false; } diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index b3b191d1..cabea96a 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -110,7 +110,6 @@ void NodeModule::value_changed(uint32_t index, const Atom& value) { float control = value.get_float(); - cout << _node->name() << " control " << index << " = " << control << endl; if (_plugin_ui) { SLV2UIInstance inst = _plugin_ui->instance(); const LV2UI_Descriptor* ui_descriptor = slv2_ui_instance_get_descriptor(inst); diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp index 225ab7ab..df0b779c 100644 --- a/src/libs/gui/Port.cpp +++ b/src/libs/gui/Port.cpp @@ -62,13 +62,13 @@ Port::Port(boost::shared_ptr module, SharedPtr pm set_control_min(min); set_control_max(max); - pm->signal_variable.connect(sigc::mem_fun(this, &Port::variable_change)); - _port_model->signal_value_changed.connect(sigc::mem_fun(this, &Port::control_changed)); + pm->signal_variable.connect(sigc::mem_fun(this, &Port::variable_changed)); + _port_model->signal_value_changed.connect(sigc::mem_fun(this, &Port::value_changed)); } _port_model->signal_activity.connect(sigc::mem_fun(this, &Port::activity)); - control_changed(_port_model->value()); + value_changed(_port_model->value()); } @@ -92,9 +92,12 @@ Port::renamed() void -Port::control_changed(float value) +Port::value_changed(const Atom& value) { - FlowCanvas::Port::set_control(value); + if (value.type() == Atom::FLOAT) + FlowCanvas::Port::set_control(value.get_float()); + else + cerr << "WARNING: Unknown port value type " << (unsigned)value.type() << endl; } @@ -120,7 +123,7 @@ Port::set_control(float value, bool signal) void -Port::variable_change(const string& key, const Atom& value) +Port::variable_changed(const string& key, const Atom& value) { if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) set_control_min(value.get_float()); diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp index 5748f4c7..e14110e7 100644 --- a/src/libs/gui/Port.hpp +++ b/src/libs/gui/Port.hpp @@ -47,12 +47,12 @@ public: void create_menu(); virtual void set_control(float value, bool signal); - void control_changed(float value); + void value_changed(const Raul::Atom& value); void activity(); private: - void variable_change(const std::string& key, const Raul::Atom& value); + void variable_changed(const std::string& key, const Raul::Atom& value); void renamed(); diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp index c69ce7f3..16fa0665 100644 --- a/src/libs/gui/UploadPatchWindow.cpp +++ b/src/libs/gui/UploadPatchWindow.cpp @@ -75,11 +75,11 @@ UploadPatchWindow::on_show() Gtk::Dialog::on_show(); Raul::Atom atom = _patch->get_variable("lv2:symbol"); - if (atom) + if (atom.is_valid()) _symbol_entry->set_text(atom.get_string()); atom = _patch->get_variable("doap:name"); - if (atom) + if (atom.is_valid()) _short_name_entry->set_text(atom.get_string()); } -- cgit v1.2.1