SDL 1.3 audio update

(long email, sorry.)

Okay, lots of SDL 1.3 work on the audio subsystem hit Subversion today.
I’m still doing the work to add 32-bit datatypes in this batch.

First, SDL_LoadWAV() now handles float32 and int32 .wav files. On this
box (Linux/amd64 with ALSA), I can use the loopwave.c test on a float32
.wav file and it plays fine.

The following backends were updated. Please note that most of these
systems I can’t even compile, let alone test, and way too many had no
documentation available that I could find…so I made some best-guesses.
If it broke, send a patch and/or complain loudly.

alsa: int32 and float32 are supported directly in the drivers.
amiga: int32 support added (google suggests AHIST_S32S, etc exist)
baudio: int32 and float32 support added (and some others!)
dart: No 32 bit support, but will now use SDL’s converters if device
opened for anything other than U8 or S16LSB (failure before).
dc: No 32-bit support, but will now use SDL’s converters if device
opened for anything but 8 or 16 bit data (failure before).
dmedia: float32 support, fallbacks for other things (failure before).
macosx: float32 and int32 support added. float32 is the fastpath on Mac
OS X, and apps should favor it on this platform when possible (but the
other formats will still work).
macrom: int32/float32 support added. Is OS 9 support going away?
mint: one of the codepaths appears to support int32, based on #defines
in the headers. The rest I just tried to make sure that unexpected
AudioSpec values get weeded out. I touched a lot more code than I was
comfortable with here. Someone should check it: revision #2728.
mme: Added int32 support, since you feed it a .wav header, but I don’t
know if the system can actually handle this. I could also feed it a .wav
header with float32 support, but I couldn’t find any indication that the
system wouldn’t barf on this the same way SDL_LoadWAV did until earlier
today.
nto: Added int32/float32 … isn’t this just ALSA? Why’s it a seperate
backend?
windib: Added int32 (see notes about mme).
windx5: Added int32 (see notes about mme).

Several drivers had clamps added for > 2 channel output, since the
drivers don’t (or don’t appear to) support more than stereo output.

bsd, paudio, sun, and ums got no updates, even though they might be able
to use at least int32. Documentation found on google wasn’t clear or
didn’t exist. If they can’t handle 32-bit data directly, they’ll still
work if SDL_OpenAudio() requests a 32-bit type…SDL will transparently
convert as necessary. But it may be performance we’re leaving on the
table because I don’t know if it’s safe to put a “32” into a field or I
don’t know the magic enum name. People that know: please speak up!

dummy and disk just use whatever. No changes needed.

dsp and dma didn’t change: the OpenSound docs suggest that there is
int32 and float32 support, but either strongly urged you not to use it
or said the symbols were placeholders. The headers on my Linux box
didn’t have the symbols, so OSS loses out here for now. SDL will convert
to 16-bit at a higher level in these cases.

Others, like esd, arts, and nas, didn’t change because they don’t
support 32-bit data and seemed well written (higher level will convert
data to something it does support before feeding the driver).

Up next:

  • move a few fixes that didn’t involve 32-bit types back to SDL 1.2.
  • debug all this. I still have to fix several converters. If you wrote
    any of these audio backends, I’d appreciate you looking at my changes
    and not making too much fun of me. :slight_smile:
  • longer term: multiple devices up next, which leads to capture support.

–ryan.

Hello, Ryan!

RCG> nto: Added int32/float32 … isn’t this just ALSA? Why’s it a seperate
RCG> backend?

Because it is a QSSL’s implementation of the ALSA API. It have nothing
common with ALSA 0.5.x except for API. It even doesn’t fully compatible with
ALSA 0.5.2, on which API was based.

With best regards, Mike Gorchak. E-mail: @Mike_Gorchak

RCG> nto: Added int32/float32 … isn’t this just ALSA? Why’s it a seperate
RCG> backend?

Because it is a QSSL’s implementation of the ALSA API. It have nothing
common with ALSA 0.5.x except for API. It even doesn’t fully compatible with
ALSA 0.5.2, on which API was based.

Ah, that makes sense.

Thanks,
–ryan.

Thank you for this major update! Three cheers for Ryan!

	Bob PendletonOn Fri, 2006-09-01 at 03:59 -0400, Ryan C. Gordon wrote:

(long email, sorry.)

Okay, lots of SDL 1.3 work on the audio subsystem hit Subversion today.
I’m still doing the work to add 32-bit datatypes in this batch.

First, SDL_LoadWAV() now handles float32 and int32 .wav files. On this
box (Linux/amd64 with ALSA), I can use the loopwave.c test on a float32
.wav file and it plays fine.

The following backends were updated. Please note that most of these
systems I can’t even compile, let alone test, and way too many had no
documentation available that I could find…so I made some best-guesses.
If it broke, send a patch and/or complain loudly.

