oh, btw...

torbjorn.e.andersson at tietoenator.com torbjorn.e.andersson at tietoenator.com
Wed May 22 02:25:56 EDT 2002

Ryan C. Gordon wrote:

> and it plays the Spice Girls like they were chipmonks, even though
> it claims audio conversion is disabled.

Gee, you make it sound like this was a bug rather than a dramatic
improvement. ;-)

But since it probably affects other musical genres as well...

(Much later.)

Ah-ha! I think I see the error. When specifying an audio format,
playsound will pick "sensible defaults" for any format parameter not
specified. From what I remember, this was because the audio device was
opened first and the sample afterwards, so there was no way of getting
the defaults from the sample itself.

Nowadays it's the other way around. The sample is opened first and the
audio device afterwards. So init_sample() fills out any blanks with
the actual parameters from the sample, and constructs the conversion

Unfortunately playsound would still use its own defaults when opening
the audio device. The included patch makes it use sample->desired

This probably answers the question in init_sample()'s comments, by the

I noticed that audio_convert.c has a bunch of private functions that
aren't declared as static. Surely that has to be a bug? Horrifyingly
trivial patch included. (If it's wrong, then the next patch will be
as well.)

I've done some hacking on alt_audio_convert.c as well. I didn't
realize quite how tricky it would be to create glue code to interface
with Frank's decoder, but it *should* set up the correct filters now.
I've verified that I can convert U8, S16LSB and S16MSB to any other
sample size / byte order / signedness.

The mono-to-stereo filter is broken, as are the rate conversion
filters. I'm not going to pursue that right now though.

I did experience some crashes when interrupting playsound, so there
may be some memory corruption in there as well.

Some conversions are clearly pessimised. These are marked "!!! FIXME
!!!" in the code.

The code still contains a bunch of debug fprintf()s because I didn't
want to clutter my debug output with the rest of SDL_sound's debug
chatter. Feel free to remove those.

TietoEnator Resource Management AB
Torbjörn Andersson

-------------- next part --------------
A non-text attachment was scrubbed...
Name: playsound.diff.gz
Type: application/octet-stream
Size: 379 bytes
Desc: not available
URL: <http://icculus.org/pipermail/sdlsound/attachments/20020522/3f00606a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: audio_convert.diff.gz
Type: application/octet-stream
Size: 602 bytes
Desc: not available
URL: <http://icculus.org/pipermail/sdlsound/attachments/20020522/3f00606a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alt_audio_convert.diff.gz
Type: application/octet-stream
Size: 2892 bytes
Desc: not available
URL: <http://icculus.org/pipermail/sdlsound/attachments/20020522/3f00606a/attachment-0002.obj>

More information about the sdlsound mailing list