SDL_Mixer lag

Hi, I know that this question has been answered before but I didn’t quite
understand the answer. I’m having the same problem with the marc marm (the
one who asked this question before). Peter Mulholland answered that the
problem was the backend that was used (ESD or Arts). Well, I don’t know
what ESD or Arts is. I don’t even know what a backend or a frontend is. :stuck_out_tongue:

My question is how do I choose the backend for SDL_Mixer?

BTW, I’m using Fedora Core 5 with KDE.

Thanks in advance.

Hi, I know that this question has been answered before but I didn’t quite
understand the answer. I’m having the same problem with the marc marm (the
one who asked this question before). Peter Mulholland answered that the
problem was the backend that was used (ESD or Arts). Well, I don’t know
what ESD or Arts is. I don’t even know what a backend or a frontend is. :stuck_out_tongue:

My question is how do I choose the backend for SDL_Mixer?

BTW, I’m using Fedora Core 5 with KDE.

KDE uses arts, Gnome uses esound.

In some cases, arts/esound is hogging your sound card (even if it’s not
making any sound at the moment, or ever), which prevents other apps from
using it. The idea is that every app feeds sound data to arts, which
mixes it and sends it to the sound card, so no one has to hog the device
but arts itself.

This is a terrible idea, though, largely because it adds a ton of delay
and inefficiency to the equasion.

If the sound card will let multiple processes use it simultaneously, you
can tell SDL to use a different backend. Backends are the lowlevel part
of SDL that actually feeds the audio data to the hardware. The backend
takes care of the specific details so the rest of the system (from the
rest of SDL to the app on up to the user) don’t generally have to care
about how the audio gets played, just that it does.

On Linux, there are several different backends, for various device
driver interfaces, plus these things like arts, etc.

Now that you have the background information, here are the answers to
your questions:

Disabling esd and arts:
http://icculus.org/lgfaq/#esdarts

Choosing a specific SDL backend:
http://icculus.org/lgfaq/#setthatdriver
(you probably want “alsa” … but killing artsd is probably enough)

–ryan.

Hello Ryan,

Friday, September 1, 2006, 9:23:44 AM, you wrote:

This is a terrible idea, though, largely because it adds a ton of delay
and inefficiency to the equasion.

This is not quite true. This is exactly how Windows sound operates,
there is a “kernel mixer” that mixes sound from DirectSound, waveOut
etc into one stream so that multiple apps may use the sound card. The
latency is very small. The problem is that both ESD and aRts
implementation of it, sucks :slight_smile:

I’m not a Linux user really but I do belive ALSA implements multiple
opening of the sound device, when the sound device has a hardware
mixer eg SBLive/Audigy etc. This is the proper way to do it IMHO, but
they should have a software fallback for AC97 and similar chips.–
Best regards,
Peter mailto:@Peter_Mulholland

Hello !

I’m not a Linux user really but I do belive ALSA implements multiple
opening of the sound device, when the sound device has a hardware
mixer eg SBLive/Audigy etc. This is the proper way to do it IMHO, but
they should have a software fallback for AC97 and similar chips.

When i used AC97 with ALSA i was happy to
be able to open more than one sound stream.
So ALSA has a software fallback for AC97 and
others.

CU

KDE uses arts, Gnome uses esound.

In some cases, arts/esound is hogging your sound card (even if it’s not
making any sound at the moment, or ever), which prevents other apps from
using it. The idea is that every app feeds sound data to arts, which
mixes it and sends it to the sound card, so no one has to hog the device
but arts itself.

This is a terrible idea, though, largely because it adds a ton of delay
and inefficiency to the equasion.

If the sound card will let multiple processes use it simultaneously, you
can tell SDL to use a different backend. Backends are the lowlevel part
of SDL that actually feeds the audio data to the hardware. The backend
takes care of the specific details so the rest of the system (from the
rest of SDL to the app on up to the user) don’t generally have to care
about how the audio gets played, just that it does.

On Linux, there are several different backends, for various device
driver interfaces, plus these things like arts, etc.

Now that you have the background information, here are the answers to
your questions:

Disabling esd and arts:
http://icculus.org/lgfaq/#esdarts

Choosing a specific SDL backend:
http://icculus.org/lgfaq/#setthatdriver
(you probably want “alsa” … but killing artsd is probably enough)

–ryan.

Thanks alot. So basically I just have to add this line, right?

system(“export SDL_AUDIODRIVER=alsa”);

Stoned koala bears drooled eucalyptus spit in awe as
benang at cs.its.ac.id said:

Thanks alot. So basically I just have to add this line, right?

system(“export SDL_AUDIODRIVER=alsa”);

Or even better:

#include <stdlib.h>

setenv(“SDL_AUDIODRIVER”, “alsa”, 1);

Doing it your way means you’re dependent on the user having a
sh-compatible shell and makes some assumptions about environment
handling. Doing it with the proper setenv() call directly changes just
your process’ environment.–
William Brodie-Tyrrell

Carpe Diem - fish of the day.

<@William_Brodie-Tyrre>
http://www.brodie-tyrrell.org/

William Brodie-Tyrrell wrote:

Stoned koala bears drooled eucalyptus spit in awe as
benang at cs.its.ac.id said:

Thanks alot. So basically I just have to add this line, right?

system(“export SDL_AUDIODRIVER=alsa”);

Or even better:

#include <stdlib.h>

setenv(“SDL_AUDIODRIVER”, “alsa”, 1);

Doing it your way means you’re dependent on the user having a
sh-compatible shell and makes some assumptions about environment
handling. Doing it with the proper setenv() call directly changes just
your process’ environment.

I have a better reason why you shouldn’t use system : it won’t work :smiley:

Hello !

system(“export SDL_AUDIODRIVER=alsa”);

No. SDL has a nice function to do that :

SDL_putenv (“SDL_AUDIODRIVER=alsa”);

CU

Hello !

I have a better reason why you shouldn’t use system : it won’t work :smiley:

Yup, you open a new shell and if you modify vars. there
and after that the shell is closed all your changes to the
vars. are lost.

CU

Thanks to all of you. I think I understand it now. Thanks again.

Hi Folks

Using SDL mixer to play audio, there is a delay in playing sounds. I have noticed this on many games using SDL mixer, not just my own games.

Can someone suggest a solution (even if it is not using SDL mixer!). I used Windows OS.

Thanks
Ed___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/

Quoting Edward Byard <e_byard at yahoo.co.uk>:

Hi Folks

Using SDL mixer to play audio, there is a delay in playing sounds. I
have noticed this on many games using SDL mixer, not just my own
games.

Can someone suggest a solution (even if it is not using SDL mixer!).
I used Windows OS.

Thanks
Ed

just randomly speculating, but if it is all SDL stuff and windows, possibly
there is an issue with the sound card.

Hi,

i’m using audiere ( http://audiere.sourceforge.net/ ) in my projects. It
does everything i need.

Matthias

neil at cloudsprinter.com wrote:> Quoting Edward Byard <e_byard at yahoo.co.uk>:

Hi Folks

Using SDL mixer to play audio, there is a delay in playing sounds. I
have noticed this on many games using SDL mixer, not just my own
games.

Can someone suggest a solution (even if it is not using SDL mixer!).
I used Windows OS.

Thanks
Ed

just randomly speculating, but if it is all SDL stuff and windows, possibly
there is an issue with the sound card.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org