I think I can answer #2.

I've played around abit lately with the audio and player functions in 
pyglet, and yes you can load sounds into a player before hand to play as 
you want.

player = pyglet.media.Player()
sound = pyglet.resource.media('sound.wav',streaming=False)
player.queue(sound)
player.play()

When you play a sound source it also return's a player class, which you an 
also treat as a regular player:

sound = pyglet.resource.media('sound.wav')
player = sound.play()
player.queue(sound)
player.play()

The problem however is that re-loading each sound into the queue can cause 
a noticable delay in playback as its loaded into the audio buffer. Another 
problem is that once the sound is done playing, its removed from the 
queue/buffer, and if you try pre-loading  them you also get a noticable 
delay in when the sounds are played. You could try seeking back to the 
beginning of a sound before it finished playing, but that can also 
potentially cause distorsions on playback.

There are a few ways the Player can handle the end of a sound as well with 
the eos_action variable, such as Pausing when a sound finishes, Next to 
play the next sound in the queue automatically, and Loop, which will play 
the sound over and over again forever when you hit play only once.

I've been thinking lately about taking a closer look at the Player class 
and trying to add a new eos_action function like "replay", which would 
return to the start of the sound and pause the player, and wait for the 
next time *.play() is called so you don't have to keep generating new 
Players everytime.

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to