-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add AudioSinkPlayback::position
#19173
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
base: main
Are you sure you want to change the base?
Conversation
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.
You might like to do a quick audit of Bevy code to confirm the best name here: at a glance it looks like Bevy would name this position()
rather than get_pos()
.
@mgi388 I'm not entirely sure which Bevy code you are referring to. I definitely agree that the |
@Weihnachtsbaum sorry for the confusion. I’m saying amongst bevy code in other crates I think we see methods that get the position of something named position rather than get_pos. I’m also not sure if 1:1 mapping to Rodio is a goal especially because there’s a medium to high chance that Rodio won’t be the audio backend for Bevy in the near future (see Bettwr Audio Working Group on Discord). |
AudioSinkPlayback::get_pos
AudioSinkPlayback::position
@mgi388 That's a fair point, I changed it to |
things like this usually use the terms |
@hukasu do you have a reference for that? I don't have a strong opinion on it really, but if I saw code that said |
yeah, maybe not for audio, both kira and rodio use position |
@Weihnachtsbaum I ran the example and pressed spacebar to pause the audio and the progress keeps going presumably due to floating point things. I'm surprised that it fluctuates so much though. I wonder if it's expected from Rodio's side to fluctuate so much? Like even if you rendered it at 2 decimal places e.g. Screen.Recording.2025-05-12.at.11.41.07.am.mov |
@mgi388 I'm not sure but it might be because in example the playback speed is changing all the time. I'll have a look at it later today. |
@Weihnachtsbaum ah that's probably it. It's probably fine then. A solution might be to update the example to only update the speed if it's not paused. I don't think that would have any negative effects on the example, see what you think. |
@mgi388 Done 👍 |
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.
LGTM. I tested the example again and the progress pauses when you press spacebar.
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.
LGTM! A small update directly exposing more of rodio's API surface.
Objective
Solution
position
method toAudioSinkPlayback
AudioSink
andSpatialAudioSink
Testing
audio_control
example to show playback position