ARM SDL ALSA problem

I’m using SDL on an ARM based board running Linux (Olimex-AT91SAM9261) . I successfully cross-compiled, installed and tested the libraries (SDL, SDL_mixer) on the system. The sound output is done thru ALSA (SDL_AUDIODRIVER=alsa).

Now I’m trying to play ogg files. First I used the Mix_LoadWAV macro for playback. This worked, but the macro decompresses first the complete audio file into memory and then starts the playback. Thus leading to a long delay before playing the music.
Therefore I tried a different approach with the Mix_LoadMUS macro to play the ogg file. This function streams the files directly from the hard-disk and avoids the long decoding time. Unfortunately ALSA shows several buffer under-runs leading to a disrupted playback. To fix this I tried different buffer sizes, but the problem is still existent.

The code works fine on my host system, but not on the ARM target.

Any sort of help would be great!

Thanks in advance
Christian

hard-disk and avoids the long decoding time. Unfortunately ALSA shows
several buffer under-runs leading to a disrupted playback. To fix this I
tried different buffer sizes, but the problem is still existent.

The code works fine on my host system, but not on the ARM target.

libvorbis uses lots and lots of floating point, perhaps your ARM
processor can’t decode the ogg fast enough to play it in real time?

You should try libtremor, which is a replacement vorbis library that
uses only integer math. I think it’s a drop-in replacement, so it should
work with SDL_mixer.

–ryan.

was going to suggest the same!
libtremor is wonderful, doesn’t use the fpu at all and is 99% compatible
with standard ogg function calls
(the missing 1% is because it didn’t conatin ogg_open or ogg_fopen, can’t
remember)

the only thing is that it is a little hard to find, i resorted to checking
out the svn, if you find a better method or even the official website let us
know!
Bye
VittorioOn Wed, Mar 3, 2010 at 4:27 PM, Ryan C. Gordon wrote:

hard-disk and avoids the long decoding time. Unfortunately ALSA shows

several buffer under-runs leading to a disrupted playback. To fix this I
tried different buffer sizes, but the problem is still existent.

The code works fine on my host system, but not on the ARM target.

libvorbis uses lots and lots of floating point, perhaps your ARM processor
can’t decode the ogg fast enough to play it in real time?

You should try libtremor, which is a replacement vorbis library that uses
only integer math. I think it’s a drop-in replacement, so it should work
with SDL_mixer.

–ryan.


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

libtremor fixed the problem. it seems arm was to busy with decoding ogg files thru the vorbis/ogg floating point libraries.

therefore i did the following:

  1. i downloaded the sources for libtremor from the svn: http://svn.xiph.org/trunk/Tremor/
  2. cross compiled them for my arm board
  3. i also had to cross compile the SDL_mixer library again with the “–enable-music-ogg-tremor” parameter

These steps finally fixed the buffer underrun problem completely.

Thanks for the help!!!

Christian