Hello all,

Well, after my novel introduction the other day I might as well
introduce myself.

I had been working on an audio playback library for python using
ffmpeg before pointed me to pyglet.
I'm actually looking to write a cross platform music player in the
vein of Amarok.

I'm using pyglet.media from inside of wxPython.  I'm currently using
ManagedSoundPlayers though I will probably have to improve or write my
own Player class eventually.

I was looking through the google hosted site the other day to see if
anyone had tried using just the media portion before from a GUI
library.  I didn't find anything so I proceeded to just try it.

I've had pretty good luck with running pyglet.media.dispatch_events
from a background thread.  When you try to use a message loop for
this, you'll run into some problems, on Windows at least.

When dragging a window, maximizing/minimizing, modal dialogs and many
other times your message loop doesn't get processed.  Which means
process_events won't get called causing stutter.  I'm not sure if this
is wxWidgets or Windows specific.  It's been a long time since I've
used straight windows api from C++.

There's one big caveat to this though.  You MUST synchronize access to
the players.  Acquire a Lock when calling dispatch_events and all
Player calls.  Not doing this can create some difficult to track down
problems.  Ask me how I know.  I spent way too much time trying to
find out why IDirectSoundBuffer::Lock was returning E_INVALIDARG.  It
was because of concurrency issues.

The reason I'm using ManagedSoundPlayers is some strangeness in Player
that I didn't dig too deep into.  The problem is stopping a song and
playing another with a pause between.  If you just want to change
immediately you could queue the second and call next.
I was doing this by calling next without queuing the next. Then
queuing the next and playing.  If there's a better way to do this
please let me know.

Attached is a fairly simple reason reproduction of the problem.  It's
not terribly important for me and If you'd like I could dig a bit
deeper to find the problem when I have some time.

All in all, it works fairly well.

There is one thing that I did have to add to avbin.py.  Exposing
AVbinFileInfo from AVbinSource to get at the song's metadata.

I just wanted to thank you, Alex, for the great library.

If anyone's curious the project's monotone web interface is at
http://mtn-host.prjek.net/viewmtn/tonal/

-- 
Bobby R. Ward
------------------------------
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Attachment: repro.py.gz
Description: GNU Zip compressed data

Reply via email to