summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-23 17:39:05 +0000
committerDavid Robillard <d@drobilla.net>2012-05-23 17:39:05 +0000
commitfb3f51c287951f8df99f8dbdd7f467dc1dea0c71 (patch)
tree777e92e0633f1d9c285c403c8369ad55e0ecc872 /src/server/events
parentfbcb066fe22ae036e9535a84c5bebbe0d110fdac (diff)
downloadingen-fb3f51c287951f8df99f8dbdd7f467dc1dea0c71.tar.gz
ingen-fb3f51c287951f8df99f8dbdd7f467dc1dea0c71.tar.bz2
ingen-fb3f51c287951f8df99f8dbdd7f467dc1dea0c71.zip
Clean up CreatePatch polyphony stuff.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4450 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Connect.cpp7
-rw-r--r--src/server/events/Connect.hpp10
-rw-r--r--src/server/events/CreateNode.cpp1
-rw-r--r--src/server/events/CreatePatch.cpp35
-rw-r--r--src/server/events/CreatePatch.hpp1
5 files changed, 25 insertions, 29 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index 64f81e78..92d89d35 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -134,8 +134,9 @@ Connect::pre_process()
*_engine.buffer_factory(),
_buffers, _dst_input_port->poly());
- if (_patch->enabled())
+ if (_patch->enabled()) {
_compiled_patch = _patch->compile();
+ }
return Event::pre_process_done(SUCCESS);
}
@@ -143,10 +144,8 @@ Connect::pre_process()
void
Connect::execute(ProcessContext& context)
{
- if (_status == SUCCESS) {
- // This must be inserted here, since they're actually used by the audio thread
+ if (!_status) {
_dst_input_port->add_edge(context, _edge.get());
- assert(_buffers);
_engine.maid()->push(_dst_input_port->set_buffers(context, _buffers));
_dst_input_port->connect_buffers();
_engine.maid()->push(_patch->compiled_patch());
diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp
index 8a93200f..a5799f77 100644
--- a/src/server/events/Connect.hpp
+++ b/src/server/events/Connect.hpp
@@ -18,26 +18,24 @@
#define INGEN_EVENTS_CONNECT_HPP
#include "raul/Path.hpp"
+
#include "Event.hpp"
-#include "PatchImpl.hpp"
#include "InputPort.hpp"
+#include "PatchImpl.hpp"
#include "types.hpp"
namespace Raul {
-template <typename T> class ListNode;
template <typename T> class Array;
}
namespace Ingen {
namespace Server {
-class PatchImpl;
-class NodeImpl;
+class CompiledPatch;
class EdgeImpl;
-class PortImpl;
class InputPort;
class OutputPort;
-class CompiledPatch;
+class PatchImpl;
namespace Events {
diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp
index 756f937d..f52e20a1 100644
--- a/src/server/events/CreateNode.cpp
+++ b/src/server/events/CreateNode.cpp
@@ -101,7 +101,6 @@ CreateNode::pre_process()
could be avoided and the node simply appended. */
if (_patch->enabled()) {
_compiled_patch = _patch->compile();
- assert(_compiled_patch);
}
_update.push_back(make_pair(_node->path(), _node->properties()));
diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp
index 575cf11e..b802d066 100644
--- a/src/server/events/CreatePatch.cpp
+++ b/src/server/events/CreatePatch.cpp
@@ -43,14 +43,7 @@ CreatePatch::CreatePatch(Engine& engine,
, _patch(NULL)
, _parent(NULL)
, _compiled_patch(NULL)
- , _poly(1)
{
- Ingen::Shared::URIs& uris = _engine.world()->uris();
- typedef Resource::Properties::const_iterator iterator;
- iterator p = _properties.find(uris.ingen_polyphony);
- if (p != _properties.end() && p->second.type() == uris.forge.Int) {
- _poly = p->second.get_int32();
- }
}
bool
@@ -60,10 +53,6 @@ CreatePatch::pre_process()
return Event::pre_process_done(EXISTS);
}
- if (_poly < 1) {
- return Event::pre_process_done(INVALID_POLY);
- }
-
const Raul::Path& path = (const Raul::Path&)_path;
_parent = _engine.engine_store()->find_patch(path.parent());
@@ -71,15 +60,27 @@ CreatePatch::pre_process()
return Event::pre_process_done(PARENT_NOT_FOUND);
}
- uint32_t poly = 1;
- if (_poly > 1 && _poly == static_cast<int>(_parent->internal_poly())) {
- poly = _poly;
+ const Ingen::Shared::URIs& uris = _engine.world()->uris();
+
+ typedef Resource::Properties::const_iterator iterator;
+
+ uint32_t ext_poly = 1;
+ uint32_t int_poly = 1;
+ iterator p = _properties.find(uris.ingen_polyphony);
+ if (p != _properties.end() && p->second.type() == uris.forge.Int) {
+ int_poly = p->second.get_int32();
+ }
+
+ if (int_poly < 1) {
+ return Event::pre_process_done(INVALID_POLY);
}
- const Ingen::Shared::URIs& uris = _engine.world()->uris();
+ if (int_poly == _parent->internal_poly()) {
+ ext_poly = int_poly;
+ }
- _patch = new PatchImpl(_engine, path.symbol(), poly, _parent,
- _engine.driver()->sample_rate(), _poly);
+ _patch = new PatchImpl(_engine, path.symbol(), ext_poly, _parent,
+ _engine.driver()->sample_rate(), int_poly);
_patch->properties().insert(_properties.begin(), _properties.end());
_patch->add_property(uris.rdf_type, uris.ingen_Patch);
_patch->add_property(uris.rdf_type,
diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreatePatch.hpp
index 95f24641..f84e2683 100644
--- a/src/server/events/CreatePatch.hpp
+++ b/src/server/events/CreatePatch.hpp
@@ -53,7 +53,6 @@ private:
PatchImpl* _patch;
PatchImpl* _parent;
CompiledPatch* _compiled_patch;
- int _poly;
};
} // namespace Events