[fix](trx-backend-soapysdr): honor frontend wfm bandwidth
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -366,11 +366,8 @@ pub struct ChannelDsp {
|
|||||||
|
|
||||||
impl ChannelDsp {
|
impl ChannelDsp {
|
||||||
fn clamp_bandwidth_for_mode(mode: &RigMode, bandwidth_hz: u32) -> u32 {
|
fn clamp_bandwidth_for_mode(mode: &RigMode, bandwidth_hz: u32) -> u32 {
|
||||||
if *mode == RigMode::WFM {
|
let _ = mode;
|
||||||
bandwidth_hz.min(192_000)
|
bandwidth_hz
|
||||||
} else {
|
|
||||||
bandwidth_hz
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_channel_if_hz(&mut self, channel_if_hz: f64) {
|
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 {
|
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 {
|
} else {
|
||||||
audio_sample_rate.max(1)
|
audio_sample_rate.max(1)
|
||||||
};
|
};
|
||||||
@@ -410,13 +407,7 @@ impl ChannelDsp {
|
|||||||
self.audio_sample_rate,
|
self.audio_sample_rate,
|
||||||
self.audio_bandwidth_hz,
|
self.audio_bandwidth_hz,
|
||||||
);
|
);
|
||||||
// For WFM, widen the IQ filter enough to pass the RDS subcarrier at
|
let iq_filter_bw = self.audio_bandwidth_hz;
|
||||||
// 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 cutoff_hz = iq_filter_bw.min(channel_sample_rate.saturating_sub(1)) as f32 / 2.0;
|
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 {
|
let cutoff_norm = if self.sdr_sample_rate == 0 {
|
||||||
0.1
|
0.1
|
||||||
@@ -480,11 +471,7 @@ impl ChannelDsp {
|
|||||||
Self::pipeline_rates(mode, sdr_sample_rate, audio_sample_rate, audio_bandwidth_hz);
|
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
|
// For WFM, widen the IQ filter enough to pass the RDS subcarrier at
|
||||||
// 57 kHz (requires cutoff ≥ 65 kHz → bandwidth ≥ 130 kHz).
|
// 57 kHz (requires cutoff ≥ 65 kHz → bandwidth ≥ 130 kHz).
|
||||||
let iq_filter_bw = if *mode == RigMode::WFM {
|
let iq_filter_bw = audio_bandwidth_hz;
|
||||||
audio_bandwidth_hz.max(130_000)
|
|
||||||
} else {
|
|
||||||
audio_bandwidth_hz
|
|
||||||
};
|
|
||||||
let cutoff_hz = iq_filter_bw.min(channel_sample_rate.saturating_sub(1)) as f32 / 2.0;
|
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 {
|
let cutoff_norm = if sdr_sample_rate == 0 {
|
||||||
0.1
|
0.1
|
||||||
@@ -543,7 +530,9 @@ impl ChannelDsp {
|
|||||||
|
|
||||||
pub fn set_mode(&mut self, mode: &RigMode) {
|
pub fn set_mode(&mut self, mode: &RigMode) {
|
||||||
self.mode = mode.clone();
|
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.demodulator = Demodulator::for_mode(mode);
|
||||||
self.rebuild_filters(true);
|
self.rebuild_filters(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user