[haiku] Media kit mixer - dithering, resampling

Hey everyone,

I'm still fiddling around with the HDA driver, but as a side-effect
of that, I've been poking around a bit with the media kit mixer.

I've been looking into adding dithering for the output, to reduce
the level of distortion when the audio is down-converted from the
floating-point mix buffer to the integer destination format.

First of all, is anyone else working on something similar? If so,
I could share what I've got so far if anyone's interested.


If not, I've got a few specific technical questions:


1) Is a re-write planned for the media kit mixer at all?

2) What does the resampler sitting between the mix buffer and the
   output do? I can see that it's used to perform conversion from
   float to the output format, but is it ever used to change the
   sample rate?
   (note: I'm asking specifically about the output resampler, not
   the individual resamplers for each mixer input)

3) Why is double rate mixing necessary (even if it's currently
   turned off), and is this the purpose of the output resampler?

4) If I'm reading the code correctly, it looks as if the resampling
   ratio for the Resampler class is determined by the ratio of
   input and output buffer sizes?
   This seems like it would come apart when a more sophisticated
   resampler (e.g., sinc pulse) is implemented due to
   boundary-effects, and when the buffer sizes are small enough that
   the correct ratio cannot be maintained.
   Stephan -- you mentioned earlier that you were working on a
   bilinear resampler for the media kit mixer. Did you need to
   change the architecture to achieve this?

5) Currently the Resampler class handles three functions, all in
   a single function call: resampling, gain control, and format
   conversion (float <-> integer).
   This is what's causing me the biggest problem right now -- the
   dithering needs to be performed after resampling and gain control,
   but before or during conversion to integer.

6) Due to all of the above, I'm wondering if it would be appropriate
   to remove the output resampler altogether, and replace it with a
   simple format conversion?


Thanks for reading, any feedback would be much appreciated!

Other related posts: