From a9531c86a433c8b7ae1f77ff0266c27c39eca7f4 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 10 Mar 2023 11:28:33 +1100 Subject: mostly single task pipeline --- src/audio/pipeline.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/audio/pipeline.cpp (limited to 'src/audio/pipeline.cpp') diff --git a/src/audio/pipeline.cpp b/src/audio/pipeline.cpp new file mode 100644 index 00000000..f42e6853 --- /dev/null +++ b/src/audio/pipeline.cpp @@ -0,0 +1,52 @@ +#include "pipeline.hpp" +#include "stream_info.hpp" + +namespace audio { + +Pipeline::Pipeline(IAudioElement* output) : root_(output), subtrees_() {} +Pipeline::~Pipeline() {} + +auto Pipeline::AddInput(IAudioElement* input) -> Pipeline* { + subtrees_.emplace_back(input); + return subtrees_.back().get(); +} + +auto Pipeline::OutputElement() const -> IAudioElement* { + return root_; +} + +auto Pipeline::NumInputs() const -> std::size_t { + return subtrees_.size(); +} + +auto Pipeline::InStreams( + std::vector>* regions, + std::vector* out) -> void { + for (int i = 0; i < subtrees_.size(); i++) { + MutableStream s = subtrees_[i]->OutStream(®ions->at(i)); + out->push_back(s); + } +} + +auto Pipeline::OutStream(MappableRegion* region) + -> MutableStream { + return {&output_info_, region->Map(output_buffer_)}; +} + +auto Pipeline::GetIterationOrder() -> std::vector { + std::vector to_search{this}; + std::vector found; + + while (!to_search.empty()) { + Pipeline* current = to_search.back(); + to_search.pop_back(); + found.push_back(current); + + to_search.insert(to_search.end(), current->subtrees_.begin(), + current->subtrees_.end()); + } + + return found; +} + +} // namespace audio -- cgit v1.2.3 From 7c6fd654f50e6665efa4226c6b927f9762734182 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Sat, 1 Apr 2023 13:22:21 +1100 Subject: New pipeline building, still needs proper control --- src/audio/pipeline.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/audio/pipeline.cpp') diff --git a/src/audio/pipeline.cpp b/src/audio/pipeline.cpp index f42e6853..8af8f215 100644 --- a/src/audio/pipeline.cpp +++ b/src/audio/pipeline.cpp @@ -1,4 +1,5 @@ #include "pipeline.hpp" +#include #include "stream_info.hpp" namespace audio { @@ -7,7 +8,7 @@ Pipeline::Pipeline(IAudioElement* output) : root_(output), subtrees_() {} Pipeline::~Pipeline() {} auto Pipeline::AddInput(IAudioElement* input) -> Pipeline* { - subtrees_.emplace_back(input); + subtrees_.push_back(std::make_unique(input)); return subtrees_.back().get(); } @@ -21,15 +22,15 @@ auto Pipeline::NumInputs() const -> std::size_t { auto Pipeline::InStreams( std::vector>* regions, - std::vector* out) -> void { + std::vector* out) -> void { for (int i = 0; i < subtrees_.size(); i++) { - MutableStream s = subtrees_[i]->OutStream(®ions->at(i)); + RawStream s = subtrees_[i]->OutStream(®ions->at(i)); out->push_back(s); } } auto Pipeline::OutStream(MappableRegion* region) - -> MutableStream { + -> RawStream { return {&output_info_, region->Map(output_buffer_)}; } @@ -42,8 +43,9 @@ auto Pipeline::GetIterationOrder() -> std::vector { to_search.pop_back(); found.push_back(current); - to_search.insert(to_search.end(), current->subtrees_.begin(), - current->subtrees_.end()); + for (const auto& i : current->subtrees_) { + to_search.push_back(i.get()); + } } return found; -- cgit v1.2.3 From 3836768bb8b95188e6657ab69027d1d9e4b13a77 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 3 Apr 2023 14:06:30 +1000 Subject: new pipeline working(?), but the dac eludes me --- src/audio/pipeline.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/audio/pipeline.cpp') diff --git a/src/audio/pipeline.cpp b/src/audio/pipeline.cpp index 8af8f215..bab2f3ff 100644 --- a/src/audio/pipeline.cpp +++ b/src/audio/pipeline.cpp @@ -4,7 +4,10 @@ namespace audio { -Pipeline::Pipeline(IAudioElement* output) : root_(output), subtrees_() {} +Pipeline::Pipeline(IAudioElement* output) : root_(output), subtrees_() { + assert(output != nullptr); +} + Pipeline::~Pipeline() {} auto Pipeline::AddInput(IAudioElement* input) -> Pipeline* { -- cgit v1.2.3