Sound delay with SDL_mixer && Windows

I’m having a problem witth SDL_mixer.

When running FreeBSD, the sound plays with much less delay than with
Windows. I have searcht the list archives for this Problem, but only
found other people with the same problem, and no answers.

I am using the precompiled .dlls from the SDL website
(SDL-devel-1.2.6-mingw32.tar.gz, SDL_mixer-1.2.5a-win32.zip)

I have used the following simple test program to exclude any of my other
code as possible cause for the delay:

#include <stdio.h>
#include <stdlib.h>
#include “SDL.h”
#include “SDL_mixer.h”

Mix_Chunk *phaser = NULL;
void handleKey(SDL_KeyboardEvent key);

int main(int argc,char **argv){
SDL_Surface *screen;
SDL_Event event;
int done = 0;

SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);

if(Mix_OpenAudio(22050, AUDIO_S16, 2, 256)) {
printf(“Unable to open audio!\n”);
exit(1);
}

phaser = Mix_LoadWAV(“phaser.wav”);
screen = SDL_SetVideoMode(320, 240, 0, 0);

while(!done) {
while(SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_QUIT:
done = 1; break;
case SDL_KEYDOWN:
Mix_PlayChannel(-1, phaser, 0); break;
}
}
}
Mix_CloseAudio();
SDL_Quit();
}

Can anyone help me with this problem?

CU,
Sec–
Error reduces
Your expensive computer
To a simple stone

Hi,On Mon, Jun 14, 2004 at 18:07 +0200, Stefan Sec Zehl wrote:

I’m having a problem witth SDL_mixer.

When running FreeBSD, the sound plays with much less delay than with
Windows. I have searcht the list archives for this Problem, but only
found other people with the same problem, and no answers.

I am using the precompiled .dlls from the SDL website
(SDL-devel-1.2.6-mingw32.tar.gz, SDL_mixer-1.2.5a-win32.zip)

Just for the sake of the reference, I found the solution after digging
through the source of SDL_mixer and SDL - It is a problem specific
to Windows XP / libSDL-1.2.6 (and possibly earlier). Upgrading to SDL
1.2.7 fixed it.

Thanks anyway,
Sec

The Feynman problem solving Algorithm
1) Write down the problem
2) Think real hard
3) Write down the answer