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

ALSA Error Causes hard crash #2699

Closed
thechubbypanda opened this issue Aug 21, 2021 · 3 comments
Closed

ALSA Error Causes hard crash #2699

thechubbypanda opened this issue Aug 21, 2021 · 3 comments
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled

Comments

@thechubbypanda
Copy link

thechubbypanda commented Aug 21, 2021

Follows from #1855

Bevy version

Bevy branch: latest 0.5

Operating system & version

Archlinux

What you did

  1. No audio playing
  2. Create /etc/asound.conf:
defaults.pcm.card 2
defaults.ctl.card 2

as described on the Arch Wiki
3. cargo run

What you expected to happen

Window opens and game runs (using 3d_scene.rs)

What actually happened

thread 'main' panicked at 'build_output_stream failed with all supported formats: BackendSpecific { err: BackendSpecificError { description: "ALSA function 'snd_pcm_sw_params' failed with error 'EINVAL: Invalid argument'" } }', /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:208:22
stack backtrace:
   0: rust_begin_unwind
             at /rustc/3d0774d0dc98084d25d95cc1909a8051ebbd9cb1/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/3d0774d0dc98084d25d95cc1909a8051ebbd9cb1/library/core/src/panicking.rs:93:14
   2: core::result::unwrap_failed
             at /rustc/3d0774d0dc98084d25d95cc1909a8051ebbd9cb1/library/core/src/result.rs:1617:5
   3: core::result::Result<T,E>::expect
             at /rustc/3d0774d0dc98084d25d95cc1909a8051ebbd9cb1/library/core/src/result.rs:1259:23
   4: <cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::try_new_output_stream::{{closure}}
             at /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:204:17
   5: core::result::Result<T,E>::unwrap_or_else
             at /rustc/3d0774d0dc98084d25d95cc1909a8051ebbd9cb1/library/core/src/result.rs:1083:23
   6: <cpal::platform::platform_impl::Device as rodio::stream::CpalDeviceExt>::try_new_output_stream
             at /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:200:12
   7: rodio::stream::OutputStream::try_from_device
             at /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:31:32
   8: rodio::stream::OutputStream::try_default
             at /home/keval/.cargo/registry/src/github.com-1ecc6299db9ec823/rodio-0.13.1/src/stream.rs:45:9
   9: <bevy_audio::audio_output::AudioOutput<P> as core::default::Default>::default
             at /home/keval/.cargo/git/checkouts/bevy-9ae29307e9bb7454/db55bf5/crates/bevy_audio/src/audio_output.rs:22:39
  10: <T as bevy_ecs::world::FromWorld>::from_world
             at /home/keval/.cargo/git/checkouts/bevy-9ae29307e9bb7454/db55bf5/crates/bevy_ecs/src/world/mod.rs:928:9
  11: bevy_app::app_builder::AppBuilder::init_non_send_resource
             at /home/keval/.cargo/git/checkouts/bevy-9ae29307e9bb7454/db55bf5/crates/bevy_app/src/app_builder.rs:272:28
  12: <bevy_audio::AudioPlugin as bevy_app::plugin::Plugin>::build
             at /home/keval/.cargo/git/checkouts/bevy-9ae29307e9bb7454/db55bf5/crates/bevy_audio/src/lib.rs:23:9
  13: bevy_app::plugin_group::PluginGroupBuilder::finish
             at /home/keval/.cargo/git/checkouts/bevy-9ae29307e9bb7454/db55bf5/crates/bevy_app/src/plugin_group.rs:104:21
  14: bevy_app::app_builder::AppBuilder::add_plugins
             at /home/keval/.cargo/git/checkouts/bevy-9ae29307e9bb7454/db55bf5/crates/bevy_app/src/app_builder.rs:295:9
  15: expanse::main
             at ./src/main.rs:4:5
  16: core::ops::function::FnOnce::call_once
             at /rustc/3d0774d0dc98084d25d95cc1909a8051ebbd9cb1/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Additional information

alsamixer shows correct card as default.

Works fine if using a ~/.asoundrc file:

pcm.!default {
        type hw
        card 2
}

ctl.!default {
        type hw
        card 2
}

When using bevy main I get the following error while playing audio:

ALSA lib pcm_dmix.c:1035:(snd_pcm_dmix_open) unable to open slave

and no error when there's no other audio sources playing.

@thechubbypanda thechubbypanda added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 21, 2021
@Ixentus
Copy link
Contributor

Ixentus commented Aug 21, 2021

Since this only happens when there are other sources playing, try: https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture#Dmix

You might also want to try using pipewire or pulseaudio

@thechubbypanda
Copy link
Author

Adding the lines from the wiki:

defaults.pcm.card 2
defaults.ctl.card 2

pcm.dsp {
    type plug
    slave.pcm "dmix"
}

still doesn't help sadly.

How can I force the use of pulseaudio? I have it installed and I believe my plasma session uses it 🤷‍♂️

@thechubbypanda
Copy link
Author

thechubbypanda commented Aug 21, 2021

In an attempt to get pulseaudio to take presidence over alsa, I installed pulseaudio-alsa which appears to have solved the issue with no alsa config files required. I'm therefore concluding that pulseaudio is now functioning as the primary audio handler and I recommend to anyone else who has this issue to not use alsa smh 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled
Projects
None yet
Development

No branches or pull requests

2 participants