Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

ivanstepanovftw
Copy link

@ivanstepanovftw ivanstepanovftw commented Jun 16, 2024

Objective

  • Seeking in audio sink to specific location

Solution

Related issue: #9076

Testing

  • It is not working, help needed.

    /home/i/.cargo/bin/cargo +nightly run --color=always --package bevy --example audio_control --release
    Finished `release` profile [optimized] target(s) in 0.30s
     Running `target/release/examples/audio_control`
2024-06-16T07:42:04.325210Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 40 Fedora Linux", kernel: "6.8.11-300.fc40.x86_64", cpu: "AMD Ryzen 7 5800U with Radeon Graphics", core_count: "8", memory: "14.5 GiB" }
2024-06-16T07:42:04.451561Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Graphics (RADV RENOIR)", vendor: 4098, device: 5688, device_type: IntegratedGpu, driver: "radv", driver_info: "Mesa 24.1.1", backend: Vulkan }
2024-06-16T07:42:04.852471Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-06-16T07:42:04.853166Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 2
thread 'Compute Task Pool (1)' panicked at examples/audio/audio_control.rs:62:68:
called `Result::unwrap()` on an `Err` value: NotSupported { underlying_source: "rodio::decoder::vorbis::VorbisDecoder<std::io::cursor::Cursor<bevy_audio::audio_source::AudioSource>>" }
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   4: <bevy_ecs::system::function_system::FunctionSystem<Marker,F> as bevy_ecs::system::system::System>::run_unsafe
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Encountered a panic in system `audio_control::seek`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

Process finished with exit code 101

Changelog

Added

  • Seeking to specific location in audio sink.

Copy link
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@torsteingrindvik
Copy link
Contributor

torsteingrindvik commented Jun 16, 2024

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.
So you could consider changing formats until vorbis has support.

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 .unwrap() since it's fallible and some backends might not support it.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Audio Sounds playback and modification S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 16, 2024
@ivanstepanovftw ivanstepanovftw marked this pull request as draft June 17, 2024 19:52
@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Audio Sounds playback and modification C-Feature A new feature, making something new possible S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants