From bc9f7e0893d5536dcc19c005380545fcce4ecfa1 Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Wed, 22 May 2024 14:57:33 +0200 Subject: [PATCH] Revert remove format --- vorbis/decode.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vorbis/decode.go b/vorbis/decode.go index b87783f..e2ebd7d 100644 --- a/vorbis/decode.go +++ b/vorbis/decode.go @@ -30,6 +30,17 @@ func Decode(rc io.ReadCloser) (s beep.StreamSeekCloser, format beep.Format, err return nil, beep.Format{}, err } + channels := d.Channels() + if channels > 2 { + channels = 2 + } + + format = beep.Format{ + SampleRate: beep.SampleRate(d.SampleRate()), + NumChannels: channels, + Precision: govorbisPrecision, + } + return &decoder{rc, d, make([]float32, d.Channels()), nil}, format, nil }