From 3065432f8bc183f7eb3b689ed864940fc331359f Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 19 Aug 2024 18:17:12 -0400 Subject: [PATCH] Fix an output info bus address streamign bug (#1158) * Fix an output info bus address streamign bug I just had it wrong. Now I dont. Closes #1156 * Format --- src/json/engine_traits.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/json/engine_traits.h b/src/json/engine_traits.h index 30852ef2..1f7c9a12 100644 --- a/src/json/engine_traits.h +++ b/src/json/engine_traits.h @@ -180,13 +180,13 @@ SC_STREAMDEF(scxt::engine::Group::GroupOutputInfo, SC_FROM({ {"routeTo", (int)t.routeTo}}; }), SC_TO({ - int rt; findIf(v, "amplitude", result.amplitude); findIf(v, "pan", result.pan); findIf(v, "muted", result.muted); findIf(v, "procRouting", result.procRouting); findIf(v, "velocitySensitivity", result.velocitySensitivity); findIf(v, "oversample", result.oversample); + int rt{engine::BusAddress::DEFAULT_BUS}; findIf(v, "routeTo", rt); result.routeTo = (engine::BusAddress)(rt); })); @@ -234,14 +234,22 @@ SC_STREAMDEF(scxt::engine::Zone::ZoneOutputInfo, SC_FROM({ }), SC_TO({ auto &zo = to; - int rt; findIf(v, {"amp", "amplitude"}, zo.amplitude); findIf(v, "pan", zo.pan); findOrSet(v, "muted", false, zo.muted); findOrSet(v, {"prt", "procRouting"}, engine::Zone::ProcRoutingPath::procRoute_linear, zo.procRouting); - findIf(v, "routeTo", rt); - zo.routeTo = (engine::BusAddress)(rt); + int rt{engine::BusAddress::DEFAULT_BUS}; + findIf(v, {"to", "routeTo"}, rt); + + // There was an error which streamed garbage for a while. + // Might as well be defensive hereon out even though I + // could bump + if (rt >= engine::BusAddress::ERROR_BUS && + rt <= engine::BusAddress::AUX_0 + numAux) + zo.routeTo = (engine::BusAddress)(rt); + else + zo.routeTo = engine::BusAddress::DEFAULT_BUS; })); SC_STREAMDEF(scxt::engine::Zone::ZoneMappingData, SC_FROM({