Open joprice opened 4 years ago
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?
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"):Is this a bug in the example, or can this error be ignored in some cases?