[SDL] Irregular sound callback under Linux

Sam Lantinga slouken at devolution.com
Fri Jul 26 21:41:01 PDT 2002


> Hi,

> I'm having problems smoothing out my emulator sound code under Linux,
> even though the same code runs just fine under BeOS and Win32.

> I'm using SDL 1.2.4, Mandrake 8.2 (with artsd deactivating after 1
> second idle) and a Sonic Fury sound card (Santa Cruz chipset).  For my
> tests I'm using 44.1KHz 16-bit stereo, with 2048 samples passed to
> SDL_OpenAudio.

> After adding some debugging code I've spotted the calls to the sound
> callback are very irregular.  Sometimes they come through in bursts of
> 3 calls within a couple of milliseconds, and then a gap up to the next
> time.  By using my own buffer of around 8000 samples I can smooth the
> audio out myself, but it also introduces horrible lag.

> Has anyone seen this happen, or know what might be happening?

It sounds like the sound card driver may not support 2048 fragment size
internally.  Try using the SDL dma audio driver.. that may work better,
but I don't really recommend it for general use.

See ya,
	-Sam Lantinga, Software Engineer, Blizzard Entertainment




More information about the SDL mailing list