[uae] Re: Sound tips for Linux

  • From: Richard Drummond <evilrich@xxxxxxxxxxxxxx>
  • To: uae@xxxxxxxxxxxxx
  • Date: Sun, 16 Jul 2006 11:39:50 -0400

Hi ceztko

You didn't post from an address that is subscribed to this list, so I was sent 
it for moderation. However, the moderation system seems to be broken at the 
moment.

So, while your post didn't make it to the list, I'll reply here anyway.

You wrote:
> Richard Drummond wrote:
> > 2) Compile against ALSA or OSS for sound (not SDL). SDL sound performs
> > poorly under high CPU load in E-UAE on Linux. This is not something
> > that's easily fixable. All future official builds will be built against
> > ALSA instead.
>
> Is it an e-uae or SDL fault?

I'm not sure I'd call it a fault - it's just one of those things.

If you use SDL sound in E-UAE on Linux (and probably other Unices), then, when 
the E-UAE emulation thread is hogging the CPU, the sound thread just doesn't 
get scheduled quickly enough. A pre-emptable kernel configured with HZ=1000 
helps, but it's still not great.

The problem is due to the way E-UAE generates audio data and SDL's audio model 
(E-UAE wants to push audio data but SDL wants to pull it) and the Unix thread 
model (which is basically what SDL implements). For instance, on AmigaOS 4.0 
with SDL, there's no such problem. But, in AmigaOS you can raise the priority 
of a thread (task) easily, and so the SDL sound thread is made to run at a 
high priority so that it can always pre-empt the main thread.

When using ALSA or OSS no sound thread is required and thus no scheduling 
problem occurs. The main thread pushes sound data directly to the sound 
system.

Cheers,
Rich

Other related posts: