Hello,

Would it be possible to arrange things so that an infinite 
> iterator can be passed to get the effect of a looping group? 
>
> That seems like the most general and Pythonic solution to me. 
> It means you'd be able to set up any kind of looping structure 
> you wanted by making the iterator behave appropriately. 
>

Although this seems like an excellent idea, I think we still want to allow 
the player to skip a Source which is supposed to loop forever. If we would 
use the idea of an iterator, one could create it this way:

from itertools import chain, repeat

intro = pyglet.resource.media("intro.mp3")
main_theme = pyglet.resource.media("main_theme.mp3")
ending = pyglet.resource.media("ending.mp3")

my_playlist = chain(intro, repeat(main_theme), ending)
player.queue(my_playlist)

The idea is that the intro plays once, then the main_theme loops over until 
player.next_source() is called. But if this just takes the next element in 
the my_playlist iterator, we will never reach the ending song as the 
repeat(main_theme) will provide an infinite amount of sources.

If I think about a Media Player, the usual functionalities are : play once, 
repeat one song, repeat the whole playlist. So I think this is what we 
should try to implement. I guess that the current behaviour of discarding a 
Source once it is played is actually surprising to the user. I would then 
make this an option, but not the default.

I will make some tests and see if memory-wise it's not too hungry.

Daniel

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to