ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
gaycomputers opened this issue · 7 comments
I get the following on first time run, sound works on my arch-based machine
cargo run --bin editor
Compiling gamercade_audio v0.1.0 (/home/bread/hacking/gamercade_console/gamercade_audio)
Compiling gamercade_sound_engine v0.1.0 (/home/bread/hacking/gamercade_console/gamercade_sound_engine)
Compiling gamercade_fs v0.1.1 (/home/bread/hacking/gamercade_console/gamercade_fs)
Compiling gamercade_editor v0.1.0 (/home/bread/hacking/gamercade_console/gamercade_editor)
Finished dev [unoptimized + debuginfo] target(s) in 6.15s
Running `target/debug/editor`
ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
thread 'main' panicked at 'called \`Result::unwrap()\` on an \`Err\` value: DeviceNotAvailable',
gamercade_sound_engine/src/sound_engine.rs:171:63
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Thanks for the issue report! I think this might be a driver or config issue, quick googling for ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave
comes up with some results.
ALSA is already included in arch iirc, but may not be configured correctly. Could you try these steps here? https://wiki.archlinux.org/title/Advanced_Linux_Sound_Architecture#Configuration
It's possible that your systems "Default device" or config isn't set up with what cpal wants to see as the default.
I did actually configure a default device but now I've got a similar error, any ideas?
cargo run --bin editor
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/editor`
Output Sample Rate: 44100
Output channels: 2
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BackendSpecific { err: BackendSpecificError { description: "ALSA function 'snd_pcm_sw_params' failed with error 'EINVAL: Invalid argument'" } }', gamercade_sound_engine/src/sound_engine.rs:286:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Heres a backtrace, I'll run through this in my AM
cargo run --bin editor
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/editor`
Output Sample Rate: 44100
Output channels: 2
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BackendSpecific { err: BackendSpecificError { description: "ALSA function 'snd_pcm_sw_params' failed with error 'EINVAL: Invalid argument'" } }', gamercade_sound_engine/src/sound_engine.rs:286:14
stack backtrace:
0: 0x56199a471100 - std::backtrace_rs::backtrace::libunwind::trace::h22157d54c25d05ad
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x56199a471100 - std::backtrace_rs::backtrace::trace_unsynchronized::hf9a98b3986ed5962
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x56199a471100 - std::sys_common::backtrace::_print_fmt::h44f8a801ddb575b4
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/sys_common/backtrace.rs:66:5
3: 0x56199a471100 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h306abe8d5f5fb26d
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/sys_common/backtrace.rs:45:22
4: 0x56199a496c7e - core::fmt::write::h5a3c14feb177cc6f
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/core/src/fmt/mod.rs:1202:17
5: 0x56199a46c235 - std::io::Write::write_fmt::h2fac6c752c3fce7e
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/io/mod.rs:1679:15
6: 0x56199a472933 - std::sys_common::backtrace::_print::h17490259a7578aec
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/sys_common/backtrace.rs:48:5
7: 0x56199a472933 - std::sys_common::backtrace::print::h6dba4ce5923cf00b
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/sys_common/backtrace.rs:35:9
8: 0x56199a472933 - std::panicking::default_hook::{{closure}}::h25daedc6802fa9d1
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:295:22
9: 0x56199a47261f - std::panicking::default_hook::hffec061dc0fa1a5a
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:314:9
10: 0x56199a472fda - std::panicking::rust_panic_with_hook::h74e697c31d32505c
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:698:17
11: 0x56199a472ed7 - std::panicking::begin_panic_handler::{{closure}}::hd0b9cdbd524ed365
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:588:13
12: 0x56199a4715ac - std::sys_common::backtrace::__rust_end_short_backtrace::h3feb3f4e0604d329
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/sys_common/backtrace.rs:138:18
13: 0x56199a472bf2 - rust_begin_unwind
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:584:5
14: 0x561999211423 - core::panicking::panic_fmt::h0f41ee9e7f6526dd
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/core/src/panicking.rs:142:14
15: 0x561999211573 - core::result::unwrap_failed::hcc2e1d3dceac8edc
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/core/src/result.rs:1785:5
16: 0x561999931453 - core::result::Result<T,E>::unwrap::h7887b681da51bffa
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/core/src/result.rs:1107:23
17: 0x5619999224ff - gamercade_sound_engine::sound_engine::SoundEngine::new::h123457b2d63d5964
at /home/bread/hacking/gamercade_console/gamercade_sound_engine/src/sound_engine.rs:185:22
18: 0x56199929b869 - editor::ui::audio::audio_editor::AudioEditor::new::ha25711e9e2c7e0f4
at /home/bread/hacking/gamercade_console/gamercade_editor/src/ui/audio/audio_editor.rs:43:32
19: 0x56199929f4fb - <editor::ui::editor::Editor as core::default::Default>::default::h6c208c90a52937e2
at /home/bread/hacking/gamercade_console/gamercade_editor/src/ui/editor.rs:35:27
20: 0x56199923e52f - editor::main::{{closure}}::h3c895eb462bc9750
at /home/bread/hacking/gamercade_console/gamercade_editor/src/main.rs:16:33
21: 0x561999269078 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h0ef0d98513750ef5
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/core/src/ops/function.rs:248:5
22: 0x5619999b909a - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8d12c58009368a9c
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/alloc/src/boxed.rs:1940:9
23: 0x5619999ee41f - eframe::native::run::glow_integration::GlowWinitApp::new::h34b1beba808c0d0e
at /home/bread/.cargo/registry/src/github.com-1ecc6299db9ec823/eframe-0.19.0/src/native/run.rs:281:27
24: 0x5619999ef6f5 - eframe::native::run::glow_integration::run_glow::{{closure}}::h0d7f2003ee1642cb
at /home/bread/.cargo/registry/src/github.com-1ecc6299db9ec823/eframe-0.19.0/src/native/run.rs:458:21
25: 0x5619999de0b4 - eframe::native::run::with_event_loop::{{closure}}::h3bf67b2ddb567f75
at /home/bread/.cargo/registry/src/github.com-1ecc6299db9ec823/eframe-0.19.0/src/native/run.rs:84:9
26: 0x5619999cff5c - std::thread::local::LocalKey<T>::try_with::hb0d7c8d6d17f10df
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/thread/local.rs:445:16
27: 0x5619999cf89d - std::thread::local::LocalKey<T>::with::hd69639adb06898b8
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/thread/local.rs:421:9
28: 0x5619999ddfb4 - eframe::native::run::with_event_loop::hafc4c995e626bd80
at /home/bread/.cargo/registry/src/github.com-1ecc6299db9ec823/eframe-0.19.0/src/native/run.rs:83:5
29: 0x5619999ef54d - eframe::native::run::glow_integration::run_glow::he197bda88c1c0d51
at /home/bread/.cargo/registry/src/github.com-1ecc6299db9ec823/eframe-0.19.0/src/native/run.rs:456:13
30: 0x5619999efaeb - eframe::run_native::hbd554bd51b969b58
at /home/bread/.cargo/registry/src/github.com-1ecc6299db9ec823/eframe-0.19.0/src/lib.rs:172:13
31: 0x5619992230d6 - editor::main::h7196d524db352e78
at /home/bread/hacking/gamercade_console/gamercade_editor/src/main.rs:13:5
32: 0x56199926ab5b - core::ops::function::FnOnce::call_once::h519354246c065b44
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/core/src/ops/function.rs:248:5
33: 0x56199928a24e - std::sys_common::backtrace::__rust_begin_short_backtrace::hdddd38a998e83f1b
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/sys_common/backtrace.rs:122:18
34: 0x5619992985b1 - std::rt::lang_start::{{closure}}::h0d8c27fed5f209b7
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/rt.rs:166:18
35: 0x56199a46761f - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hb8df718c68d68c9f
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/core/src/ops/function.rs:283:13
36: 0x56199a46761f - std::panicking::try::do_call::h8dddef2304462fc6
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:492:40
37: 0x56199a46761f - std::panicking::try::hdaa6cf91fc468afd
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:456:19
38: 0x56199a46761f - std::panic::catch_unwind::he262720fe982b2af
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panic.rs:137:14
39: 0x56199a46761f - std::rt::lang_start_internal::{{closure}}::h186c7eb03cc01e3d
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/rt.rs:148:48
40: 0x56199a46761f - std::panicking::try::do_call::hd0289857f5ecb87d
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:492:40
41: 0x56199a46761f - std::panicking::try::hb64e3846d05ca699
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panicking.rs:456:19
42: 0x56199a46761f - std::panic::catch_unwind::hf7d3692bfaa54567
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/panic.rs:137:14
43: 0x56199a46761f - std::rt::lang_start_internal::hf0658d13fdb512d4
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/rt.rs:148:20
44: 0x56199929858a - std::rt::lang_start::h7ac7505b6b892255
at /rustc/432abd86f231c908f6df3cdd779e83f35084be90/library/std/src/rt.rs:165:17
45: 0x561999223161 - main
46: 0x7f331adf5290 - <unknown>
47: 0x7f331adf534a - __libc_start_main
48: 0x561999211755 - _start
at /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115
49: 0x0 - <unknown>
Ah! I might have an idea for whats causing this.
Could you try running the beep example from cpal? https://github.com/RustAudio/cpal/blob/master/examples/beep.rs
If that one works then its likely an issue where the sound engine is expecting f32 for the sample format hence building the stream fails.
Indeed it worked!
Thanks for testing! I'll try and get a patch up for this when I have time next, thankfully the cpal examples show what the problem is pretty clearly.
hi @petab1te sorry for the wait, i've just pushed a change to main which I think solves this issue. could you checkit out when you get the chance?