rodio
rodio copied to clipboard
Make `DynamicMixer` and `OutputStream` generic
This commit adds a new trait, Mixer
, and refactors some of the code around generic mixers in order to support it. This is to make more of the code reusable without rewriting - specifically, to support a feature that I would like to implement in bevy_audio
where audio sources can send audio to an intermediate mixer. The motivation for this was to add a global limiter to all game audio, so that loud sounds did not cause clipping on the master bus, but another possible usecase would be to split in-game audio and menu audio into separate "worlds" and apply, for example, a low-pass filter while in the pause screen.
It looks like the test failures are due to unrelated code, and are because of the addition of redundant import checks to unused_imports
.
A more-minimal version of this PR would just make OutputStream
generic, which would still allow reusing rodio
's mixer without adding an actual interface around creating your own.
Could you rebase this on main? (or merge main into it). Then you'll get the fixed (thanks @hamirmahal) test suite.
You're welcome, @dvdsk!