This commit fixes an issue where RateConverter would
sometimes chop off the very end of an audio stream. This
happened when the RateConverter would have some
data left in its internal buffer, but the source stream was
already fully read. The base RateConverter class now has
a needsDraining() function which indicates leftover data,
and relevant code now uses it when needed.
The RateConverter class has been modified to allow for
variable input and output rates. The optimized code paths
for copy/simple conversions are retained, but have been moved
inside separate functions instead of subclasses. The templatization
of the stereo parameters has been maintained, and is implemented
via the newly-added RateConverter_Impl template class.
Internal variables have been renamed to be more readable. The
flow() function has been renamed to convert(). The drain()
function has been removed, since it was never implemented
or used anywhere.
The output buffer size variable is unsigned so an assertion of
greater than or equal to zero will always be true, which generates
a type limits compiler warning.
This also adapts our default implementation MixerImpl to handle the newly
added flags properly.
Now we do not need to set the sound volume for all types to 0, in case we want
to mute them, but instead just set the mute flag for all types to true. This
allows engines to be a bit more agonstic about mute support, when it comes to
volume options etc. since they can just setup any volume they like, but are
still muted (and thus will not break muting anymore).
MIDI sound is of course not affected by this.
The RateConverter::flow result was never used, pipe it through
Channel::mix to MixerImpl::mixCallback, so backends can decide
if they want to waste cpu cycles while playing empty buffers.