Hi community,
I am trying to mix audio coming from a bluetooth device with local audio as shown below.
To play the audio coming from the bluetooth device on the speakers I am using alsaloop configured like this
alsaloop -C bluealsa:DEV=<BT-addr_device>,PROFILE=a2dp -P plughw:0,0 -r 48000 -c 2 -f s32_le --sync=simple -t 200000 -T 1
This works correctly as long as no audio is being played locally. That is, if you are playing audio that was launched with aplay when you try to play bluetooth audio the system gives an error:
playback plughw:0,0 open error: Device or resource busy
I have been looking for solutions on the internet and there is everything. Apparently a solution could be to create a virtual card that has two sources and a destination to act as a mixer and the output is redirected to the physical audio card (plughw:0,0). Some say that with PulseAudio this is very easy to do and with ALSA it is very complicated.
Here are my questions in case you can help me:
Is the best approach to this problem to create a virtual audio card?
With which tool should it be created?
Can PulseAudio and Bluealsa coexist in the same system?
I am using the minimum reference image BSP 6.3.0 on the Verdin iMX8MM.
Regards,
Julián