cwIoPresetSelApp.cpp : Allow audio output to be disabled by deactivating all the audio devices in the .cfg file.

This commit is contained in:
kevin 2023-12-30 11:09:46 -05:00
parent 9a6729b9b9
commit ca53e712a6

View File

@ -27,7 +27,6 @@
#include "cwIoFlow.h" #include "cwIoFlow.h"
#include "cwPresetSel.h" #include "cwPresetSel.h"
#include "cwVelTableTuner.h" #include "cwVelTableTuner.h"
//#include "cwCmInterface.h"
#include "cwDynRefTbl.h" #include "cwDynRefTbl.h"
#include "cwScoreParse.h" #include "cwScoreParse.h"
#include "cwSfScore.h" #include "cwSfScore.h"
@ -895,7 +894,7 @@ namespace cw
if( score_evt != nullptr ) if( score_evt != nullptr )
printf("Meas:e:%f d:%f t:%f c:%f\n",score_evt->even,score_evt->dyn,score_evt->tempo,score_evt->cost); printf("Meas:e:%f d:%f t:%f c:%f\n",score_evt->even,score_evt->dyn,score_evt->tempo,score_evt->cost);
if( preset_label != nullptr ) if( preset_label != nullptr && app->ioFlowH.isValid() )
{ {
io_flow::apply_preset( app->ioFlowH, flow_cross::kNextDestId, preset_label ); io_flow::apply_preset( app->ioFlowH, flow_cross::kNextDestId, preset_label );
@ -1878,6 +1877,8 @@ namespace cw
if( app->psNextFrag == nullptr ) if( app->psNextFrag == nullptr )
{ {
io::uiSendMsg( app->ioH, "{ \"op\":\"attach\" }" );
// the fragments are loaded enable the 'load' and 'alt' menu // the fragments are loaded enable the 'load' and 'alt' menu
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPerfSelId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPerfSelId ), true );
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kAltSelId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kAltSelId ), true );
@ -2734,9 +2735,11 @@ namespace cw
if((rc = preset_sel::set_value( app->psH, kInvalidId, varId, kInvalidId, value )) != kOkRC ) if((rc = preset_sel::set_value( app->psH, kInvalidId, varId, kInvalidId, value )) != kOkRC )
rc = cwLogError(rc,"Master value set failed on varId:%i %s.%s.",varId,cwStringNullGuard(inst_label),cwStringNullGuard(var_label)); rc = cwLogError(rc,"Master value set failed on varId:%i %s.%s.",varId,cwStringNullGuard(inst_label),cwStringNullGuard(var_label));
else else
{
if( app->ioFlowH.isValid() )
if((rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, inst_label, var_label, flow::kAnyChIdx, (dsp::real_t)value )) != kOkRC ) if((rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, inst_label, var_label, flow::kAnyChIdx, (dsp::real_t)value )) != kOkRC )
rc = cwLogError(rc,"Master value send failed on %s.%s.",cwStringNullGuard(inst_label),cwStringNullGuard(var_label)); rc = cwLogError(rc,"Master value send failed on %s.%s.",cwStringNullGuard(inst_label),cwStringNullGuard(var_label));
}
return rc; return rc;
} }
@ -2771,12 +2774,14 @@ namespace cw
case kPvWndSmpCntId: case kPvWndSmpCntId:
var_label = "wndSmpN"; var_label = "wndSmpN";
app->pvWndSmpCnt = m.value->u.u; app->pvWndSmpCnt = m.value->u.u;
if( app->ioFlowH.isValid() )
rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "pva", var_label, flow::kAnyChIdx, m.value->u.u ); rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "pva", var_label, flow::kAnyChIdx, m.value->u.u );
break; break;
case kSdBypassId: case kSdBypassId:
var_label = "bypass"; var_label = "bypass";
app->sdBypassFl = m.value->u.b; app->sdBypassFl = m.value->u.b;
if( app->ioFlowH.isValid() )
rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "sd", var_label, flow::kAnyChIdx, m.value->u.b ); rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "sd", var_label, flow::kAnyChIdx, m.value->u.b );
break; break;
@ -2818,6 +2823,7 @@ namespace cw
case kCmpBypassId: case kCmpBypassId:
var_label = "cmp-bypass"; var_label = "cmp-bypass";
app->cmpBypassFl = m.value->u.b; app->cmpBypassFl = m.value->u.b;
if( app->ioFlowH.isValid() )
rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "cmp", "bypass", flow::kAnyChIdx, m.value->u.b ); rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "cmp", "bypass", flow::kAnyChIdx, m.value->u.b );
break; break;
@ -2825,7 +2831,7 @@ namespace cw
assert(0); assert(0);
} }
if( m.value->tid == ui::kDoubleTId ) if( m.value->tid == ui::kDoubleTId && app->ioFlowH.isValid() )
rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "sd", var_label, flow::kAnyChIdx, (dsp::real_t)m.value->u.d ); rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "sd", var_label, flow::kAnyChIdx, (dsp::real_t)m.value->u.d );
if(rc != kOkRC ) if(rc != kOkRC )
@ -2856,6 +2862,7 @@ namespace cw
io::uiSendValue( app->ioH, io::uiFindElementUuId( app->ioH, kSyncDelayMsId ), app->dfltSyncDelayMs ); io::uiSendValue( app->ioH, io::uiFindElementUuId( app->ioH, kSyncDelayMsId ), app->dfltSyncDelayMs );
} }
if( app->ioFlowH.isValid() )
if((rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "sync_delay", "delayMs", flow::kAnyChIdx, (dsp::real_t)value )) != kOkRC ) if((rc = io_flow::set_variable_value( app->ioFlowH, flow_cross::kAllDestId, "sync_delay", "delayMs", flow::kAnyChIdx, (dsp::real_t)value )) != kOkRC )
rc = cwLogError(rc,"Error setting sync delay 'flow' value."); rc = cwLogError(rc,"Error setting sync delay 'flow' value.");
@ -2916,6 +2923,7 @@ namespace cw
break; break;
case kNetPrintBtnId: case kNetPrintBtnId:
if( app->ioFlowH.isValid() )
io_flow::print_network(app->ioFlowH,flow_cross::kCurDestId); io_flow::print_network(app->ioFlowH,flow_cross::kCurDestId);
break; break;
@ -3529,11 +3537,18 @@ cw::rc_t cw::preset_sel_app::main( const object_t* cfg, int argc, const char* ar
} }
// create the IO Flow controller // create the IO Flow controller
if( !audioIsEnabled(app.ioH) )
{
cwLogInfo("Audio disabled.");
}
else
{
if(app.flow_cfg==nullptr || app.flow_proc_dict==nullptr || (rc = io_flow::create(app.ioFlowH,app.ioH,sysSampleRate,app.crossFadeCnt,*app.flow_proc_dict,*app.flow_cfg)) != kOkRC ) if(app.flow_cfg==nullptr || app.flow_proc_dict==nullptr || (rc = io_flow::create(app.ioFlowH,app.ioH,sysSampleRate,app.crossFadeCnt,*app.flow_proc_dict,*app.flow_cfg)) != kOkRC )
{ {
rc = cwLogError(rc,"The IO Flow controller create failed."); rc = cwLogError(rc,"The IO Flow controller create failed.");
goto errLabel; goto errLabel;
} }
}
// start the IO framework instance // start the IO framework instance
if((rc = io::start(app.ioH)) != kOkRC ) if((rc = io::start(app.ioH)) != kOkRC )
@ -3542,6 +3557,8 @@ cw::rc_t cw::preset_sel_app::main( const object_t* cfg, int argc, const char* ar
goto errLabel; goto errLabel;
} }
//io::uiReport(app.ioH);
// execute the io framework // execute the io framework
while( !io::isShuttingDown(app.ioH)) while( !io::isShuttingDown(app.ioH))
{ {