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

"incompatible device" when checking layout_error in sio_record.c example #230

Open
joprice opened this issue Feb 8, 2020 · 1 comment
Open

Comments

@joprice
Copy link

joprice commented Feb 8, 2020

In order to repro an issue I was having trouble debugging using a rust wrapper to this library (https://github.com/RamiHg/soundio-rs), I tried out a similar example sio_record.c, and it worked. I found that the different is that the rust one by default checks the layout_error field https://github.com/RamiHg/soundio-rs/blob/master/src/device.rs#L473 and the example in this repo doesn't. When I added the following check to the example I get the same error I got in the rust version ("incompatible device"):

 if (instream->layout_error) {
  fprintf(stderr, "unable to open input stream: %s", soundio_strerror(instream->layout_error));
  return 1;
}

Is this a bug in the example, or can this error be ignored in some cases?

@joprice
Copy link
Author

joprice commented Feb 8, 2020

It looks like this is based on a call to snd_pcm_set_chmap https://github.com/andrewrk/libsoundio/blob/master/src/alsa.c#L1689. A quick google found me an interesting comment in a random project that lines up with what I'm seeing. https://github.com/moonlight-stream/moonlight-qt/blob/master/app/streaming/audio/renderers/soundioaudiorenderer.cpp#L203. This makes me think that some devices don't allow modifying the channel map. And, if it's already configured as desired, maybe a call to snd_pcm_get_chmap first can detect if the set call is actually needed?

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