Correct AddFloat/AddShort
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
ffc70c6395
commit
3299585e6a
|
@ -141,7 +141,7 @@ func (s *State) GetLoudnessShortTerm() (out float64, err error) {
|
|||
}
|
||||
|
||||
func (s *State) AddFloat(src []float32) error {
|
||||
ret := C.ebur128_add_frames_float(s.p, (*C.float)(&src[0]), C.size_t(len(src)))
|
||||
ret := C.ebur128_add_frames_float(s.p, (*C.float)(&src[0]), C.size_t(len(src)/s.channels))
|
||||
if ret != C.EBUR128_SUCCESS {
|
||||
return fmt.Errorf("error adding frames: %d", ret)
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ func (s *State) AddFloat(src []float32) error {
|
|||
}
|
||||
|
||||
func (s *State) AddShort(src []int16) error {
|
||||
ret := C.ebur128_add_frames_short(s.p, (*C.short)(&src[0]), C.size_t(len(src)))
|
||||
ret := C.ebur128_add_frames_short(s.p, (*C.short)(&src[0]), C.size_t(len(src)/s.channels))
|
||||
if ret != C.EBUR128_SUCCESS {
|
||||
return fmt.Errorf("error adding frames: %d", ret)
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ func TestFloat(t *testing.T) {
|
|||
}
|
||||
|
||||
result := fmt.Sprintf("%f dB, %f", loudness, maxPeak)
|
||||
expected := "-14.927264 dB, 0.666256"
|
||||
expected := "-15.060377 dB, 0.666256"
|
||||
if result != expected {
|
||||
t.Errorf("expected %s, got %s", expected, result)
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ func TestShort(t *testing.T) {
|
|||
}
|
||||
|
||||
result := fmt.Sprintf("%f dB, %f", loudness, maxPeak)
|
||||
expected := "-14.927263 dB, 0.666260"
|
||||
expected := "-15.060377 dB, 0.666260"
|
||||
if result != expected {
|
||||
t.Errorf("expected %s, got %s", expected, result)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue