Files
questshock/modding/hacked/ss1/content/audio/L8.go
T

21 lines
433 B
Go

package audio
// L8 is a raw, linear 8-bit sound snippet.
type L8 struct {
SampleRate float32
Samples []byte
}
// Empty returns true if there are no samples to play.
func (sound L8) Empty() bool {
return len(sound.Samples) == 0
}
// Duration returns the length of the sound in seconds.
func (sound L8) Duration() float32 {
if sound.SampleRate <= 0 {
return 0.0
}
return float32(len(sound.Samples)) / sound.SampleRate
}