[SDL] SDL_Mixer help

Steaphan Greene stea at cs.binghamton.edu
Mon Sep 25 14:26:04 PDT 2006

On Mon, Sep 25, 2006 at 04:46:52PM -0400, Steven Bradley wrote:
> I am a little puzzled with a program I am working on. As the title implies, 
> I am using SDL. My problem is with playing music files. I have animation, 
> sounds, input, and collision detection all working fine. The sounds are also 
> using SDL_Mixer.
> What happens is the music file loads fine (I have tried midi, mp3, ogg, and 
> wav) but only plays the first second and then repeats indefinitely. If I put 
> a call to SDL_Delay(xxxx) in there the music plays for the duration of the 
> delay without a problem.

Just a guess, but it seems your main program is eating all the CPU and
your audio mixer subsystem can't get a moment to update the buffer.  Try
adding SDL_Delay(10) to each iteration of your main loop and see if that
gives it the time it needs.

Steaphan Greene <sgreene at cs.binghamton.edu>
Lecturer, Computer Science, Binghamton University
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060925/928ebda5/attachment-0008.pgp>

More information about the SDL mailing list