Re: [GD-General] Writing an audio mixer
Brought to you by:
vexxed72
|
From: Mickael P. <mpo...@ed...> - 2002-03-18 08:51:58
|
> During the lull between Candy Cruncher and our next product I'd like to
> take a day and write our own audio mixer to minimize our dependencies on
> per-platform audio mixing capabilities. We can survive without hardware
> mixing (in fact, we don't support it right now at all because it's so
> damn flaky).
When I'm writing small demos, I'm generaly using something like FMOD or
BASS that are two nice libraries that unfortunately exists only on PC...
Well, all that to say that in the FMOD documentation the author explains
that his tests shows that software mixing is generaly faster and of better
quality than hardware mixing, due to various things like the fact that the
drivers are crappy...
> I've never done an audio mixer before, but I understand the general
> theory of audio mixing. Anyone have any pointers, tips, gotchas before
> I dive into it?
Basicaly it's just a loop that makes the signed sum of values of
interpolated samples... nothing to be mad about :)
The first thing to consider, is that when you are doing software mixing
you have virtually an unlimited number of voices. You can also perform
reverberation pretty easily. Pausing the sound replay also became very
easy.
Among the problems I see, is the fact that you have to double bufferize
to make it efficient. If you make the buffer too long, you will have too
much delay in the sound replay. If you make it too short, you can suffer
problems with frame rate variation (tip => make it in another thread).
[Note: Sometimes instead of double buffering you can have ring buffers
with read/write pointers.]
You can also have problems with interpolation. I remember that numerous
demo making sites talk about this (about sound tracker replays, and how
to make it nice from adlib to Gus cards), and especialy all that is
related to "clicks", looped samples, ...
Mickael Pointier
Eden Studios
|