From 015f345dd67474a7ca03a66f8535dedaef00e081 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 27 Dec 2021 20:24:43 -0500 Subject: [PATCH] cwIoFlow.h/cpp : Added version of 'apply_preset()' with built in call to 'begin_cross_fade()' --- cwIoFlow.cpp | 9 +++++++++ cwIoFlow.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/cwIoFlow.cpp b/cwIoFlow.cpp index 895f126..841b9dd 100644 --- a/cwIoFlow.cpp +++ b/cwIoFlow.cpp @@ -405,6 +405,15 @@ cw::rc_t cw::io_flow::exec( handle_t h, const io::msg_t& msg ) return rc; } +cw::rc_t cw::io_flow::apply_preset( handle_t h, unsigned crossFadeMs, const char* presetLabel ) +{ + rc_t rc; + if((rc = apply_preset( h, flow_cross::kNextDestId, presetLabel )) == kOkRC ) + rc = begin_cross_fade( h, crossFadeMs ); + + return rc; +} + cw::rc_t cw::io_flow::apply_preset( handle_t h, flow_cross::destId_t destId, const char* presetLabel ) { return apply_preset( _handleToPtr(h)->crossFlowH, destId, presetLabel ); } diff --git a/cwIoFlow.h b/cwIoFlow.h index fe4da0d..4a6eb9f 100644 --- a/cwIoFlow.h +++ b/cwIoFlow.h @@ -13,6 +13,12 @@ namespace cw rc_t exec( handle_t h, const io::msg_t& msg ); + // Apply a preset to the 'next' network instance and activate it immediately. + rc_t apply_preset( handle_t h, unsigned crossFadeMs, const char* presetLabel ); + + // Apply a preset to the selected network instance (current or next). + // If the preset is applied to the 'next' network instance then use 'begin_cross_fade()' to + // activate the next network. rc_t apply_preset( handle_t h, flow_cross::destId_t destId, const char* presetLabel ); rc_t set_variable_value( handle_t h, flow_cross::destId_t destId, const char* inst_label, const char* var_label, unsigned chIdx, bool value );