Pygame and Blender 2.49 issue

Does anyone know why in 2.49 pygame plays sounds about half a second after the event that triggers it?
Thae same file play sounds right in 2.45, 2.46, 2.47 and 2.48 but not in 2.49.

Hum… Works for me, do you get any errors?

Nope, everything is fine, just the sound comes after 0.5 sec with blender 2.49.
I have a key sensor, when the key is pressed there is a sound, that pygame must play, but it comes after some time, in 2.45-2.48 the sound plays immediately(thats how it must be.)
Are you using blender 2.49 and witch version exactly?

Blender does this on startup. because without it, some OpenGL drivers crash when initializing SDL.
BLI_setenv(“SDL_VIDEODRIVER”, “dummy”)

I added for 2.49 IIRC, you could use python to remove this env var before pygame starts.

I use 2.49b

Blender does this on startup. because without it, some OpenGL drivers crash when initializing SDL.
BLI_setenv(“SDL_VIDEODRIVER”, “dummy”)
I added for 2.49 IIRC, you could use python to remove this env var before pygame starts.

I see.
So if I remove this var the sound from pygame will play immediately, right!?
Can you tell me how I can remove it exactly? Are you planning some kind of fix for this in the future versions?

The fix for this in future versions is a better sound system so you don’t have to rely on PyGame. :wink:

I find a way to set this variable:

import os
 
os.environ['SDL_VIDEODRIVER'] = 'dummy'
import pygame
pygame.init()
pygame.display.set_mode((1,1))
 
while 1:
    events = pygame.event.get()
    for e in events:
        pass

So what I must do? Set SDL_VIDEODRIVER to something else?
And what is other than ‘dummy’ options?
Maybe something like:

del os.environ['SDL_VIDEODRIVER']

or?

this is typical python stuff, nothing blender spesific, try removing the SDL_VIDEODRIVER env var from blenders python after blender starts, before pygame runs.

for managing environment variables look up python docs.

Well I removed this variable,before pygame starts, but still the sound plays 0.5 sec after the event that triggers it.
In the pygame init.py file they set the SDL_VIDEODRIVER to ‘direcx’ by default for windows, i removed this settings too, but still the problem stays.
I think its not connected with this environment variable.