cwFlowProc.cpp,proc_dict.cfg : Updates to audio_meter to implement UI callbacks.

This commit is contained in:
kevin 2024-10-14 14:23:31 -04:00
parent e0aeb258cd
commit 44e39cd429
2 changed files with 36 additions and 24 deletions

View File

@ -3660,6 +3660,7 @@ namespace cw
{ {
kInPId, kInPId,
kDbFlPId, kDbFlPId,
kConsoleFlPId,
kWndMsPId, kWndMsPId,
kPeakDbPId, kPeakDbPId,
kOutPId, kOutPId,
@ -3711,10 +3712,12 @@ namespace cw
ftime_t wndMs; ftime_t wndMs;
coeff_t peakThreshDb; coeff_t peakThreshDb;
bool dbFl; bool dbFl;
bool consoleFl;
// get the audio_meter variable values // get the audio_meter variable values
if((rc = var_register_and_get( proc, i, if((rc = var_register_and_get( proc, i,
kDbFlPId, "dbFl", kBaseSfxId, dbFl, kDbFlPId, "dbFl", kBaseSfxId, dbFl,
kConsoleFlPId,"consoleFl", kBaseSfxId, consoleFl,
kWndMsPId, "wndMs", kBaseSfxId, wndMs, kWndMsPId, "wndMs", kBaseSfxId, wndMs,
kPeakDbPId, "peakDb", kBaseSfxId, peakThreshDb )) != kOkRC ) kPeakDbPId, "peakDb", kBaseSfxId, peakThreshDb )) != kOkRC )
{ {
@ -3774,6 +3777,9 @@ namespace cw
unsigned chN = 0; unsigned chN = 0;
bool rptFl = inst->rptPeriodSmpN != 0 && inst->rptPhase >= inst->rptPeriodSmpN; bool rptFl = inst->rptPeriodSmpN != 0 && inst->rptPhase >= inst->rptPeriodSmpN;
bool consoleFl = false;
var_get(proc,kConsoleFlPId, kAnyChIdx, consoleFl);
// get the src buffer // get the src buffer
if((rc = var_get(proc,kInPId, kAnyChIdx, srcBuf )) != kOkRC ) if((rc = var_get(proc,kInPId, kAnyChIdx, srcBuf )) != kOkRC )
@ -3789,11 +3795,16 @@ namespace cw
var_set(proc, kClipFlPId, i, inst->mtrA[i]->clipFl ); var_set(proc, kClipFlPId, i, inst->mtrA[i]->clipFl );
if( rptFl ) if( rptFl )
{
var_send_to_ui( proc, kOutPId, i );
if( consoleFl )
cwLogPrint("%6.2f ",inst->mtrA[i]->outDb); cwLogPrint("%6.2f ",inst->mtrA[i]->outDb);
} }
}
if(rptFl) if(rptFl)
{ {
if( consoleFl )
cwLogPrint("\n"); cwLogPrint("\n");
inst->rptPhase -= inst->rptPeriodSmpN; inst->rptPhase -= inst->rptPeriodSmpN;
} }

View File

@ -2,7 +2,7 @@
balance: { balance: {
doc: [ "Stereo balance control." ] doc: [ "Stereo balance control." ]
vars: { 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."}, out: { type:coeff, doc:"Ouput value. Same as input value."},
inv_out: { type:coeff, doc:"1.0 minus output value."} inv_out: { type:coeff, doc:"1.0 minus output value."}
} }
@ -38,7 +38,7 @@
audio_out: { audio_out: {
doc: [ "Audio output device." ], doc: [ "Audio output device." ],
vars: { vars: {
dev_label: { type:string, doc:"Audio device label." }, dev_label: { type:string, flags:["init"], doc:"Audio device label." },
in: { type:audio, flags:["src"], doc:"Audio input." } in: { type:audio, flags:["src"], doc:"Audio input." }
} }
} }
@ -142,7 +142,7 @@
sine_tone: { sine_tone: {
vars: { vars: {
srate: { type:srate, value:0, doc:"Sine tone sample rate. 0=Use default system sample rate"} 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."}, ch_cnt: { type:uint, value:2, flags:["init"], doc:"Output signal channel count."},
hz: { type:coeff, value:440.0, doc:"Frequency in Hertz."}, hz: { type:coeff, value:440.0, doc:"Frequency in Hertz."},
phase: { type:coeff, value:0.0, doc:"Offset phase in radians."}, phase: { type:coeff, value:0.0, doc:"Offset phase in radians."},
dc: { type:coeff, value:0.0, doc:"DC offset applied after gain."}, dc: { type:coeff, value:0.0, doc:"DC offset applied after gain."},
@ -549,9 +549,10 @@
vars: { vars: {
in: { type:audio, flags:["src"], doc:"Audio input." }, in: { type:audio, flags:["src"], doc:"Audio input." },
dbFl: { type:bool, value: true, doc:"Output in Decibels." }, dbFl: { type:bool, value: true, doc:"Output in Decibels." },
wndMs: { type:ftime, value: 100.0, doc:"RMS window length." }, 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." }, peakDb: { type:coeff, value: -10.0, doc:"Peak threshold." },
out: { type:coeff, value: 0.0, doc:"Meter output." }, out: { type:coeff, value: 0.0, doc:"Meter output.", ui:{ type:meter, flags:[ horizontal ] } },
peakFl: { type:bool, value: false, doc:"Peak output." } peakFl: { type:bool, value: false, doc:"Peak output." }
clipFl: { type:bool, value: false, doc:"Clip indicator 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."}, rpt_ms: { type:uint, value:0, flags:["init"], doc:"Report period in ms or 0 for no report."},