From 3d117ed9a00c3fdbcb07327d6669aa26c3821720 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 23 Sep 2018 19:39:56 +0200 Subject: Enforce that arc buffer can only be accessed in run context --- src/server/ArcImpl.cpp | 2 +- src/server/ArcImpl.hpp | 2 +- src/server/InputPort.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server') diff --git a/src/server/ArcImpl.cpp b/src/server/ArcImpl.cpp index b92f817d..ffdddb8e 100644 --- a/src/server/ArcImpl.cpp +++ b/src/server/ArcImpl.cpp @@ -65,7 +65,7 @@ ArcImpl::head_path() const } BufferRef -ArcImpl::buffer(uint32_t voice, SampleCount offset) const +ArcImpl::buffer(const RunContext&, uint32_t voice) const { return _tail->buffer(std::min(voice, _tail->poly() - 1)); } diff --git a/src/server/ArcImpl.hpp b/src/server/ArcImpl.hpp index 49e9674b..54f88749 100644 --- a/src/server/ArcImpl.hpp +++ b/src/server/ArcImpl.hpp @@ -66,7 +66,7 @@ public: * buffer, and will return accordingly (e.g. the same buffer for every * voice in a mono->poly arc). */ - BufferRef buffer(uint32_t voice, SampleCount offset=0) const; + BufferRef buffer(const RunContext& ctx, uint32_t voice) const; /** Whether this arc must mix down voices into a local buffer */ bool must_mix() const; diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp index a9ff1738..76382270 100644 --- a/src/server/InputPort.cpp +++ b/src/server/InputPort.cpp @@ -115,7 +115,7 @@ InputPort::setup_buffers(RunContext& ctx, BufferFactory& bufs, uint32_t poly) if (_arcs.size() == 1 && !is_a(PortType::ATOM) && !_arcs.front().must_mix()) { // Single non-mixing connection, use buffers directly for (uint32_t v = 0; v < poly; ++v) { - _voices->at(v).buffer = _arcs.front().buffer(v); + _voices->at(v).buffer = _arcs.front().buffer(ctx, v); } return false; } @@ -158,7 +158,7 @@ InputPort::pre_process(RunContext& context) } else if (direct_connect()) { // Directly connected, use source's buffer directly for (uint32_t v = 0; v < _poly; ++v) { - _voices->at(v).buffer = _arcs.front().buffer(v); + _voices->at(v).buffer = _arcs.front().buffer(context, v); } } else { // Mix down to local buffers in pre_run() @@ -194,13 +194,13 @@ InputPort::pre_run(RunContext& context) // P -> 1 or 1 -> 1: all tail voices => each head voice for (uint32_t w = 0; w < arc.tail()->poly(); ++w) { assert(n_srcs < max_n_srcs); - srcs[n_srcs++] = arc.buffer(w, context.offset()).get(); + srcs[n_srcs++] = arc.buffer(context, w).get(); assert(srcs[n_srcs - 1]); } } else { // P -> P or 1 -> P: tail voice => corresponding head voice assert(n_srcs < max_n_srcs); - srcs[n_srcs++] = arc.buffer(v, context.offset()).get(); + srcs[n_srcs++] = arc.buffer(context, v).get(); assert(srcs[n_srcs - 1]); } } -- cgit v1.2.1