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: Calling Host::input_devices() breaks Host::output_devices(), and vice versa #615

Open
ssssam opened this issue Nov 15, 2021 · 1 comment

Comments

@ssssam
Copy link

ssssam commented Nov 15, 2021

To reproduce: find a device name that supports capture and playback (you can use aplay -L and arecord -L), then pass it as poth input and output to feedback example:

> cargo run --example feedback sysdefault:CARD=sofhdadsp sysdefault:CARD=sofhdadsp
thread 'main' panicked at 'failed to find output device', cpal/examples/feedback.rs:119:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Note the device name is same input and output, and it exists when we call input_devices() but not when we call output_devices(). The cause: the second time we iterate Devices, the code calls DeviceHandles::open() on the device and returns EBUSY, so the iterator doesn't return the device.

The code in feedback.rs has not actually opened the device, so perhaps the iterator isn't correctly freeing the handle after opening it.

@ssssam
Copy link
Author

ssssam commented Nov 16, 2021

I am struggling to find how to work around or fix this problem.

Options I've thought of:

  • Add duplex API, as in: Proposal: Duplex API #553
  • Add a 'stream_type' hint to Devices, use it to avoid opening playback handle when we are querying capture devices

ssssam added a commit to ssssam/boucle that referenced this issue Nov 16, 2021
CPAL cannot be used on Organelle.

  * Using default audio device gives a EPIPE error in snd_pcm_start()
  * Specifying device `default=CARD=Codec` fails because of
    RustAudio/cpal#615
  * Using JACK backend fails for reasons I didn't investigate - the
    `feedback` example fails with 'unsupported configuration' even
    though it's clearly using a supported configuration.

JACK is available on Organelle and can play sound, we just need to start
it in the run.sh script.

I don't have time to fix any of the CPAL problems so let's switch to
JACK for everything.

This can also be tested locally on desktop, but see:
RustAudio/rust-jack#142
ssssam added a commit to ssssam/boucle that referenced this issue Nov 21, 2021
CPAL cannot be used on Organelle.

  * Using default audio device gives a EPIPE error in snd_pcm_start()
  * Specifying device `default=CARD=Codec` fails because of
    RustAudio/cpal#615
  * Using JACK backend fails for reasons I didn't investigate - the
    `feedback` example fails with 'unsupported configuration' even
    though it's clearly using a supported configuration.

JACK is available on Organelle and can play sound, we just need to start
it in the run.sh script.

I don't have time to fix any of the CPAL problems so let's switch to
JACK for everything.

This can also be tested locally on desktop, but see:
RustAudio/rust-jack#142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant