Beispiel #1
0
// Play (https://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_57.html)
func (music *Music) Play(loops int) error {
	_music := (*C.Mix_Music)(unsafe.Pointer(music))
	_loops := (C.int)(loops)
	if C.Mix_PlayMusic(_music, _loops) == -1 {
		return sdl.GetError()
	}
	return nil
}
Beispiel #2
0
// Play the music and loop a specified number of times.  Passing -1 makes
// the music loop continuously.
func (m *Music) PlayMusic(loops int) int {
	return int(C.Mix_PlayMusic(m.cmusic, C.int(loops)))
}
Beispiel #3
0
// Play music
// If 'loops' is greater than zero, loop the sound that many times.
// If 'loops' is -1, loop inifinitely (~65000 times).
func PlayMusic(music * C.Mix_Music, loops int) (int) {
  return int(C.Mix_PlayMusic(music, C.int(loops)))
}
Beispiel #4
0
func (music *Music) Play(loops int) bool {
	_music := (*C.Mix_Music)(unsafe.Pointer(music))
	_loops := (C.int)(loops)
	return int(C.Mix_PlayMusic(_music, _loops)) == 0
}
Beispiel #5
0
func (t *Music) PlayLoops(loops int) {
	if C.Mix_PlayMusic(t.mus, C.int(loops)) == -1 {
		panic(fmt.Sprintf("Unable to play Music file (%v): %v", t.name, util.GetMixError()))
	}
}