diff options
author | David Robillard <d@drobilla.net> | 2018-11-24 13:44:03 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-11-24 13:44:03 +0100 |
commit | a7d83f19b08eb4c6f79a82fe60c2b86db13f4420 (patch) | |
tree | d9b620bfba1e7462df4ddb3f6225cc5216c0ca81 /src/server/PostProcessor.cpp | |
parent | d63edc742cebd685f8a05936682210aa5c1e69a9 (diff) | |
download | ingen-a7d83f19b08eb4c6f79a82fe60c2b86db13f4420.tar.gz ingen-a7d83f19b08eb4c6f79a82fe60c2b86db13f4420.tar.bz2 ingen-a7d83f19b08eb4c6f79a82fe60c2b86db13f4420.zip |
Squashed 'waflib/' changes from 6e726eb1..5ea8f99f
5ea8f99f Improve test output spacing
0e23b29f Raise exception when test suite fails to ensure non-zero exit status
d6de073b Show run time of unit tests
5b655541 Add short configure option for ultra-strict flags
4687ba6d Use gtest-like test output
258903d9 Fix failure count in test group summaries
da07e738 Fix verbose tests with Python 3
git-subtree-dir: waflib
git-subtree-split: 5ea8f99f6e1246079c1fe6bb590c38a53aadd40d
Diffstat (limited to 'src/server/PostProcessor.cpp')
-rw-r--r-- | src/server/PostProcessor.cpp | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/src/server/PostProcessor.cpp b/src/server/PostProcessor.cpp deleted file mode 100644 index b275c36a..00000000 --- a/src/server/PostProcessor.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2016 David Robillard <http://drobilla.net/> - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <cassert> - -#include "Engine.hpp" -#include "Event.hpp" -#include "PostProcessor.hpp" -#include "RunContext.hpp" - -namespace Ingen { -namespace Server { - -class Sentinel : public Event { -public: - Sentinel(Engine& engine) : Event(engine) {} - - bool pre_process(PreProcessContext& ctx) { return false; } - void execute(RunContext& context) {} - void post_process() {} -}; - -PostProcessor::PostProcessor(Engine& engine) - : _engine(engine) - , _head(new Sentinel(engine)) - , _tail(_head.load()) - , _max_time(0) -{ -} - -PostProcessor::~PostProcessor() -{ - /* Delete any straggler events (usually at least one since the event list - is never completely emptied by process()). */ - Event* e = _head; - while (e) { - Event* const next = e->next(); - delete e; - e = next; - } -} - -void -PostProcessor::append(RunContext& context, Event* first, Event* last) -{ - assert(first); - assert(last); - assert(!last->next()); - - // The only place where _tail is written or next links are changed - _tail.load()->next(first); - _tail.store(last); -} - -bool -PostProcessor::pending() const -{ - return _head.load()->next() || _engine.pending_notifications(); -} - -void -PostProcessor::process() -{ - const FrameTime end_time = _max_time; - - /* We can never empty the list and set _head = _tail = NULL since this - would cause a race with append. Instead, head is an already - post-processed node, or initially a sentinel. */ - Event* ev = _head.load(); - Event* next = ev->next(); - if (!next || next->time() >= end_time) { - // Process audio thread notifications until end - _engine.emit_notifications(end_time); - return; - } - - do { - // Delete previously post-processed ev and move to next - delete ev; - ev = next; - - // Process audio thread notifications up until this event's time - _engine.emit_notifications(ev->time()); - - // Post-process event - ev->post_process(); - next = ev->next(); // [1] (see below) - } while (next && next->time() < end_time); - - /* Reached the tail (as far as we're concerned). There may be successors - by now if append() has been called since [1], but that's fine. Now, ev - points to the last post-processed event, which will be the new head. */ - assert(ev); - _head = ev; - - // Process remaining audio thread notifications until end - _engine.emit_notifications(end_time); -} - -} // namespace Server -} // namespace Ingen |