[fix](trx-backend-soapysdr): bypass agc for wfm audio
Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -158,14 +158,6 @@ impl SoftAgc {
|
|||||||
let gain = self.update_gain(x.abs());
|
let gain = self.update_gain(x.abs());
|
||||||
(x * gain).clamp(-1.0, 1.0)
|
(x * gain).clamp(-1.0, 1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn process_pair(&mut self, left: f32, right: f32) -> (f32, f32) {
|
|
||||||
let gain = self.update_gain(left.abs().max(right.abs()));
|
|
||||||
(
|
|
||||||
(left * gain).clamp(-1.0, 1.0),
|
|
||||||
(right * gain).clamp(-1.0, 1.0),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BiquadBandPass {
|
impl BiquadBandPass {
|
||||||
|
|||||||
@@ -654,25 +654,7 @@ impl ChannelDsp {
|
|||||||
// All other modes: stateless demodulator → DC blocker (where enabled) → AGC.
|
// All other modes: stateless demodulator → DC blocker (where enabled) → AGC.
|
||||||
// AGC is applied to WFM output too so all modes share the same target level.
|
// AGC is applied to WFM output too so all modes share the same target level.
|
||||||
let audio = if let Some(decoder) = self.wfm_decoder.as_mut() {
|
let audio = if let Some(decoder) = self.wfm_decoder.as_mut() {
|
||||||
let mut out = decoder.process_iq(&decimated);
|
decoder.process_iq(&decimated)
|
||||||
if !self.wfm_stereo && self.output_channels >= 2 {
|
|
||||||
for pair in out.chunks_exact_mut(2) {
|
|
||||||
let mono = self.audio_agc.process(pair[0]);
|
|
||||||
pair[0] = mono;
|
|
||||||
pair[1] = mono;
|
|
||||||
}
|
|
||||||
} else if self.wfm_stereo && self.output_channels >= 2 {
|
|
||||||
for pair in out.chunks_exact_mut(2) {
|
|
||||||
let (left, right) = self.audio_agc.process_pair(pair[0], pair[1]);
|
|
||||||
pair[0] = left;
|
|
||||||
pair[1] = right;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for s in &mut out {
|
|
||||||
*s = self.audio_agc.process(*s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out
|
|
||||||
} else {
|
} else {
|
||||||
let mut raw = self.demodulator.demodulate(&decimated);
|
let mut raw = self.demodulator.demodulate(&decimated);
|
||||||
for s in &mut raw {
|
for s in &mut raw {
|
||||||
|
|||||||
Reference in New Issue
Block a user