diff options
-rw-r--r-- | ingen/client/BlockModel.hpp | 1 | ||||
-rw-r--r-- | src/client/BlockModel.cpp | 6 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 27 | ||||
-rw-r--r-- | src/gui/NodeModule.hpp | 1 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 2 | ||||
-rw-r--r-- | src/server/events/CreateBlock.cpp | 7 |
6 files changed, 33 insertions, 11 deletions
diff --git a/ingen/client/BlockModel.hpp b/ingen/client/BlockModel.hpp index b5db2b0d..2a1a6f5d 100644 --- a/ingen/client/BlockModel.hpp +++ b/ingen/client/BlockModel.hpp @@ -53,6 +53,7 @@ public: typedef std::vector< SPtr<const PortModel> > Ports; SPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; + SPtr<const PortModel> get_port(uint32_t index) const; Node* port(uint32_t index) const; diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index 2c389f90..f667cb3c 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -149,6 +149,12 @@ BlockModel::get_port(const Raul::Symbol& symbol) const return SPtr<PortModel>(); } +SPtr<const PortModel> +BlockModel::get_port(uint32_t index) const +{ + return _ports[index]; +} + Ingen::Node* BlockModel::port(uint32_t index) const { diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index e0509c51..a03c1693 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -170,12 +170,29 @@ NodeModule::port_activity(uint32_t index, const Atom& value) return; } + if (_block->get_port(index)->is_a(Raul::URI(LV2_ATOM__AtomPort))) { + _plugin_ui->port_event(index, + lv2_atom_total_size(value.atom()), + uris.atom_eventTransfer, + value.atom()); + } +} + +void +NodeModule::port_value_changed(uint32_t index, const Atom& value) +{ + const URIs& uris = app().uris(); + if (!_plugin_ui) { + return; + } + if (value.type() == uris.atom_Float) { _plugin_ui->port_event(index, sizeof(float), 0, value.ptr<float>()); } else { - const LV2_Atom* const atom = value.atom(); - _plugin_ui->port_event( - index, lv2_atom_total_size(atom), uris.atom_eventTransfer, atom); + _plugin_ui->port_event(index, + lv2_atom_total_size(value.atom()), + uris.atom_eventTransfer, + value.atom()); } } @@ -249,7 +266,7 @@ NodeModule::new_port_view(SPtr<const PortModel> port) app().world()->conf().option("human-names").get<int32_t>()); port->signal_value_changed().connect( - sigc::bind<0>(sigc::mem_fun(this, &NodeModule::port_activity), + sigc::bind<0>(sigc::mem_fun(this, &NodeModule::port_value_changed), port->index())); port->signal_activity().connect( @@ -336,7 +353,7 @@ NodeModule::set_control_values() uint32_t index = 0; for (const auto& p : _block->ports()) { if (app().can_control(p.get())) { - port_activity(index, p->value()); + port_value_changed(index, p->value()); } ++index; } diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index 1092cdf3..e38859ef 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -83,6 +83,7 @@ protected: void new_port_view(SPtr<const Client::PortModel> port); void port_activity(uint32_t index, const Atom& value); + void port_value_changed(uint32_t index, const Atom& value); void plugin_changed(); void set_control_values(); diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index b3590d1f..29b6e044 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -86,7 +86,7 @@ PortImpl::PortImpl(BufferFactory& bufs, add_property(uris.rdf_type, bufs.forge().alloc_uri(type.uri())); set_property(uris.lv2_index, bufs.forge().make((int32_t)index)); - if (value.is_valid()) { + if ((type == PortType::CONTROL || type == PortType::CV) && value.is_valid()) { set_property(uris.ingen_value, value); } if (type == PortType::ATOM) { diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 8caa3bf6..77c0255d 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -116,11 +116,8 @@ CreateBlock::pre_process() _update.push_back(make_pair(_block->uri(), _block->properties())); for (uint32_t i = 0; i < _block->num_ports(); ++i) { - const PortImpl* port = _block->port_impl(i); - Resource::Properties pprops = port->properties(); - pprops.erase(uris.ingen_value); - pprops.insert(std::make_pair(uris.ingen_value, port->value())); - _update.push_back(std::make_pair(port->uri(), pprops)); + const PortImpl* port = _block->port_impl(i); + _update.push_back(std::make_pair(port->uri(), port->properties())); } return Event::pre_process_done(Status::SUCCESS); |