Open Gnamra opened 1 year ago
Bevy uses Symphonia indirectly, and Rodio has not exposed API for seeking. Please see:
Currently Bevy is blocked on this.
(Update) Rodio feature Audio Seek awaiting review and pull request.
has been merged :partying_face:
l will cut a release in a few days but you should be able to start building a PR on top of it now.
@harudagondi Since we are no longer waiting for rodio, can the blocked label be removed?
I've removed the blocked label, so anybody feel free to tackle this!
It should be noted that work on this will soon be superceeded by the ongoing work to replace rodio with kira, so it has a limited shelf life; however contributions are still welcome.
It should be noted that work on this will soon be superceeded by the ongoing work to replace rodio with kira, so it has a limited shelf life; however contributions are still welcome.
Out of interest, (I now help maintain rodio) could you point me at the reasons why bevy is switching to kira (kira looks great btw)? That could help plot a course for rodio's development.
Out of interest, (I now help maintain rodio) could you point me at the reasons why bevy is switching to kira (kira looks great btw)? That could help plot a course for rodio's development.
rodio
has some fundamental downsides that makes it unfit for use in Bevy as an audio engine:
Iterator
trait, which forces some suboptimal design decisions (ie. no easy way to broadcast signals to multiple outputs for creating send effects, or lack of metadata about the iterators being infinite or not).Source
with an effect to apply the effect is cumbersome and, since it involves the type system, cannot be done dynamically unless all combinations are present at all times. This hinders attempts at building dynamical audio systems, which might want to add and remove processing at runtime (ie. reverb volumes in games, or only processing a low-pass filter under water), or mixing multiple sources into a single track to do bus processing instead of wasting resources processing N effects in parallel for each source.Kira specifically has some nice-to-have features that make it more attractive to base Bevy's audio engine around:
One downside of Kira at the moment is the lack of runtime changes to the track effects rack or the output of audio sources into the mixer, which is a bit of a bummer, but I'm more confident with the architecture of Kira that it can eventually be added.
Sorry it's bleak, and as a maintainer it's not the easiest to read, but that's my feelings and the reasoning behind the change.
@SolarLiner Thanks for you for taking the time to write that very clear explanation. I had a look around the Kira source and it looks great. I'm gonna contact its maintainer and discuss kira's scope. If everything rodio provides and my future plans for it fit into kira better then it could be better to move my focus there. It makes little senses to split the rather small rust audio contributions between two similar crates.
What problem does this solve or what need does it fill?
Seeking audio is practically a must have for any rhythm game that wants to have a beatmap editor. In the song selection screen of a rhythm game, it is also common to play a preview of the song you have selected. Usually this preview starts somewhere in the song, and not from the beginning.
What solution would you like?
If I'm not mistaken bevy_audio uses Symphonia and Rodio. Symphonia already supports seeking, exposing this would be enough for my use case. Additionally, it would be nice to be able to get total playtime of the audio file since that would make it easier to make decisions about where to start previewing a file.
What alternative(s) have you considered?
Setting the playback speed very high to advance to the point you want to seek to in a single frame, but that's not very elegant. bevy_kira_audio is the only reasonable alternative right now as far as I know.