annotate mixer/DESIGN @ 591:8faf61a640f0 tip

Resynced fixes for unit conversion bugs in the Ogg Tremor decoder from SoundDecoder/ALmixer. Ogg Vorbis uses seconds and we multiply by 1000 to convert to milliseconds. But Ogg Tremor already uses milliseconds but I was still multiplying by 1000.
author Eric Wing <ewing . public |-at-| gmail . com>
date Thu, 25 Oct 2012 16:34:18 -0700
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