Revert test function inline, added special case for two channels on shared.go
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2222e280fc
commit
92541a6f4e
|
@ -114,22 +114,20 @@ func TestAlbumReplayGain(t *testing.T) {
|
|||
t.Error(err)
|
||||
return
|
||||
}
|
||||
func() {
|
||||
defer fp.Close()
|
||||
decoders, err := guess.GetDecoders(fp, fullPath)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
source, err := guess.Open(fp, decoders)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
sources = append(sources, source)
|
||||
}()
|
||||
defer fp.Close()
|
||||
decoders, err := guess.GetDecoders(fp, fullPath)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
source, err := guess.Open(fp, decoders)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
sources = append(sources, source)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,9 @@ func MultipleChannelsToMonoFloat32(buffer []float32, channels int) (buf []float3
|
|||
|
||||
// MultipleChannelsToStereoFloat32 bring any number of channels to stereo, using downmix formulas when necessary
|
||||
func MultipleChannelsToStereoFloat32(buffer []float32, channels int) (buf []float32) {
|
||||
buf = make([]float32, (len(buffer)/channels)*2)
|
||||
if channels != 2 {
|
||||
buf = make([]float32, (len(buffer)/channels)*2)
|
||||
}
|
||||
|
||||
var samples int
|
||||
surroundMix := 1 / float32(math.Sqrt(2))
|
||||
|
@ -107,7 +109,9 @@ func MultipleChannelsToMonoInt32(buffer []int32, channels int) (buf []int32) {
|
|||
|
||||
// MultipleChannelsToStereoInt32 bring any number of channels to stereo, using downmix formulas when necessary
|
||||
func MultipleChannelsToStereoInt32(buffer []int32, channels int) (buf []int32) {
|
||||
buf = make([]int32, (len(buffer)/channels)*2)
|
||||
if channels != 2 {
|
||||
buf = make([]int32, (len(buffer)/channels)*2)
|
||||
}
|
||||
|
||||
var samples int
|
||||
surroundMix := 1 / float32(math.Sqrt(2))
|
||||
|
@ -120,7 +124,7 @@ func MultipleChannelsToStereoInt32(buffer []int32, channels int) (buf []int32) {
|
|||
}
|
||||
break
|
||||
case 2: //copy
|
||||
return slices.Clone(buffer)
|
||||
buf = slices.Clone(buffer)
|
||||
break
|
||||
case 3: //2.1, FL, FR, LFE
|
||||
for i := 0; i < len(buffer); i += 3 {
|
||||
|
|
Loading…
Reference in a new issue