2011/5/27 pyglet <l.lati...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "pyglet-users" group.
> To post to this group, send email to pyglet...@googlegroups.com.
> To unsubscribe from this group, send email to pyglet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
>
>
Usage:
# we grab the source to StringIO (doesnt have to be, but its better
not to read from the hdd all the time)
media = open("foo.mp3", "rb")
source = StringIO.StringIO(media.read())
media.close()
# we make player instance
player = Player()
# We pass the data to the player and run the thread (it will not start
the playback until we run .play() method though
player.add_data(source, "foo.mp3")
player.run()
# we set up the exception callback if we need the info that playback failed
player.set_exception_callback(my_exception_catching_func)
# we start the playback
player.play()
# we change the volume to 50%
player.volume = 0.5
# we pause player
player.pause()
# we resume player
player.resume()
or
player.play()
# we loop player
player.change_repeat(True)
or
player.repeat = True
# we end the playback
player.stop()
I use it in my cocos2d + pyglet based game and it does not lag at all,
unlike the original player.
Hope it helps!
2011/5/28 Peter Enerccio <ener...@gmail.com>: