Hi all, Just wanted to let you know that I am looking at pyglet.media in depth and am adding full test coverage. Then I can test whether behaviour is exactly the same on all platforms. For Linux and Windows I can test it myself. OSX is tricky, as I don't have the hardware. Trying to see if I can borrow something at work (yeah great, our product needs to support OSX and iOS, but hardware..nope).
Rob Op vrijdag 20 februari 2015 20:03:15 UTC+1 schreef Rob: > > Ok, I found the full solution. Even though I thought it was not relying on > the event loop, it actually is. > > If you do not use the event loop, you need to call player.next_source() > manually whenever a source group is empty. Normally a 'on_source_group_eos' > event is dispatched using the event loop. > > I will be submitting the fix for deletion of players with a simple test. > > Rob > > Op vrijdag 20 februari 2015 19:47:44 UTC+1 schreef Rob: >> >> There is a problem in the PulseAudioPlayer. One issue was the deletion of >> old players. I fixed that. The next is that it does not switch to the next >> SourceGroup when it is added with queue(). Still figuring that one out. >> >> Rob >> >> Op donderdag 19 februari 2015 20:15:48 UTC+1 schreef Rob: >>> >>> I can reproduce the problem locally. I created a test case to work with >>> it. I already noticed a problem when calling player.delete(), so might be a >>> problem in the pulseaudio implementation. I will start tracing to see what >>> is going on. >>> >>> Rob >>> >>> Op woensdag 18 februari 2015 20:32:21 UTC+1 schreef Rob: >>>> >>>> The audio players use their own threading. In case of PulseAudio this >>>> is a thread from libpulse. So the application event loop should not be >>>> necessary. I did not have time to check it out yet, the current tests for >>>> media playback do not work :-(. >>>> >>>> Rob >>>> >>>> Op woensdag 18 februari 2015 08:01:44 UTC+1 schreef Sebastian Meyer: >>>>> >>>>> I tried to put app.run() into its own thread. But it fails: >>>>> >>>>> from threading import Thread >>>>> import pyglet >>>>> >>>>> class SoundThread(Thread): >>>>> >>>>> def __init__(self, pyglet): >>>>> Thread.__init__(self) >>>>> self.pyglet = pyglet >>>>> >>>>> def run(self): >>>>> self.pyglet.app.run() >>>>> >>>>> sthread = SoundThread(pyglet) >>>>> sthread.start() >>>>> >>>>> def play_sound(): >>>>> path = "test.wav" >>>>> source = pyglet.media.load(path, streaming=False) >>>>> player.queue(source) >>>>> >>>>> If I call play_sound() it will play the sound once. Then, after it >>>>> ended, following error occurs: >>>>> >>>>> ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected >>>>> CFunctionType instance instead of NoneType >>>>> >>>>> In the self.pyglet.app.run()inside the thread. >>>>> >>>>> >>>>> >>>>> I also make some tests with the code before adding the Thread and it >>>>> seems that the first sound is played and the queque does not jump to the >>>>> next if one is added to the queue. Reading player.source and player.time, >>>>> after the sound is played one time, says: source last played source, time >>>>> is the length of the audiofile. But it does not use the next source. I >>>>> tried player.next_source(); player.play() if source is not None >>>>> before adding to queue, but it makes no difference. >>>>> >>>>> /Sebastian >>>>> >>>>> Am Dienstag, 17. Februar 2015 22:52:52 UTC+1 schrieb Sebastian Meyer: >>>>>> >>>>>> No. For testing I loaded all Sounds as pyglet.media.StaticSound into >>>>>> a dict and call it from there. Same there: only the first sound works. >>>>>> Maybe the missing pyglet-loop because I don't run pyglet.app.run() ? >>>>>> >>>>>> Am Dienstag, 17. Februar 2015 22:40:46 UTC+1 schrieb Richard Jones: >>>>>>> >>>>>>> Does pre-loading all the sounds make a difference? >>>>>>> >>>>>>> On Wed Feb 18 2015 at 8:21:19 AM Sebastian Meyer < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> Hmm, ok that sounds possible. >>>>>>>> I tried this: >>>>>>>> >>>>>>>> player = pyglet.media.Player() # init player >>>>>>>> player.play() # let player play >>>>>>>> >>>>>>>> def play_sound(name): >>>>>>>> path = name + ".wav" >>>>>>>> source = pyglet.media.load(path, streaming=False) >>>>>>>> print "Playing sound!", name >>>>>>>> player.queue(source) >>>>>>>> >>>>>>>> >>>>>>>> This works for exactly one sound. The second call of the function >>>>>>>> brings the print-statement but no sound. >>>>>>>> Did I missunderstand something? >>>>>>>> I tried also a player.play() after adding the source to the queue - >>>>>>>> same result. >>>>>>>> >>>>>>>> Thanks, >>>>>>>> Sebastian >>>>>>>> >>>>>>>> >>>>>>>> Am Dienstag, 17. Februar 2015 17:05:43 UTC+1 schrieb Rob: >>>>>>>> >>>>>>>>> I suspect a new player is created for every sound. The player >>>>>>>>> registers a stream. As long as the player is not destroyed, the >>>>>>>>> stream >>>>>>>>> remains active. Try if you can control a single player: >>>>>>>>> http://pyglet.readthedocs.org/en/pyglet-1.2- >>>>>>>>> maintenance/programming_guide/media.html >>>>>>>>> >>>>>>>>> Rob >>>>>>>>> >>>>>>>>> Op dinsdag 17 februari 2015 11:36:41 UTC+1 schreef Sebastian Meyer: >>>>>>>>>> >>>>>>>>>> Hi there! >>>>>>>>>> >>>>>>>>>> I have a small project which uses pyQt for the GUI. It is >>>>>>>>>> OS-independent and I want to add some sound-notifacation on it. >>>>>>>>>> After some searching I decided the best solution to have >>>>>>>>>> OS-independent sound-output is using pyglet for it. And it works >>>>>>>>>> great. >>>>>>>>>> >>>>>>>>>> But there is one problem: >>>>>>>>>> I'm using Linux with KDE and the mixer for adjusting the >>>>>>>>>> volume-level shows a modulator for every program that plays sound. >>>>>>>>>> But for my programm it shows a new regulator everytime I use >>>>>>>>>> pyglet to play a sound. So after the first sound, there appears one, >>>>>>>>>> after >>>>>>>>>> the second there are two and so on. >>>>>>>>>> >>>>>>>>>> I'm playing the sound as descripted here: >>>>>>>>>> http://www.pyglet.org/doc/programming_guide/playing_ >>>>>>>>>> sounds_and_music.html >>>>>>>>>> >>>>>>>>>> Any ideas? >>>>>>>>>> >>>>>>>>>> Cheers >>>>>>>>>> Sebastian >>>>>>>>>> >>>>>>>>> -- >>>>>>>> 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 http://groups.google.com/group/pyglet-users. >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> -- 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 http://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
