Enabled all decoding tests again, Opus improvement
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2022-02-22 20:14:19 +01:00
parent 21efea8dd1
commit 53375704b4
2 changed files with 11 additions and 3 deletions

View file

@ -6,6 +6,9 @@ import (
"git.gammaspectra.live/S.O.N.G/Kirika/audio"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/flac"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/mp3"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/opus"
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/tta"
"git.gammaspectra.live/S.O.N.G/Kirika/hasher"
"os"
"path"
@ -55,7 +58,6 @@ func doTest(format format.Format, ext string, t *testing.T) {
}
}
/*
func TestFLACDecode(t *testing.T) {
doTest(flac.NewFormat(), ".flac", t)
}
@ -68,7 +70,6 @@ func TestOpusDecode(t *testing.T) {
func TestMP3Decode(t *testing.T) {
doTest(mp3.NewFormat(), ".mp3", t)
}
*/
func TestHasher24(t *testing.T) {

View file

@ -31,15 +31,22 @@ func (f Format) Open(r io.ReadSeekCloser) (audio.Source, error) {
defer stream.Close()
defer close(newChannel)
blockSize := BlockSize * 2
for {
buf := make([]float32, BlockSize*2)
buf := make([]float32, blockSize)
n, err := stream.ReadStereoFloat32(buf)
if err != nil {
return
}
blockSize = n
if blockSize < 1024 {
blockSize = 1024
}
if n > 0 {
newChannel <- buf[:n*2]
}