-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make DynamicMixer
and OutputStream
generic
#547
Conversation
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 |
This commit adds a new component, `AudioTarget`. This component allows marking sources to be played via a specific `OutputStreamHandle` instead of the global one. At time of writing, changing the audio target will result in restarting the source, as `rodio` provides no way to get the inner source queue for a `Sink`. This is already the case for the current version of Bevy when a component's `AudioSink` is removed, however, so I think that this behavior is acceptable for now. This allows users to specifically target certain audio devices, and when [rodio#547](RustAudio/rodio#547) lands it will allow users to use intermediate mixers - e.g. to add global or per-item-set effects such as reverb.
A more-minimal version of this PR would just make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the test failures are due to unrelated code, and are because of the addition of redundant import checks to
unused_imports
.
The test failures should be gone on the main branch now because of #554.
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! |
b10961c
to
a7f67b3
Compare
0ee0413
to
073fdb1
Compare
I'm going to close this given we just redesigned the mixer & stream and the code has diverged a lot now. During the design we discussed this use-case and decided to not make the mixer generic for now. The performance and API tradeoffs where unclear and the use-cases are already possible by adding a Source to the mixer that is itself a new special mixer. That reduced the use-case of this PR to optimization. Once we have a better idea how the new Feel free to re-open but the re-base is going to be hellish and its probably better to start again. |
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 inbevy_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.