-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Audio sink seek #13869
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
Audio sink seek #13869
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
https://github.com/RustAudio/rodio/blob/master/src/decoder/vorbis.rs#L90 It looks like seeking is only possible for some audio formats, and vorbis is not one. EDIT: Whoops I thought this was an issue not a PR sink.try_seek(std::time::Duration::from_secs_f64(0.0)).unwrap(); The problem then is just that you cannot call |
@ivanstepanovftw are you planning on finishing this PR? One of my projects would benefit from this feature, and I'd be willing to adopt if you aren't. |
Closing as adopted. |
Adopted #13869 # Objective Fixes #9076 ## Solution Using `rodio`'s `try_seek` ## Testing @ivanstepanovftw added a `seek` system using `AudioSink` to the `audio_control.rs` example. I got it working with .mp3 files, but rodio doesn't support seeking for .ogg and .flac files, so I removed it from the commit (since the assets folder only has .ogg files). Another thing to note is that `try_seek` fails when using `PlaybackMode::Loop`, as `rodio::source::buffered::Buffered` doesn't support `try_seek`. I haven't tested `SpatialAudioSink`. ## Notes I copied the docs for `try_seek` verbatim from `rodio`, and re-exported `rodio::source::SeekError`. I'm not completely confident in those decisions, please let me know if I'm doing anything wrong. </details> --------- Co-authored-by: Ivan Stepanov <ivanstepanovftw@gmail.com> Co-authored-by: François Mockers <francois.mockers@vleue.com> Co-authored-by: Jan Hohenheim <jan@hohenheim.ch> Co-authored-by: François Mockers <mockersf@gmail.com>
Adopted bevyengine#13869 # Objective Fixes bevyengine#9076 ## Solution Using `rodio`'s `try_seek` ## Testing @ivanstepanovftw added a `seek` system using `AudioSink` to the `audio_control.rs` example. I got it working with .mp3 files, but rodio doesn't support seeking for .ogg and .flac files, so I removed it from the commit (since the assets folder only has .ogg files). Another thing to note is that `try_seek` fails when using `PlaybackMode::Loop`, as `rodio::source::buffered::Buffered` doesn't support `try_seek`. I haven't tested `SpatialAudioSink`. ## Notes I copied the docs for `try_seek` verbatim from `rodio`, and re-exported `rodio::source::SeekError`. I'm not completely confident in those decisions, please let me know if I'm doing anything wrong. </details> --------- Co-authored-by: Ivan Stepanov <ivanstepanovftw@gmail.com> Co-authored-by: François Mockers <francois.mockers@vleue.com> Co-authored-by: Jan Hohenheim <jan@hohenheim.ch> Co-authored-by: François Mockers <mockersf@gmail.com>
Objective
Solution
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekNotSupported>
fromrodio
.Related issue: #9076
Testing
It is not working, help needed.
Changelog
Added