Re: [AD] Allegro's mixer

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sunday 21 March 2004 03:58, Chris wrote:
> New update. :)
>
> The mixer now does full signed 24-bit mixing in a signed 32-bit buffer.
> This should mean there's a theoretical max of 255 samples without risk
> of wrapping (or 127 stereo samples with mono output).

To convert a sample from stereo to mono, you should average the channels, not 
add. The 127 would apply to samples all panned to the same side, wouldn't it?

> Also, the 
> interpolation mixer interpolates in full 24-bits, though it dropped from
> an 8-bit interpolation level to 7-bit (maybe this can be fixed?). I
> would also be curious to see if the hq1 mixer out performs the low
> quality stereo mixer now. It's a definate possibility, IMHO. It
> definately has a better performance-to-quality ratio. Any performance
> loss (if any) is more than made up with the added quality and preciseness.
>
> The default set_volume_per_voice has been set to 1, so 1 panned sample
> will never be clamped and distort. It should be easy enough to set it to
> be -1 again if you wish (just change the default value of the global),
> but this way closer emulates the DX mixer that Allegro can, and most
> often does, use. I would also recommend discouraging future use of
> set_volume_per_voice without good reason. There is absolutely no risk of
> overflow with Allegro's maximum of 64 digital voices, even with an
> over-sampled volume level (via set_volume_per_voice(0)) and 64
> simultanious stereo samples on a mono buffer. Any resulting distortion
> can be controlled with set_volume, which is a lot easier for both using
> in the program, and exposing for the end user should you want to
> (exposing set_volume_per_voice to the end user has always been
> discouraged anyway).

The idea was that the programmer should control the _maximum_ output level 
with set_volume_per_voice(), thereby making sure the output is sufficiently 
loud but not seriously clipped. (As a reference, I wrote an .it file which 
clips at anything greater than 40% of the default playback volume, and at the 
default volume, the clipping is quite noticeable.) Then the user can adjust 
the volume, and the programmer passes this volume to set_volume(). IMO it 
doesn't do to allow the user to turn the volume up so high that it clips 
severely.

Anyway. Nice work :) (presumably)

Ben




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/