Hi I’m using the C++ audio example lib and came across a little trick I thought I would share.
I am in a situation where talking to the alsa device directly is not possible.
Another device has a lock on the sound card.
So.
Even though the code says
Requires one parameter (ID of the sound card) in the form of plughw:1,0 (where 1=card number, 0=device).
You can find these viacat /proc/asound/cards
. E.g. for:
0 [Headphones ]: bcm2835_headphonbcm2835 Headphones - bcm2835 Headphones
bcm2835 Headphones
1 [Webcam ]: USB-Audio - C922 Pro Stream Webcam
C922 Pro Stream Webcam at usb-0000:01:00.0-1.3, high speed
The ID for ‘C922 Pro Stream Webcam’ is then plughw:1,0
if you have pulse running and the alsa pulse plugin
You can use the aliases ie:
arecord -L
gives you
default
Playback/recording through the PulseAudio sound server
…
you can just run your code with
./build/audio default
and it will listen via the pulse pipe and works fine.
‘default’ works so any other working input should also work the same way
Enjoy.