[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame.init before pygame.mixer.init?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

RR4CLB wrote:
> Hi Clare,
> 
>     I still think it is the same problem as before. The get_busy is only busy when the file is playing. You have delayed it to allow the file to Queue in and that has fixed it. If your hard drive is slow that would cause it. Most things on the screen will not become active until the screen is active and that to is part of the issue. Whether threading is an issue, which allows somethings to move on while other things are still stuck in the mud has its problems...

To the best of my knowledge, when pygame.mixer.Sound() returns a Sound
object, this means the file has been read. No "queueing" happens here,
though it might for pygame.mixer.music.

>     Besides loading the initial package, load all the other packages. I am not sure, but I think some of the other packages have a better mixer in it.

As far as I know, there is only one pygame.mixer. There is also
pygame.mixer.music, but I don't think it's what Clare Richardson is
looking for.

>     You may just have a timing issue between machines that is being caught on an accumulation of issues. That may cause a problem in cross platform compatibility, but the get_busy is only active while a file is playing. It must be playing first for it to work. If not, you will just run through that while statement as if nothing ever played. The reason why putting a delay in has fixed the issue. You allowed the file to actually start playing so the busy is busy!

I think you might have misread Clare Richardson's post:

> I've been able to determine that pygame.mixer.get_busy() isn't
> failing, simply by replacing "pass" with print "Hello".

This suggests strongly that in all cases, the file is completely
loaded into memory, and that pygame.mixer is correctly figuring out
how long the sound should be playing, and even "playing", but that
somehow the sound isn't going anywhere.

I'm not an expert on pygame internals, especially on Windows, but the
fact that it works "better" after calling pygame.display.set_mode()
reminds me of some problems people used to have focusing on DirectX
windows. Namely: the application doesn't get access to sound,
graphics, etc. until it opens a window. However, my vague recollection
was also that DirectX was not the default any more.

To force a non-DirectX audio driver, you could try doing something like:

import pygame, os
os.environ['SDL_AUDIODRIVER'] = waveout'

before doing any pygame*.init(). As you may have gathered, I have no
idea if this will actually work.

Ethan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHDsEuhRlgoLPrRPwRAgXcAKC4hKmhx4uqHl3np7UGGMhXVUcX7QCdH3Qj
rH7E2DwjA30FDOVLsaPZrmk=
=4xyY
-----END PGP SIGNATURE-----