diff options
author | David Robillard <d@drobilla.net> | 2015-02-08 07:02:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-02-08 07:02:59 +0000 |
commit | 0f9c8151d5b42b243a499bb31a1e1f0b2e8c5f6f (patch) | |
tree | 1ed4df4df4c3f160120544d92c681f1b4519e1aa /src/server/events/CreatePort.cpp | |
parent | 8733afb7ae9a04f46ac6318667182da16eca9fe5 (diff) | |
download | ingen-0f9c8151d5b42b243a499bb31a1e1f0b2e8c5f6f.tar.gz ingen-0f9c8151d5b42b243a499bb31a1e1f0b2e8c5f6f.tar.bz2 ingen-0f9c8151d5b42b243a499bb31a1e1f0b2e8c5f6f.zip |
Server-side copy paste with LV2 state support.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5541 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events/CreatePort.cpp')
-rw-r--r-- | src/server/events/CreatePort.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 2a1a7994..21602df6 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -87,31 +87,23 @@ CreatePort::pre_process() { if (_port_type == PortType::UNKNOWN) { return Event::pre_process_done(Status::UNKNOWN_TYPE, _path); - } - - if (_path.is_root()) { + } else if (_path.is_root()) { return Event::pre_process_done(Status::BAD_URI, _path); - } - - if (_engine.store()->get(_path)) { + } else if (_engine.store()->get(_path)) { return Event::pre_process_done(_status, _path); } - Node* parent = _engine.store()->get(_path.parent()); + const Raul::Path parent_path = _path.parent(); + Node* const parent = _engine.store()->get(parent_path); if (!parent) { - return Event::pre_process_done(Status::PARENT_NOT_FOUND, - _path.parent()); + return Event::pre_process_done(Status::PARENT_NOT_FOUND, parent_path); + } else if (!(_graph = dynamic_cast<GraphImpl*>(parent))) { + return Event::pre_process_done(Status::INVALID_PARENT, parent_path); } - if (!(_graph = dynamic_cast<GraphImpl*>(parent))) { - return Event::pre_process_done(Status::INVALID_PARENT_PATH, - _path.parent()); - } - - const URIs& uris = _engine.world()->uris(); - const BufferFactory& buffer_factory = *_engine.buffer_factory(); - - const uint32_t buf_size = buffer_factory.default_size(_buf_type); + const URIs& uris = _engine.world()->uris(); + BufferFactory& bufs = *_engine.buffer_factory(); + const uint32_t buf_size = bufs.default_size(_buf_type); const int32_t old_n_ports = _graph->num_ports_non_rt(); typedef Resource::Properties::const_iterator PropIter; @@ -133,7 +125,7 @@ CreatePort::pre_process() poly_i->second.get<int32_t>()); if (!(_graph_port = _graph->create_port( - *_engine.buffer_factory(), Raul::Symbol(_path.symbol()), + bufs, Raul::Symbol(_path.symbol()), _port_type, _buf_type, buf_size, _is_output, polyphonic))) { return Event::pre_process_done(Status::CREATION_FAILED, _path); } |