From ce8b9ebce4f89bbdfcd7753bed7589d407868a13 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 4 Jul 2024 17:02:45 -0400 Subject: [PATCH] cwFlow.cpp : exec_cylce() is not responsible for maintaining flow_t.cycleIndex and monitoring for early stopping via flow_t.maxCycleCount. --- cwFlow.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/cwFlow.cpp b/cwFlow.cpp index 28b0678..0dc5ed2 100644 --- a/cwFlow.cpp +++ b/cwFlow.cpp @@ -55,6 +55,8 @@ namespace cw { "audio_meter", &audio_meter::members }, { "audio_marker", &audio_marker::members }, { "xfade_ctl", &xfade_ctl::members }, + { "poly_voice_ctl", &poly_voice_ctl::members }, + { "midi_voice", &midi_voice::members }, { "sample_hold", &sample_hold::members }, { "number", &number::members }, { "reg", ®::members }, @@ -848,10 +850,23 @@ unsigned cw::flow::preset_cfg_flags( handle_t h ) return flags; } - cw::rc_t cw::flow::exec_cycle( handle_t h ) { - return exec_cycle(_handleToPtr(h)->net); + rc_t rc = kOkRC;; + flow_t* p = _handleToPtr(h); + + if( p->maxCycleCount!=kInvalidCnt && p->cycleIndex >= p->maxCycleCount ) + { + rc = kEofRC; + cwLogInfo("'maxCycleCnt' reached: %i. Shutting down flow.",p->maxCycleCount); + } + else + { + rc = exec_cycle(p->net); + p->cycleIndex += 1; + } + + return rc; } cw::rc_t cw::flow::exec( handle_t h ) @@ -859,19 +874,9 @@ cw::rc_t cw::flow::exec( handle_t h ) rc_t rc = kOkRC; flow_t* p = _handleToPtr(h); - for(; (p->maxCycleCount==kInvalidCnt || (p->maxCycleCount!=kInvalidCnt && p->cycleIndex < p->maxCycleCount)) && rc == kOkRC; p->cycleIndex++ ) - { + while( rc == kOkRC ) rc = exec_cycle(p->net); - - // kEofRC indicates that the network asked to terminate - if( rc == kEofRC ) - break; - - } - - if( p->maxCycleCount != kInvalidCnt && p->cycleIndex >= p->maxCycleCount ) - cwLogInfo("'maxCycleCnt' reached: %i. Shutting down flow.",p->maxCycleCount); - + return rc; }