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,
kDbFlPId,
kConsoleFlPId,
kWndMsPId,
kPeakDbPId,
kOutPId,
@ -3711,10 +3712,12 @@ 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,
kConsoleFlPId,"consoleFl", kBaseSfxId, consoleFl,
kWndMsPId, "wndMs", kBaseSfxId, wndMs,
kPeakDbPId, "peakDb", kBaseSfxId, peakThreshDb )) != kOkRC )
{
@ -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,11 +3795,16 @@ namespace cw
var_set(proc, kClipFlPId, i, inst->mtrA[i]->clipFl );
if( rptFl )
{
var_send_to_ui( proc, kOutPId, i );
if( consoleFl )
cwLogPrint("%6.2f ",inst->mtrA[i]->outDb);
}
}
if(rptFl)
{
if( consoleFl )
cwLogPrint("\n");
inst->rptPhase -= inst->rptPeriodSmpN;
}

View File

@ -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,7 +38,7 @@
audio_out: {
doc: [ "Audio output device." ],
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." }
}
}
@ -142,7 +142,7 @@
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."},
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."},
@ -549,9 +549,10 @@
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." },
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." },
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."},