Software mixer device.

You connect as many sinks as you want to the replicating port named
default_mix_sink, and this device will mix all these streams into
one.

The streams have to have the same sample rate. They may differ in
their resolution and number of channels, however. As you can see from
the profile, the input is of signed linear format, with the exception
that 8-bit unsigned linear is also allowed.

This device depends on the correct use of RTP 'mark' bits (which
appear in the mas_data struct's 'header' struct member). 

Data is read and sent out the source periodically from the ring buffer
at the current position of the ring buffer's read head in the
mas_mix_poll action. This is a periodic action, independent from any
incoming data.

Each sink has a 'reference' time stamp stored in its sink_info struct. 
This is where t=0 for this stream if you will.
Incoming packets get mixed into the buffer via their timestamp at 
(sink_ref + media_timestamp)

When a "mark"ed packet comes in, the sink reference is reset to
read_head - media_timestamp + mix_gap

mix_gap corresponds (by default) to roughly 10ms. This is to
ensure that the read head is most of the time positioned before the
positions where the streams write their data.

----- time ------>

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | |r| | | | | | | |w| | | | | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         ^               ^       ^ 
      read_head        incoming packets might go here, ideally



Features:
By default, the device applies soft limiting to samples instead of
clipping them. Like a compressor with zero attack and release
times. See mailing list messages for more. This happens at poll time,
after they have all been added up internally. Internally we work with
24 bit samples. 24 bit is therefore also the highest resolution a sink
can connect with. Since we use 24 bit inside, we can apply dithering
after the mixing process if we are reducing the resolution, to encode
information on the sub-bit level. We're using random noise from a
triangular distribution. See mailing list for more. Turn these
features off with mas_set calls "do_dither" and "do_soft_limiting".


Integer overflows:
At some point, the read head and other variables as well as the media
time stamp we get from outside will reach 2^32 and 'wrap' back to
0. The ring buffer is fine with this because its size is a power of 2,
so it will wrap at the same spot and not even notice the
difference. (That's the theory at least, hahaha.) However, in a few
places, it's necessary to determine where the read head is with
respect to the write head (to determine whether incoming data is too
old, for example). There we'd have a problem if one of the two has
wrapped but not the other. You'll see expressions like
if(read_head-write_head > HALF_UINT32_MAX) to guard against this. It
means that I think that the only way such a big difference can occur
is when write_head has wrapped but read_head not yet. It's not great
but it works.

