Skip to content

Commit 060b678

Browse files
committed
refactor: remove unsued Vorbis metadata normalization
1 parent 71b865f commit 060b678

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

vorbis/metadata.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"errors"
77
"fmt"
88
"io"
9-
"math"
109

1110
librespot "github.com/devgianlu/go-librespot"
1211
"github.com/xlab/vorbis-go/vorbis"
@@ -184,26 +183,6 @@ func ExtractMetadataPage(log librespot.Logger, r io.ReaderAt, limit int64) (libr
184183
return io.NewSectionReader(r, int64(syncState.Returned), limit-int64(syncState.Returned)), &metadata, nil
185184
}
186185

187-
func (m MetadataPage) GetTrackFactor(normalisationPregain float32) float32 {
188-
normalisationFactor := float32(math.Pow(10, float64((m.trackGainDb+normalisationPregain)/20)))
189-
if normalisationFactor*m.trackPeak > 1 {
190-
m.log.Warn("reducing track normalisation factor to prevent clipping, please add negative pregain to avoid")
191-
normalisationFactor = 1 / m.trackPeak
192-
}
193-
194-
return normalisationFactor
195-
}
196-
197-
func (m MetadataPage) GetAlbumFactor(normalisationPregain float32) float32 {
198-
normalisationFactor := float32(math.Pow(10, float64((m.albumGainDb+normalisationPregain)/20)))
199-
if normalisationFactor*m.albumPeak > 1 {
200-
m.log.Warn("reducing album normalisation factor to prevent clipping, please add negative pregain to avoid")
201-
normalisationFactor = 1 / m.albumPeak
202-
}
203-
204-
return normalisationFactor
205-
}
206-
207186
func (m MetadataPage) GetSeekPosition(samplesPos int64) int64 {
208187
// figure out a relative position based on samples and clamp it to [0,100)
209188
samplesRelPos := float32(samplesPos) * 100 / float32(m.seekSamples)

0 commit comments

Comments
 (0)