Hi!
My problem is that when I play some chunk using Mix_PlayChannel(), it sounds about a second later than the call of the function.
I am using SDL 1.2.8 with SDL_mixer 1.2.6 and mingw32(Dev-C++).
Here are some snippets:
mixer::mixer(int frequency, int audio_channels, int chunksize)
{
music=NULL;
Uint16 format=AUDIO_S16SYS;
if((Mix_OpenAudio(frequency,format,audio_channels,chunksize))<0)
printf("Audio startup error: %s\r\n",Mix_GetError());
}
sound::sound()
{
chunk=NULL;
channel=-1;
}
int sound::loadfile(char* soundfile)
{
if(chunk) Mix_FreeChunk(chunk);
chunk=Mix_LoadWAV(soundfile);
return 0;
}
int sound::play(int channelreq,int loop)
{
return channel=Mix_PlayChannel(channelreq,chunk,loop);
}
No more than a wrapper class.
Here is how I load the sound:
mx=new mixer(44100,2,512);
mx->loadfile("mus.ogg");
mx->play(-1);
down=mx->newsound();
down->loadfile("down.wav");
After this, down->play(-1,0) delays a sec before I hear the sound.
I've tried several buffer sizes, frequencies, etc. to no avail.
Have you got any ideas?
Thanks in advance,
Thunder