Skip to main content
Topic: Set Bluealsa default when Headset is connected and Hwcard when it's disconnected (Read 1678 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Set Bluealsa default when Headset is connected and Hwcard when it's disconnected

Hello everybody.

I am tryng to get rid of pulseaudio, I wrote kind of script for s6 to start bluealsa and I follow the steps from official page.

Everything is working fine. Except for one thing that I don't how to fancy it.

I created a .asoundrc file with this:

Code: [Select]
defaults.bluealsa.service "org.bluealsa"
defaults.bluealsa.device  <MydeviceID>
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000

Then if I want my sound through my headset I should execute this:

Code: [Select]
aplay -D bluealsa 

If I change the .asoundrc file to this:


Code: [Select]
defaults.bluealsa.service "org.bluealsa"
defaults.bluealsa.device <MydeviceID>
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000
pcm.!default bluealsa
ctl.!default bluealsa

I don't have to specify "-D bluealsa" but when I disconnect my headset then I get the error.

Code: [Select]
ALSA lib bluealsa-pcm.c:892:(_snd_pcm_bluealsa_open) Couldn't get BlueALSA PCM: PCM not found
aplay: main:830: audio open error: No such device

I know that behaviour is expected but I don't how to route audio to Headset when is connected and route to card when it's disconnected.  I've been reading about asoundrc but It's quite confusing for me.

I also read this  and this.

Did anyone have the same situation than I? I would appreciate any help.

Best regards.
Artix Linux Colombia