// PlayWAV plays the sound from a wav file and returns a Sound for it. func PlayWAV(path string, repeat bool) *Sound { data, ok := sounds[path] if !ok { var err error if data, err = loadWAV(path); err != nil { panic(err) } sounds[path] = data } C.SDL_LockAudio() defer C.SDL_UnlockAudio() s := &Sound{audioData: data, repeat: repeat} playing = append(playing, s) return s }
func LockAudio() { C.SDL_LockAudio() }
// Stop stops the sound from playing. func (s *Sound) Stop() { C.SDL_LockAudio() defer C.SDL_UnlockAudio() s.repeat = false s.pos = 0 }