Audio stuttering and slow

Is anyone else having problems with the allegro audio code? I'm trying to play music but there's a slight stuttering noticable as well as it being played a fraction slower from what it ought to be. I have tried .mod and .flac audio files and it occurs with both so it's not specific to the dumb library.

I'm using the allegro 5.0.1 precompiled binaries for windows because I can't get all the dependencies installed correctly myself.

Compiling on msvc 10.0 on windows 7 64-bit (compiling as 32-bit), using static linking. I have tried using the examples but those have the same audio problems so I don't think it's specific to my code.

Winamp ofcourse plays them fine and there's no absurd peak in processor resources or anything. I'm kinda clueless about what could be going on.

Should I try to put the whole audio code in a seperate thread perhaps? I'm new to windows programming so that'd be a bit of a task to figure out but if it could help...
I'm at a very early stage of testing/development so other then waiting for events, my main loop isn't doing much else.

The only thing improving things I found out so far is running the process at 'high priority'. That makes it play full-speed and reduces the stuttering to near to 0. But I don't think that's a proper solution.

Matthew Leverton

What sound card / CPU do you have?

Try creating a file called allegro5.cfg (put it next to your exe) that looks like:


Or, I think you can do this:

ALLEGRO_CONFIG *cfg = al_get_system_config();
al_set_config_value(cfg, "directsound", "buffer_size", "8192");

as long as you do that after initializing Allegro and before you initialize the audio addon.


Soundcard: Soundblaster X-Fi Fatal1ty
Processor: AMD Athlon 64 3500+

Creating the allegro5.cfg improved things a great deal. I'm still going to try the in-code version but so far things look good. The only time it stutters now is when I taskswitch or do other things while music is playing.

I thought the buffers in the al_load_audio_stream would accomplish a similar improvement, but changing those only made a tiny improvement and nothing major like the config file did.

Thanks for your help. ;D

Thread #606806. Printed from