diff options
author | David Robillard <d@drobilla.net> | 2020-02-26 22:25:11 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-02-26 22:25:11 +0100 |
commit | 6db14b2210a9f7a8835334657e89ae49158fe660 (patch) | |
tree | 63b4bd67c8f112512e009bb8d082aa1914f49c08 /src/server/events | |
parent | 41d130d1f049a46e95dab6c0823faa4f72603044 (diff) | |
download | ingen-6db14b2210a9f7a8835334657e89ae49158fe660.tar.gz ingen-6db14b2210a9f7a8835334657e89ae49158fe660.tar.bz2 ingen-6db14b2210a9f7a8835334657e89ae49158fe660.zip |
Fix atomic bundle execution
Diffstat (limited to 'src/server/events')
-rw-r--r-- | src/server/events/Mark.cpp | 26 | ||||
-rw-r--r-- | src/server/events/Mark.hpp | 1 |
2 files changed, 22 insertions, 5 deletions
diff --git a/src/server/events/Mark.cpp b/src/server/events/Mark.cpp index 07beb39f..eb50e4a0 100644 --- a/src/server/events/Mark.cpp +++ b/src/server/events/Mark.cpp @@ -32,7 +32,7 @@ Mark::Mark(Engine& engine, const ingen::BundleBegin& msg) : Event(engine, client, msg.seq, timestamp) , _type(Type::BUNDLE_BEGIN) - , _depth(0) + , _depth(-1) {} Mark::Mark(Engine& engine, @@ -41,11 +41,11 @@ Mark::Mark(Engine& engine, const ingen::BundleEnd& msg) : Event(engine, client, msg.seq, timestamp) , _type(Type::BUNDLE_END) - , _depth(0) + , _depth(-1) {} -bool -Mark::pre_process(PreProcessContext& ctx) +void +Mark::mark(PreProcessContext& ctx) { const UPtr<UndoStack>& stack = ((_mode == Mode::UNDO) ? _engine.redo_stack() @@ -53,11 +53,26 @@ Mark::pre_process(PreProcessContext& ctx) switch (_type) { case Type::BUNDLE_BEGIN: - ctx.set_in_bundle(true); _depth = stack->start_entry(); break; case Type::BUNDLE_END: _depth = stack->finish_entry(); + break; + } +} + +bool +Mark::pre_process(PreProcessContext& ctx) +{ + if (_depth < 0) { + mark(ctx); + } + + switch (_type) { + case Type::BUNDLE_BEGIN: + ctx.set_in_bundle(true); + break; + case Type::BUNDLE_END: ctx.set_in_bundle(false); if (!ctx.dirty_graphs().empty()) { for (GraphImpl* g : ctx.dirty_graphs()) { @@ -91,6 +106,7 @@ Mark::post_process() Event::Execution Mark::get_execution() const { + assert(_depth >= 0); if (!_engine.atomic_bundles()) { return Execution::NORMAL; } diff --git a/src/server/events/Mark.hpp b/src/server/events/Mark.hpp index c32c2588..bff38f06 100644 --- a/src/server/events/Mark.hpp +++ b/src/server/events/Mark.hpp @@ -50,6 +50,7 @@ public: SampleCount timestamp, const ingen::BundleEnd& msg); + void mark(PreProcessContext& ctx) override; bool pre_process(PreProcessContext& ctx) override; void execute(RunContext& context) override; void post_process() override; |