[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] pygame.mixer failure on Mac OS X
On Fri, Jul 30, 2004 at 02:55:50PM -0400, Bob Ippolito wrote:
>
> On Jul 30, 2004, at 2:48 PM, Bob Ippolito wrote:
>
> > On Jul 30, 2004, at 2:39 PM, Bob the Hamster wrote:
> >
> >> Hey, y'all. Anybody else using PyGame on Mac OS X? I installed it
> >> using
> >> the pre-built packages from http://undefined.org/python/pimp/ and it
> >> was
> >> working perfectly until I started to plaay around with pygame.mixer
> >>
> >> I added .ogg music and sound effects to my game, and they worked fine
> >> on
> >> both my GNU/Linux boxes, and on both Windows98 and WindowsXP boxes I
> >> tested with, but on my Mac OS X box, it hangs on
> >> pygame.mixer.Sound(filename) and the processor usage spikes. I have to
> >> force-quit the python interpreter.
> >>
> >> I strongly suspect that this is because the ogg vorbis libraries are
> >> completely missing in the Mac OS X prebuilt packages. The description
> >> for the "sdl_pygame_deps 1.2.6" package says: "SDL, SDL_image,
> >> SDL_mixer, SDL_ttf, smpeg for pygame" but it says nothing about ogg
> >> vorbis.
> >>
> >> So my questions:
> >>
> >> (1) Does anybody know how to get this fixed? Or worked-around?
> >
> > Compile it yourself. I thought it had ogg support, but I don't really
> > have time to build another right now.
> >
> >> (2) Does anybody know how to detect that the program is running on Mac
> >> OS X so I can disable sound support until I figure out (1)? Python's
> >> os.name == 'posix' on Mac OS X, same as on GNU/Linux, so I can'tt use
> >> that.
> >
> > sys.platform == 'darwin' -- but it's not the platform's fault, it's
> > the particular package you are using. You are better off trying to
> > play the sound file, and if it fails, just don't try and play any more
> > sound files. Python has exceptions for a reason.
>
> Oh sorry, I didn't read your whole message. Actually, I'm not sure
> your guess is correct, you should really break into the process and get
> a backtrace with GDB, get a sample from Activity Monitor, use Shark, or
> something like that to see what it's doing when the CPU is thrashing.
> Another thing you could do is post a minimal script and ogg file that
> breaks and I may have a chance to try and reproduce/fix it myself.
Aha! Interesting. When I reduced the problem to an ultra-simplified
test-case, (which you can find at
http://gilgamesh.dnsalias.org:8080/~james/mac-ogg-lock.tar.bz2 ) I got
different behavior. pygame.mixer.Sound(filename) would cause the CPU to
spike to 100% usage for about 10-12 seconds, and then move on. If I
tried playing the sound afterwards, there would be no sound.
I tried running my game again, this time waiting patiently. After about
3 minutes of CPU-going-crazy while loading all my sound effects it moved
on, and started the game as normal. So it is not hanging, as I
originally reported, it is just failing remarkably slowly :)
---
Bob the Hamster