summaryrefslogtreecommitdiffstats
path: root/src/server/events/Delta.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/events/Delta.cpp')
-rw-r--r--src/server/events/Delta.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index ecc1830a..5ea00c9f 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -217,8 +217,6 @@ Delta::pre_process(PreProcessContext& ctx)
_types.reserve(_properties.size());
- NodeImpl* obj = dynamic_cast<NodeImpl*>(_object);
-
// Remove any properties removed in delta
for (const auto& r : _remove) {
const Raul::URI& key = r.first;
@@ -277,10 +275,9 @@ Delta::pre_process(PreProcessContext& ctx)
const Raul::URI& key = p.first;
const Property& value = p.second;
SpecialType op = SpecialType::NONE;
- if (obj) {
- Resource& resource = *obj;
+ if (is_graph_object) {
if (value != uris.patch_wildcard) {
- if (resource.add_property(key, value, value.context())) {
+ if (_object->add_property(key, value, value.context())) {
_added.emplace(key, value);
}
}
@@ -375,22 +372,22 @@ Delta::pre_process(PreProcessContext& ctx)
}
if (!_create_event && key == uris.ingen_polyphonic) {
- GraphImpl* parent = dynamic_cast<GraphImpl*>(obj->parent());
+ GraphImpl* parent = dynamic_cast<GraphImpl*>(
+ _engine.store()->get(uri_to_path(_subject).parent()));
if (!parent) {
_status = Status::BAD_OBJECT_TYPE;
} else if (value.type() != uris.forge.Bool) {
_status = Status::BAD_VALUE_TYPE;
} else {
- op = SpecialType::POLYPHONIC;
- obj->set_property(key, value, value.context());
- BlockImpl* block = dynamic_cast<BlockImpl*>(obj);
- if (block) {
- block->set_polyphonic(value.get<int32_t>());
- }
- if (value.get<int32_t>()) {
- obj->prepare_poly(*_engine.buffer_factory(), parent->internal_poly());
- } else {
- obj->prepare_poly(*_engine.buffer_factory(), 1);
+ op = SpecialType::POLYPHONIC;
+ _object->set_property(key, value, value.context());
+ const uint32_t poly = (
+ value.get<int32_t>() ? parent->internal_poly() : 1);
+ if (BlockImpl* block = dynamic_cast<BlockImpl*>(_object)) {
+ block->set_polyphonic(poly);
+ block->prepare_poly(*_engine.buffer_factory(), poly);
+ } else if (PortImpl* port = dynamic_cast<PortImpl*>(_object)) {
+ port->prepare_poly(*_engine.buffer_factory(), poly);
}
}
}
@@ -455,7 +452,6 @@ Delta::execute(RunContext& context)
_engine.control_bindings()->remove(context, _removed_bindings);
}
- NodeImpl* const object = dynamic_cast<NodeImpl*>(_object);
BlockImpl* const block = dynamic_cast<BlockImpl*>(_object);
PortImpl* const port = dynamic_cast<PortImpl*>(_object);
@@ -484,11 +480,14 @@ Delta::execute(RunContext& context)
}
break;
case SpecialType::POLYPHONIC: {
- GraphImpl* parent = reinterpret_cast<GraphImpl*>(object->parent());
- if (value.get<int32_t>()) {
- object->apply_poly(context, parent->internal_poly_process());
- } else {
- object->apply_poly(context, 1);
+ GraphImpl* parent = reinterpret_cast<GraphImpl*>(
+ block ? block->parent() : port->parent());
+ const uint32_t poly = (
+ value.get<int32_t>() ? parent->internal_poly_process() : 1);
+ if (block) {
+ block->apply_poly(context, poly);
+ } else if (port) {
+ port->apply_poly(context, poly);
}
} break;
case SpecialType::POLYPHONY: