[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Patch - Re-add music support for file-like objects
I'm not sure that there is a bug in rwobject - I just think that your new music from a file-like object code is using rwobject in a way that it has not been designed to support.
SDL's music playing stuff is streaming, while sounds all load at once. Likewise fonts all load at once. So in existing uses of rwobject, SDL is totally done with the file-like object by the time things get back to python-land. To be sure, I tried the code below, no crash.
-------------
import pygame
pygame.init()
pygame.display.set_mode((320,200))
sound = pygame.mixer.Sound(file("fiddling.ogg", "rb"))
print "loaded!"
channel = sound.play()
print "playing!"
while channel.get_sound() != None:
pass
print "done playing!"
On Tue, Jul 8, 2008 at 8:09 AM, Forrest Voight <voights@xxxxxxxxx> wrote:
Also, I found a bug in rwobject. It makes a standard SDL_RWops from
python file objects but doesn't hold a reference to them.
This is shown by doing something like:
pygame.mixer.music.load(open('x.mp3'))
Then playing it, and pygame crashes.
This is not my patch's fault, it just exposes it.