SDL_mixer pausing main thread using Mix_PlayChannel()

Hello people,

earlier today I decided change my game to use SDL_mixer instead of my
own SDL sound code. My primary development platform is Windows, under
which SDL_mixer works perfectly in my game. Let’s jump directly to my
problem:

On Linux (debian, i386, kernel 2.6.9), when I use Mix_PlayChannel() to
play a loaded chunk of sound, my main thread simply stalls for a short
duration of time, after which it plays the sound seemingly okay.

Can anyone on the spot tell me I’m stupid and doing something
obviously wrong? :slight_smile:

Here’s approximately the code I have related to SDL_mixer:

Mix_OpenAudio(22050,AUDIO_S16,2,1024);
Mix_AllocateChannels(1);

somechunk = Mix_LoadWAV_RW(someRWops,1);

Mix_PlayChannel(-1,somechunk,0);

Nope, that isn’t much, and it annoys me a lot that such a minimal
thing won’t work. By the way, the sound loaded is a .ogg-file. Can it
be that it want to decode it each time I try to play it? - but that
doesn’t answer why it works fine on Windows.

All help appreciated, thanks! :)–
Best Regards,
Rasmus Neckelmann

I ran into this before. On my system (Fedora Core 3) I found that arts was
causing the delay. It appears that it buffers the sound somehow and
schedules it to share the sound device. What I did was kill the arts
process and the delay went away.

Walt.> ----- Original Message -----

From: sdl-bounces+waltc=fleetwoodgaming.com@libsdl.org
[mailto:sdl-bounces+waltc=fleetwoodgaming.com at libsdl.org] On Behalf Of
Rasmus Neckelmann
Sent: Wednesday, October 26, 2005 2:53 PM
To: sdl at libsdl.org
Subject: [SDL] SDL_mixer pausing main thread using Mix_PlayChannel()

Hello people,

earlier today I decided change my game to use SDL_mixer instead of my
own SDL sound code. My primary development platform is Windows, under
which SDL_mixer works perfectly in my game. Let’s jump directly to my
problem:

On Linux (debian, i386, kernel 2.6.9), when I use Mix_PlayChannel() to
play a loaded chunk of sound, my main thread simply stalls for a short
duration of time, after which it plays the sound seemingly okay.

Can anyone on the spot tell me I’m stupid and doing something
obviously wrong? :slight_smile:

Here’s approximately the code I have related to SDL_mixer:

Mix_OpenAudio(22050,AUDIO_S16,2,1024);
Mix_AllocateChannels(1);

somechunk = Mix_LoadWAV_RW(someRWops,1);

Mix_PlayChannel(-1,somechunk,0);

Nope, that isn’t much, and it annoys me a lot that such a minimal
thing won’t work. By the way, the sound loaded is a .ogg-file. Can it
be that it want to decode it each time I try to play it? - but that
doesn’t answer why it works fine on Windows.

All help appreciated, thanks! :slight_smile:


Best Regards,
Rasmus Neckelmann


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl