GetStreamToSourceRatio. This will allow RateChange() to
be implemented with a filter, instead of being built into
RageSound, allow filters that change the music rate while
preserving robust correlation to the original audio.
This tightens up the frame definitions, resulting in three
frame counters:
- source frames; frames into the original source audio
- stream frames; frame counter after all filtering
- hardware frames; the sound driver's frame counter
All frames are in the sample rate of the stream; if audio
is resampled to match the hardware, the resampled audio is
considered the source audio, and frame units are in the
resulting sample rate.
By design, source frames are never exposed to the sound
driver, which only deals with stream and hardware frames.
The principle of the ratio API is that while a filter stream
should ideally output audio at the exact rate it advertises
through GetStreamToSourceRatio, rounding error will inevitably
creep in. Rather than depending on the ratio being exact
over an arbitrary length of time, each filter's GetNextSourceFrame
calculates the actual next source frame. Typically, it
will be equal to (its value before the previous read) + (number
of frames read * previous ratio). This avoids hard-to-debug
synchronization drift.
(This also eliminates the 1k buffer which was used for crappy
rate changing, which can be readded with a buffer filter if
needed. Rate changing is disabled for a while until a bit
more work is done.)
if looping, the sound will loop exactly once every m_LengthSeconds. This should
fix obscure beat alignment problems if sample music ends at the end of the file,
since before, extending the length beyond the end of the file didn't do anything.
Fix m_FadeLength. The length was being ignored.
Add m_FadedOutAt; this way, if beat alignment extends a 10-second clip at the
end of a file by .5 seconds, we can fade out 9..10, instead of 9.5 ... 10.5,
which would cause the sound to cut out early.
is causing contention, leading to skips. A detail on this is probably
coming to -devs soon ... (this will break the ALSA hw driver compile until
I update it; an hour or so)