From 25ef919d13b0f1796ac0e2f7185801d9bf84805c Mon Sep 17 00:00:00 2001 From: Jan Svabenik Date: Thu, 19 Mar 2026 14:31:41 +0100 Subject: [PATCH] Reuse common WFM mono base for stereo and RDS paths --- internal/demod/fm.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/demod/fm.go b/internal/demod/fm.go index b3e1222..521e716 100644 --- a/internal/demod/fm.go +++ b/internal/demod/fm.go @@ -24,12 +24,16 @@ func (NFM) Channels() int { return 1 } func (WFM) Channels() int { return 1 } func (WFMStereo) Channels() int { return 2 } +func wfmMonoBase(iq []complex64) []float32 { + return fmDiscrim(iq) +} + func (NFM) Demod(iq []complex64, sampleRate int) []float32 { return fmDiscrim(iq) } func (WFM) Demod(iq []complex64, sampleRate int) []float32 { - return fmDiscrim(iq) + return wfmMonoBase(iq) } func (WFMStereo) Demod(iq []complex64, sampleRate int) []float32 { @@ -86,7 +90,7 @@ func wfmStereo(iq []complex64, sampleRate int) []float32 { // RDSBaseband returns a rough 57k baseband (not decoded). func RDSBaseband(iq []complex64, sampleRate int) []float32 { - base := fmDiscrim(iq) + base := wfmMonoBase(iq) if len(base) == 0 { return nil }