diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/engine/GraphObjectImpl.hpp | 2 | ||||
-rw-r--r-- | src/libs/engine/OSCClientSender.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/ObjectSender.cpp | 3 | ||||
-rw-r--r-- | src/libs/engine/PortImpl.cpp | 12 | ||||
-rw-r--r-- | src/libs/engine/PortImpl.hpp | 2 | ||||
-rw-r--r-- | src/libs/engine/events/SetPolyphonicEvent.cpp | 13 | ||||
-rw-r--r-- | src/libs/engine/events/SetPolyphonicEvent.hpp | 1 |
7 files changed, 28 insertions, 7 deletions
diff --git a/src/libs/engine/GraphObjectImpl.hpp b/src/libs/engine/GraphObjectImpl.hpp index dc833b08..8563035b 100644 --- a/src/libs/engine/GraphObjectImpl.hpp +++ b/src/libs/engine/GraphObjectImpl.hpp @@ -53,7 +53,7 @@ public: virtual ~GraphObjectImpl() {} bool polyphonic() const { return _polyphonic; } - virtual void set_polyphonic(Raul::Maid& maid, bool p) { _polyphonic = p; } + virtual bool set_polyphonic(Raul::Maid& maid, bool p) { _polyphonic = p; return true; } GraphObject* graph_parent() const { return _parent; } diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 53ff35e5..365efeea 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -285,7 +285,7 @@ void OSCClientSender::new_node(const std::string& plugin_uri, void OSCClientSender::new_port(const std::string& path, const std::string& data_type, - bool is_output) + bool is_output) { if (!_enabled) return; diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 4b2497e6..bb1b5c54 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -34,6 +34,7 @@ void ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool recursive) { client->new_patch(patch->path(), patch->internal_polyphony()); + client->polyphonic(patch->path(), patch->polyphonic()); if (recursive) { @@ -91,6 +92,7 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu client->bundle_begin(); client->new_node(node->plugin()->uri(), node->path(), node->polyphonic(), node->num_ports()); + client->polyphonic(node->path(), node->polyphonic()); // Send variable const GraphObjectImpl::Variables& data = node->variables(); @@ -115,6 +117,7 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port) client->bundle_begin(); client->new_port(port->path(), port->type().uri(), port->is_output()); + client->polyphonic(port->path(), port->polyphonic()); // Send variable const GraphObjectImpl::Variables& data = port->variables(); diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp index 7ef4a82a..800ba011 100644 --- a/src/libs/engine/PortImpl.cpp +++ b/src/libs/engine/PortImpl.cpp @@ -39,7 +39,7 @@ PortImpl::PortImpl(NodeImpl* const node, uint32_t poly, DataType type, size_t buffer_size) - : GraphObjectImpl(node, name, true) + : GraphObjectImpl(node, name, (type == DataType::AUDIO || type == DataType::CONTROL)) , _index(index) , _poly(poly) , _buffer_size(buffer_size) @@ -73,6 +73,16 @@ PortImpl::~PortImpl() delete _buffers; } + +bool +PortImpl::set_polyphonic(Raul::Maid& maid, bool p) +{ + if (_type == DataType::CONTROL || _type == DataType::AUDIO) + return GraphObjectImpl::set_polyphonic(maid, p); + else + return (!p); +} + bool PortImpl::prepare_poly(uint32_t poly) diff --git a/src/libs/engine/PortImpl.hpp b/src/libs/engine/PortImpl.hpp index c43a79b0..93972f58 100644 --- a/src/libs/engine/PortImpl.hpp +++ b/src/libs/engine/PortImpl.hpp @@ -51,6 +51,8 @@ public: /** A port's parent is always a node, so static cast should be safe */ NodeImpl* parent_node() const { return (NodeImpl*)_parent; } + bool set_polyphonic(Raul::Maid& maid, bool p); + /** Prepare for a new (external) polyphony value. * * Preprocessor thread, poly is actually applied by apply_poly. diff --git a/src/libs/engine/events/SetPolyphonicEvent.cpp b/src/libs/engine/events/SetPolyphonicEvent.cpp index ebaf9a22..73e27c93 100644 --- a/src/libs/engine/events/SetPolyphonicEvent.cpp +++ b/src/libs/engine/events/SetPolyphonicEvent.cpp @@ -35,7 +35,8 @@ SetPolyphonicEvent::SetPolyphonicEvent(Engine& engine, SharedPtr<Responder> resp : QueuedEvent(engine, responder, time, true, source), _path(path), _object(NULL), - _poly(poly) + _poly(poly), + _success(false) { } @@ -55,7 +56,7 @@ SetPolyphonicEvent::execute(ProcessContext& context) QueuedEvent::execute(context); if (_object) - _object->set_polyphonic(*_engine.maid(), _poly); + _success = _object->set_polyphonic(*_engine.maid(), _poly); _source->unblock(); } @@ -65,8 +66,12 @@ void SetPolyphonicEvent::post_process() { if (_object) { - _responder->respond_ok(); - _engine.broadcaster()->send_polyphonic(_path, _poly); + if (_success) { + _responder->respond_ok(); + _engine.broadcaster()->send_polyphonic(_path, _poly); + } else { + _responder->respond_error("Unable to set object as polyphonic"); + } } else { _responder->respond_error("Unable to find object"); } diff --git a/src/libs/engine/events/SetPolyphonicEvent.hpp b/src/libs/engine/events/SetPolyphonicEvent.hpp index 5922d443..9079d49f 100644 --- a/src/libs/engine/events/SetPolyphonicEvent.hpp +++ b/src/libs/engine/events/SetPolyphonicEvent.hpp @@ -46,6 +46,7 @@ private: const string _path; GraphObjectImpl* _object; bool _poly; + bool _success; }; |