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,12 +3712,14 @@ 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,
kWndMsPId, "wndMs", kBaseSfxId, wndMs, kConsoleFlPId,"consoleFl", kBaseSfxId, consoleFl,
kPeakDbPId, "peakDb", kBaseSfxId, peakThreshDb )) != kOkRC ) kWndMsPId, "wndMs", kBaseSfxId, wndMs,
kPeakDbPId, "peakDb", kBaseSfxId, peakThreshDb )) != kOkRC )
{ {
goto errLabel; goto errLabel;
} }
@ -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,12 +3795,17 @@ namespace cw
var_set(proc, kClipFlPId, i, inst->mtrA[i]->clipFl ); var_set(proc, kClipFlPId, i, inst->mtrA[i]->clipFl );
if( rptFl ) 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) if(rptFl)
{ {
cwLogPrint("\n"); if( consoleFl )
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,8 +38,8 @@
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." }
} }
} }
@ -141,13 +141,13 @@
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."},
gain: { type:coeff, value:0.8, doc:"Signal frequency."}, gain: { type:coeff, value:0.8, doc:"Signal frequency."},
out: { type:audio, doc:"Audio output" }, out: { type:audio, doc:"Audio output" },
} }
presets: { presets: {
@ -547,14 +547,15 @@
audio_meter: { audio_meter: {
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." },
peakDb: { type:coeff, value: -10.0, doc:"Peak threshold." }, consoleFl: { type:bool, value: false, doc:"Print the output to the console." },
out: { type:coeff, value: 0.0, doc:"Meter output." }, peakDb: { type:coeff, value: -10.0, doc:"Peak threshold." },
peakFl: { type:bool, value: false, doc:"Peak output." } out: { type:coeff, value: 0.0, doc:"Meter output.", ui:{ type:meter, flags:[ horizontal ] } },
clipFl: { type:bool, value: false, doc:"Clip indicator output."}, peakFl: { type:bool, value: false, doc:"Peak output." }
rpt_ms: { type:uint, value:0, flags:["init"], doc:"Report period in ms or 0 for no report."}, 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."},
} }
} }