how to control sound when playing?

31 views
Skip to first unread message

ikaros

unread,
May 12, 2012, 5:48:07 AM5/12/12
to pyglet...@googlegroups.com
Hi, 

I'm pretty new to pyglet, and actually to python kind of the same.

I'm developing a small app without GUI that would have to be able to play songs and stop them according to some data that comes from a serial device.

The serial interfacing works perfectly, but I can't manage to make pyglet work "asynchronic" without a GUI. I have seen that it is easy to do it with window events, but since my inputs come from data read by the same python programme, I don't know how to do it.

Summing up, I would like the following:

my_player.play(songname)
[do events]...
if(serial.order='stop'):
my_player.stop()


It could be possible with threading, but there should be for sure an easy way to do it.

Thanks a lot in advance. 

Nathan

unread,
May 15, 2012, 12:04:59 PM5/15/12
to pyglet...@googlegroups.com
You could schedule a function to run your "if(serial.order='stop'):"
code every iteration of the event loop. See:

http://pyglet.org/doc/programming_guide/the_application_event_loop.html

~ Nathan
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pyglet-users/-/qmj0pwsFur4J.
> 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.
Reply all
Reply to author
Forward
0 new messages