diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/DuplexPort.cpp | 34 | ||||
-rw-r--r-- | src/server/DuplexPort.hpp | 4 | ||||
-rw-r--r-- | src/server/InputPort.hpp | 2 | ||||
-rw-r--r-- | src/server/PortImpl.cpp | 6 | ||||
-rw-r--r-- | src/server/PortImpl.hpp | 10 | ||||
-rw-r--r-- | src/server/events/Connect.cpp | 11 | ||||
-rw-r--r-- | src/server/events/Connect.hpp | 4 | ||||
-rw-r--r-- | src/server/internals/Controller.cpp | 2 | ||||
-rw-r--r-- | src/server/internals/Note.cpp | 2 | ||||
-rw-r--r-- | src/server/internals/Trigger.cpp | 2 |
10 files changed, 70 insertions, 7 deletions
diff --git a/src/server/DuplexPort.cpp b/src/server/DuplexPort.cpp index 6049e001..0e19e939 100644 --- a/src/server/DuplexPort.cpp +++ b/src/server/DuplexPort.cpp @@ -53,6 +53,40 @@ DuplexPort::~DuplexPort() } } +void +DuplexPort::inherit_neighbour(const PortImpl* port, + Resource::Properties& remove, + Resource::Properties& add) +{ + /* TODO: This needs to become more sophisticated, and correct the situation + if the port is disconnected. */ + if (_type == PortType::CONTROL || _type == PortType::CV) { + if (port->minimum().get<float>() < _min.get<float>()) { + _min = port->minimum(); + remove.insert(std::make_pair(_bufs.uris().lv2_minimum, + Property(_bufs.uris().wildcard))); + add.insert(std::make_pair(_bufs.uris().lv2_minimum, + port->minimum())); + } + if (port->maximum().get<float>() > _max.get<float>()) { + _max = port->maximum(); + remove.insert(std::make_pair(_bufs.uris().lv2_maximum, + Property(_bufs.uris().wildcard))); + add.insert(std::make_pair(_bufs.uris().lv2_maximum, + port->maximum())); + } + } else if (_type == PortType::ATOM) { + for (Resource::Properties::const_iterator i = port->properties().find( + _bufs.uris().atom_supports); + i != port->properties().end() && + i->first == _bufs.uris().atom_supports; + ++i) { + set_property(i->first, i->second); + add.insert(*i); + } + } +} + bool DuplexPort::get_buffers(BufferFactory& bufs, Raul::Array<BufferRef>* buffers, diff --git a/src/server/DuplexPort.hpp b/src/server/DuplexPort.hpp index a7ad58bd..725c09c7 100644 --- a/src/server/DuplexPort.hpp +++ b/src/server/DuplexPort.hpp @@ -56,6 +56,10 @@ public: virtual ~DuplexPort(); + void inherit_neighbour(const PortImpl* port, + Resource::Properties& remove, + Resource::Properties& add); + uint32_t max_tail_poly(Context& context) const; bool get_buffers(BufferFactory& bufs, diff --git a/src/server/InputPort.hpp b/src/server/InputPort.hpp index d1082b71..43a182e4 100644 --- a/src/server/InputPort.hpp +++ b/src/server/InputPort.hpp @@ -71,7 +71,7 @@ public: void add_arc(ProcessContext& context, ArcImpl* c); ArcImpl* remove_arc(ProcessContext& context, - const OutputPort* tail); + const OutputPort* tail); bool apply_poly(ProcessContext& context, Raul::Maid& maid, uint32_t poly); diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index 29b6e044..0fc73649 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -92,12 +92,6 @@ PortImpl::PortImpl(BufferFactory& bufs, if (type == PortType::ATOM) { add_property(uris.atom_bufferType, bufs.forge().make_urid(buffer_type)); - if (block->graph_type() == Ingen::Node::GraphType::GRAPH) { - add_property(uris.atom_supports, - bufs.forge().make_urid(uris.midi_MidiEvent)); - add_property(uris.atom_supports, - bufs.forge().make_urid(uris.time_Position)); - } } } diff --git a/src/server/PortImpl.hpp b/src/server/PortImpl.hpp index c980a134..8e6c8e77 100644 --- a/src/server/PortImpl.hpp +++ b/src/server/PortImpl.hpp @@ -122,6 +122,16 @@ public: void activate(BufferFactory& bufs); void deactivate(); + /** + Inherit any properties from a connected neighbour. + + This is used for Graph ports, so e.g. a control input has the range of + all the ports it is connected to. + */ + virtual void inherit_neighbour(const PortImpl* port, + Resource::Properties& remove, + Resource::Properties& add) {} + virtual void connect_buffers(); virtual void recycle_buffers(); diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index 4c4a3974..75659452 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -124,6 +124,9 @@ Connect::pre_process() _graph->add_arc(_arc); _head->increment_num_arcs(); + + tail_output->inherit_neighbour(_head, _tail_remove, _tail_add); + _head->inherit_neighbour(tail_output, _head_remove, _head_add); } _buffers = new Raul::Array<BufferRef>(_head->poly()); @@ -156,6 +159,14 @@ Connect::post_process() Broadcaster::Transfer t(*_engine.broadcaster()); if (respond() == Status::SUCCESS) { _engine.broadcaster()->connect(_tail_path, _head_path); + if (!_tail_remove.empty() || !_tail_add.empty()) { + _engine.broadcaster()->delta( + Node::path_to_uri(_tail_path), _tail_remove, _tail_add); + } + if (!_tail_remove.empty() || !_tail_add.empty()) { + _engine.broadcaster()->delta( + Node::path_to_uri(_tail_path), _tail_remove, _tail_add); + } } } diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp index 4b515087..d5e58a99 100644 --- a/src/server/events/Connect.hpp +++ b/src/server/events/Connect.hpp @@ -64,6 +64,10 @@ private: CompiledGraph* _compiled_graph; SPtr<ArcImpl> _arc; Raul::Array<BufferRef>* _buffers; + Resource::Properties _tail_remove; + Resource::Properties _tail_add; + Resource::Properties _head_remove; + Resource::Properties _head_add; }; } // namespace Events diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp index dd693eb3..5ac37df4 100644 --- a/src/server/internals/Controller.cpp +++ b/src/server/internals/Controller.cpp @@ -56,6 +56,8 @@ ControllerNode::ControllerNode(InternalPlugin* plugin, _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, PortType::ATOM, uris.atom_Sequence, Atom()); _midi_in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); + _midi_in_port->set_property(uris.atom_supports, + bufs.forge().make_urid(uris.midi_MidiEvent)); _ports->at(0) = _midi_in_port; _param_port = new InputPort(bufs, this, Raul::Symbol("controller"), 1, 1, diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index f7d0e16c..a1da9f2f 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -63,6 +63,8 @@ NoteNode::NoteNode(InternalPlugin* plugin, _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, PortType::ATOM, uris.atom_Sequence, Atom()); _midi_in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); + _midi_in_port->set_property(uris.atom_supports, + bufs.forge().make_urid(uris.midi_MidiEvent)); _ports->at(0) = _midi_in_port; _freq_port = new OutputPort(bufs, this, Raul::Symbol("frequency"), 1, _polyphony, diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp index 78f87b34..abef29ca 100644 --- a/src/server/internals/Trigger.cpp +++ b/src/server/internals/Trigger.cpp @@ -56,6 +56,8 @@ TriggerNode::TriggerNode(InternalPlugin* plugin, _midi_in_port = new InputPort(bufs, this, Raul::Symbol("input"), 0, 1, PortType::ATOM, uris.atom_Sequence, Atom()); _midi_in_port->set_property(uris.lv2_name, bufs.forge().alloc("Input")); + _midi_in_port->set_property(uris.atom_supports, + bufs.forge().make_urid(uris.midi_MidiEvent)); _ports->at(0) = _midi_in_port; _note_port = new InputPort(bufs, this, Raul::Symbol("note"), 1, 1, |