示例#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
}
示例#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)))
}
示例#3
0
文件: mixer.go 项目: beoran/fungo
// 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)))
}
示例#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
}
示例#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()))
	}
}