From 44e39cd429b0a615c08d247dfbba396e74b13692 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 14 Oct 2024 14:23:31 -0400 Subject: [PATCH] cwFlowProc.cpp,proc_dict.cfg : Updates to audio_meter to implement UI callbacks. --- cwFlowProc.cpp | 23 +++++++++++++++++------ flow/proc_dict.cfg | 37 +++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/cwFlowProc.cpp b/cwFlowProc.cpp index 175f507..75df7ac 100644 --- a/cwFlowProc.cpp +++ b/cwFlowProc.cpp @@ -3660,6 +3660,7 @@ namespace cw { kInPId, kDbFlPId, + kConsoleFlPId, kWndMsPId, kPeakDbPId, kOutPId, @@ -3711,12 +3712,14 @@ namespace cw ftime_t wndMs; coeff_t peakThreshDb; bool dbFl; - + bool consoleFl; + // get the audio_meter variable values if((rc = var_register_and_get( proc, i, - kDbFlPId, "dbFl", kBaseSfxId, dbFl, - kWndMsPId, "wndMs", kBaseSfxId, wndMs, - kPeakDbPId, "peakDb", kBaseSfxId, peakThreshDb )) != kOkRC ) + kDbFlPId, "dbFl", kBaseSfxId, dbFl, + kConsoleFlPId,"consoleFl", kBaseSfxId, consoleFl, + kWndMsPId, "wndMs", kBaseSfxId, wndMs, + kPeakDbPId, "peakDb", kBaseSfxId, peakThreshDb )) != kOkRC ) { goto errLabel; } @@ -3774,6 +3777,9 @@ namespace cw unsigned chN = 0; bool rptFl = inst->rptPeriodSmpN != 0 && inst->rptPhase >= inst->rptPeriodSmpN; + bool consoleFl = false; + + var_get(proc,kConsoleFlPId, kAnyChIdx, consoleFl); // get the src buffer if((rc = var_get(proc,kInPId, kAnyChIdx, srcBuf )) != kOkRC ) @@ -3789,12 +3795,17 @@ namespace cw var_set(proc, kClipFlPId, i, inst->mtrA[i]->clipFl ); if( rptFl ) - cwLogPrint("%6.2f ",inst->mtrA[i]->outDb); + { + var_send_to_ui( proc, kOutPId, i ); + if( consoleFl ) + cwLogPrint("%6.2f ",inst->mtrA[i]->outDb); + } } if(rptFl) { - cwLogPrint("\n"); + if( consoleFl ) + cwLogPrint("\n"); inst->rptPhase -= inst->rptPeriodSmpN; } diff --git a/flow/proc_dict.cfg b/flow/proc_dict.cfg index 4f91f27..05f689a 100644 --- a/flow/proc_dict.cfg +++ b/flow/proc_dict.cfg @@ -2,7 +2,7 @@ balance: { doc: [ "Stereo balance control." ] vars: { - in: { type:coeff, value:0.5, doc:"Input vaue" }, + in: { type:coeff, value:0.5, doc:"Input value" }, out: { type:coeff, doc:"Ouput value. Same as input value."}, inv_out: { type:coeff, doc:"1.0 minus output value."} } @@ -38,8 +38,8 @@ audio_out: { doc: [ "Audio output device." ], vars: { - dev_label: { type:string, doc:"Audio device label." }, - in: { type:audio, flags:["src"], doc:"Audio input." } + dev_label: { type:string, flags:["init"], doc:"Audio device label." }, + in: { type:audio, flags:["src"], doc:"Audio input." } } } @@ -141,13 +141,13 @@ sine_tone: { vars: { - srate: { type:srate, value:0, doc:"Sine tone sample rate. 0=Use default system sample rate"} - ch_cnt: { type:uint, value:2, doc:"Output signal channel count."}, - hz: { type:coeff, value:440.0, doc:"Frequency in Hertz."}, - phase: { type:coeff, value:0.0, doc:"Offset phase in radians."}, - dc: { type:coeff, value:0.0, doc:"DC offset applied after gain."}, - gain: { type:coeff, value:0.8, doc:"Signal frequency."}, - out: { type:audio, doc:"Audio output" }, + srate: { type:srate, value:0, doc:"Sine tone sample rate. 0=Use default system sample rate"} + ch_cnt: { type:uint, value:2, flags:["init"], doc:"Output signal channel count."}, + hz: { type:coeff, value:440.0, doc:"Frequency in Hertz."}, + phase: { type:coeff, value:0.0, doc:"Offset phase in radians."}, + dc: { type:coeff, value:0.0, doc:"DC offset applied after gain."}, + gain: { type:coeff, value:0.8, doc:"Signal frequency."}, + out: { type:audio, doc:"Audio output" }, } presets: { @@ -547,14 +547,15 @@ audio_meter: { vars: { - in: { type:audio, flags:["src"], doc:"Audio input." }, - dbFl: { type:bool, value: true, doc:"Output in Decibels." }, - wndMs: { type:ftime, value: 100.0, doc:"RMS window length." }, - peakDb: { type:coeff, value: -10.0, doc:"Peak threshold." }, - out: { type:coeff, value: 0.0, doc:"Meter output." }, - peakFl: { type:bool, value: false, doc:"Peak output." } - clipFl: { type:bool, value: false, doc:"Clip indicator output."}, - rpt_ms: { type:uint, value:0, flags:["init"], doc:"Report period in ms or 0 for no report."}, + in: { type:audio, flags:["src"], doc:"Audio input." }, + dbFl: { type:bool, value: true, doc:"Output in Decibels." }, + wndMs: { type:ftime, value: 100.0, flags:["init"], doc:"RMS window length in milliseconds." }, + consoleFl: { type:bool, value: false, doc:"Print the output to the console." }, + peakDb: { type:coeff, value: -10.0, doc:"Peak threshold." }, + out: { type:coeff, value: 0.0, doc:"Meter output.", ui:{ type:meter, flags:[ horizontal ] } }, + peakFl: { type:bool, value: false, doc:"Peak output." } + clipFl: { type:bool, value: false, doc:"Clip indicator output."}, + rpt_ms: { type:uint, value:0, flags:["init"], doc:"Report period in ms or 0 for no report."}, } }