alsa: int32 and float32 are supported directly in the drivers.
amiga: int32 support added (google suggests AHIST_S32S, etc exist)
baudio: int32 and float32 support added (and some others!)
dart: No 32 bit support, but will now use SDL’s converters if device
opened for anything other than U8 or S16LSB (failure before).
dc: No 32-bit support, but will now use SDL’s converters if device
opened for anything but 8 or 16 bit data (failure before).
dmedia: float32 support, fallbacks for other things (failure before).
macosx: float32 and int32 support added. float32 is the fastpath on Mac
OS X, and apps should favor it on this platform when possible (but the
other formats will still work).
macrom: int32/float32 support added. Is OS 9 support going away?
mint: one of the codepaths appears to support int32, based on #defines
in the headers. The rest I just tried to make sure that unexpected
AudioSpec values get weeded out. I touched a lot more code than I was
comfortable with here. Someone should check it: revision #2728.
mme: Added int32 support, since you feed it a .wav header, but I don’t
know if the system can actually handle this. I could also feed it a .wav
header with float32 support, but I couldn’t find any indication that the
system wouldn’t barf on this the same way SDL_LoadWAV did until earlier
today.
nto: Added int32/float32 … isn’t this just ALSA? Why’s it a seperate
backend?
windib: Added int32 (see notes about mme).
windx5: Added int32 (see notes about mme).

Several drivers had clamps added for > 2 channel output, since the
drivers don’t (or don’t appear to) support more than stereo output.

bsd, paudio, sun, and ums got no updates, even though they might be able
to use at least int32. Documentation found on google wasn’t clear or
didn’t exist. If they can’t handle 32-bit data directly, they’ll still
work if SDL_OpenAudio() requests a 32-bit type…SDL will transparently
convert as necessary. But it may be performance we’re leaving on the
table because I don’t know if it’s safe to put a “32” into a field or I
don’t know the magic enum name. People that know: please speak up!

dummy and disk just use whatever. No changes needed.

dsp and dma didn’t change: the OpenSound docs suggest that there is
int32 and float32 support, but either strongly urged you not to use it
or said the symbols were placeholders. The headers on my Linux box
didn’t have the symbols, so OSS loses out here for now. SDL will convert
to 16-bit at a higher level in these cases.

Others, like esd, arts, and nas, didn’t change because they don’t
support 32-bit data and seemed well written (higher level will convert
data to something it does support before feeding the driver).

Up next:

  • move a few fixes that didn’t involve 32-bit types back to SDL 1.2.
  • debug all this. I still have to fix several converters. If you wrote
    any of these audio backends, I’d appreciate you looking at my changes
    and not making too much fun of me. :slight_smile:
  • longer term: multiple devices up next, which leads to capture support.

–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


±-------------------------------------+

Le Fri, 01 Sep 2006 03:59:59 -0400
"Ryan C. Gordon" a ?crit:

Up next:

  • move a few fixes that didn’t involve 32-bit types back to SDL 1.2.
  • debug all this. I still have to fix several converters. If you wrote
    any of these audio backends, I’d appreciate you looking at my changes
    and not making too much fun of me. :slight_smile:
  • longer term: multiple devices up next, which leads to capture
    support.

How about support for hardware mixers inside SDL (i.e. the hardware
support more than 1 single mono, stereo or 5.1 channel) ? There are some
targets where it could be done, and it would avoid SDL_mixer from doing
this work in software.–
Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Sp?cialit?: D?veloppement, jeux

Hello Patrice,

Friday, September 1, 2006, 3:25:45 PM, you wrote:

How about support for hardware mixers inside SDL (i.e. the hardware
support more than 1 single mono, stereo or 5.1 channel) ? There are some
targets where it could be done, and it would avoid SDL_mixer from doing
this work in software.

I don’t think this is worth adding. If you look at most games using 2D
audio, they are using software mixing anyway… either their own routines
(like the Quake games), or via libraries such as FMOD, BASS etc.

The only time hardware mixing seems to be used now is when 3D audio is
used, and this is pretty much catered for by OpenAL.

What IS worth adding, IMHO, is a free rate mixer, where each channels
frequency is freely controllable (like in a MOD player’s mixer). This
would allow some simple things such as doppler to be done.

It’s also handy when odd samples are used. I did the port of Earth
2140 to Linux and Windows (from DOS) a few years ago, and this used
16KHz mono samples. It was a bit of a pain to get SDL_mixer to use
them, in the end I had to write my own resampler to convert them to
22KHz.–
Best regards,
Peter mailto:@Peter_Mulholland

I saw you backported some of this stuff to the 1.2 branch, but it does
not compile, due to missing SDL_AudioFormat, so even if you updated the
drivers, maybe some include files also need update?–
Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Sp?cialit?: D?veloppement, jeux

I saw you backported some of this stuff to the 1.2 branch, but it does
not compile, due to missing SDL_AudioFormat, so even if you updated the
drivers, maybe some include files also need update?

Whoops, should be fixed in svn revision #2742.

–ryan.