Added window methods
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2022-03-08 12:37:19 +01:00
parent 3299585e6a
commit afad5c6e5c
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk

View file

@ -8,6 +8,7 @@ package libebur128
import "C"
import (
"fmt"
"time"
)
type Ebur128Mode int
@ -120,6 +121,25 @@ func GetLoudnessGlobalMultiple(states []*State) (out float64, err error) {
return float64(i), nil
}
//SetMaxWindow Set the maximum window duration.
func (s *State) SetMaxWindow(window time.Duration) (err error) {
ret := C.ebur128_set_max_window(s.p, C.ulong(window.Milliseconds()))
if ret != C.EBUR128_SUCCESS {
return fmt.Errorf("error calculating loudness: %d", ret)
}
return nil
}
//GetLoudnessWindow Get loudness of the specified window in LUFS.
func (s *State) GetLoudnessWindow(window time.Duration) (out float64, err error) {
var i C.double
ret := C.ebur128_loudness_window(s.p, C.ulong(window.Milliseconds()), &i)
if ret != C.EBUR128_SUCCESS {
return float64(i), fmt.Errorf("error calculating loudness: %d", ret)
}
return float64(i), nil
}
//GetLoudnessMomentary Get momentary loudness (last 400ms) in LUFS.
func (s *State) GetLoudnessMomentary() (out float64, err error) {
var i C.double