From 009536de7c8583124430e945f3726fd7a205c38f Mon Sep 17 00:00:00 2001 From: weefuzzy Date: Wed, 11 May 2022 10:42:27 +0100 Subject: [PATCH] RealTime wrapper: play it safer with output channel count This really relies on the SC class being correct, but then everything ultimately does... --- include/wrapper/RealTimeBase.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/wrapper/RealTimeBase.hpp b/include/wrapper/RealTimeBase.hpp index 2814af5..feccfb8 100644 --- a/include/wrapper/RealTimeBase.hpp +++ b/include/wrapper/RealTimeBase.hpp @@ -185,7 +185,9 @@ struct RealTimeBase void mapControlOutputs(SCUnit& unit, Client&) { - for (index i = 0; i < mControlOutputBuffer.size(); ++i) + index numOuts = std::min(mControlOutputBuffer.size(),unit.mNumOutputs); + + for (index i = 0; i < numOuts; ++i) { assert(i <= std::numeric_limits::max()); unit.out0(static_cast(i)) = mControlOutputBuffer(i);