[fix](trx-backend-soapysdr): honor frontend wfm bandwidth

Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-01 00:46:08 +01:00
parent 17c70f89e5
commit 5411607b63
@@ -366,11 +366,8 @@ pub struct ChannelDsp {
impl ChannelDsp {
fn clamp_bandwidth_for_mode(mode: &RigMode, bandwidth_hz: u32) -> u32 {
if *mode == RigMode::WFM {
bandwidth_hz.min(192_000)
} else {
bandwidth_hz
}
let _ = mode;
bandwidth_hz
}
pub fn set_channel_if_hz(&mut self, channel_if_hz: f64) {
@@ -393,7 +390,7 @@ impl ChannelDsp {
}
let target_rate = if *mode == RigMode::WFM {
audio_bandwidth_hz.max(audio_sample_rate.saturating_mul(4)).max(192_000)
audio_bandwidth_hz.max(audio_sample_rate.saturating_mul(4))
} else {
audio_sample_rate.max(1)
};
@@ -410,13 +407,7 @@ impl ChannelDsp {
self.audio_sample_rate,
self.audio_bandwidth_hz,
);
// For WFM, widen the IQ filter enough to pass the RDS subcarrier at
// 57 kHz (requires cutoff ≥ 65 kHz → bandwidth ≥ 130 kHz).
let iq_filter_bw = if self.mode == RigMode::WFM {
self.audio_bandwidth_hz.max(130_000)
} else {
self.audio_bandwidth_hz
};
let iq_filter_bw = self.audio_bandwidth_hz;
let cutoff_hz = iq_filter_bw.min(channel_sample_rate.saturating_sub(1)) as f32 / 2.0;
let cutoff_norm = if self.sdr_sample_rate == 0 {
0.1
@@ -480,11 +471,7 @@ impl ChannelDsp {
Self::pipeline_rates(mode, sdr_sample_rate, audio_sample_rate, audio_bandwidth_hz);
// For WFM, widen the IQ filter enough to pass the RDS subcarrier at
// 57 kHz (requires cutoff ≥ 65 kHz → bandwidth ≥ 130 kHz).
let iq_filter_bw = if *mode == RigMode::WFM {
audio_bandwidth_hz.max(130_000)
} else {
audio_bandwidth_hz
};
let iq_filter_bw = audio_bandwidth_hz;
let cutoff_hz = iq_filter_bw.min(channel_sample_rate.saturating_sub(1)) as f32 / 2.0;
let cutoff_norm = if sdr_sample_rate == 0 {
0.1
@@ -543,7 +530,9 @@ impl ChannelDsp {
pub fn set_mode(&mut self, mode: &RigMode) {
self.mode = mode.clone();
self.audio_bandwidth_hz = default_bandwidth_for_mode(mode);
if *mode != RigMode::WFM {
self.audio_bandwidth_hz = default_bandwidth_for_mode(mode);
}
self.demodulator = Demodulator::for_mode(mode);
self.rebuild_filters(true);
}