annotate mixer/DESIGN @ 562:7e08477b0fc1

MP3 decoder upgrade work. Ripped out SMPEG and mpglib support, replaced it with "mpg123.c" and libmpg123. libmpg123 is a much better version of mpglib, so it should solve all the problems about MP3's not seeking, or most modern MP3's not playing at all, etc. Since you no longer have to make a tradeoff with SMPEG for features, and SMPEG is basically rotting, I removed it from the project. There is still work to be done with libmpg123...there are MMX, 3DNow, SSE, Altivec, etc decoders which we don't have enabled at the moment, and the build system could use some work to make this compile more cleanly, etc. Still: huge win.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 30 Jan 2009 02:44:47 -0500
parents 859dd2ef3197
children
rev   line source
486
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
1 - Mixes internally in Float32. This simplifies the code immensely by only
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
2 having one format to screw with. It also makes life easy for end-user
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
3 callbacks. A native Float32 format should be added to SDL, too, so there
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
4 isn't unnecessary conversion if we can avoid it (i.e. - a CoreAudio backend).
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
5
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
6 - "Chunks" are just Sound_Samples...you can lock the mixer to screw with them
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
7 (i.e. - seeking in a playing Sample, etc). The mixer adds some opaque state
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
8 to Sound_Sample (current play position, how much is decoded, etc), some of
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
9 which can be queried and set.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
10
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
11 - There is no "stopped" state. You are either in the playing list or you are
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
12 not, but state doesn't reset, so removing a sample from the list is more like
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
13 pausing it. If you put it back in the playing list without rewinding it, it
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
14 starts where it was.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
15
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
16 - Fire and forget mixing is easy; flag a sample as "auto free" and it'll
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
17 delete itself when it's done playing. No need to set up a callback just to
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
18 clean up.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
19
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
20 - No channels. You can mix as many samples as you have resources to
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
21 accomodate.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
22
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
23 - No groups. This can be layered on top of the library if needed. If you
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
24 need atomic operations, lock the mixer.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
25
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
26 - No music channel. Samples are samples. You can mix a MIDI as a sound effect
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
27 if you want, or a WAV file for background music. If you have the horsepower
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
28 to decode multiple compressed files at once, go for it.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
29
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
30 - You can prebuffer/predecode as much of a sample as you like.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
31
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
32 - Every sample mixes with a per-channel gain, plus a master gain that is
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
33 global to the mixer.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
34
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
35 - Can handle non-power of two resampling.
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
36
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
37 - post mix hook, sample finished hook. Effects callback?
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
38
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
39
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
40
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
41
859dd2ef3197 Added some seriously INCOMPLETE mixer code.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
42