summaryrefslogtreecommitdiffstats
path: root/src/server/events/CreatePatch.cpp
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/CreatePatch.cpp
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/CreatePatch.cpp')
-rw-r--r--src/server/events/CreatePatch.cpp35
1 files changed, 18 insertions, 17 deletions
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,