eee319b535b329d3556d1fd97cf3506c140572e2
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.)
Languages
C++
85.7%
Lua
4.3%
C
4.3%
Rich Text Format
2.3%
CMake
1.1%
Other
2%