Hello everyone,
I have installed LibreELEC 10.0.2 on RPi 3 B+.
I have a problem with the choice of the sound emission, I'll explain better.
1.
First I enable the following parameter in config.txt:
This is to be able to use the 3.5 Audio Jack
2.
I created autostart.sh where I run the following command on startup::
pactl load-module module-udev-detect
3.
With a script I set the device connected via Bluetooth as the Audio source and everything works fine
import os, subprocess, xbmc, re
#Esegui il comando shell sottostante. Questo assegna il dispositivo bluetooth come fonte predefinita per Kodi
os.system("pactl set-default-source `pactl list short sources | grep -i blue | awk {'print $2 '}`")
#Assegna l'output del comando shell a BT_NAME (nome Bluetooth)
BT_NAME = subprocess.check_output("pactl list sources | grep -i bluetooth.protocol -A 1 | awk 'FNR==2{print $3}'", shell=True)
patron = r'"(.*?)"'
BT_NAME = BT_NAME.decode('utf-8')
BT_NAME = re.compile(patron).findall(BT_NAME)[0]
#Se la variabile non e vuota, crea una finestra di dialogo KODI che mostri il nome del dispositivo bluetooth
if BT_NAME:
xbmc.executebuiltin("Notification(Bluetooth,Activated %s,3000)" % BT_NAME) #Assicurati che questa riga sia rientrata
os.system("pactl unload-module module-loopback")
os.system("pactl load-module module-loopback latency_msec=1000") #Latenza 1 sec
else:
#Se la variabile e vuota, crea una finestra di dialogo KODI che mostra nessun dispositivo bluetooth trovato:
xbmc.executebuiltin("Notification(Bluetooth,No Blutooth Device Found,3000)") #Assicurati che questa riga sia rientrata
Display More
4.
I have created a script to set which "sound card" to play the sound on but this is where I encounter the problem.
Any setting I set (HDMI or Analog) however always comes out in Jack 3.5
# Valori amixer: "0"= Auto, "1"= Jack Audio, "2"=HDMI
# Importo le librerie
import os, re, subprocess, xbmc
from subprocess import check_output
# Eseguo comando e Verifico stato del numid
output = subprocess.check_output("amixer cget numid=3", shell=True)
# Regex per catturare lo stato di numid
patron = r'values.([0-9])'
output_string = output.decode('utf-8')
matches = re.compile(patron).findall(output_string)[0]
# Azioni
if matches == "0":
action = os.system("amixer cset numid=3 1"), xbmc.executebuiltin("Notification(Uscita musica Bluetooth,Analogico,3000)") # Se uscita risulta Auto imposta su Jack
if matches == "1":
action = os.system("amixer cset numid=3 2"), xbmc.executebuiltin("Notification(Uscita musica Bluetooth,HDMI,3000)") # Se uscita risulta Jack imposta su HDMI
if matches == "2":
action = os.system("amixer cset numid=3 1"), xbmc.executebuiltin("Notification(Uscita musica Bluetooth,Analogico,3000)") # Se uscita risulta HDMI imposta su jack
Display More
In the Kodi settings I see the following Audio tabs:
- ALSA: bcm2835 Headphones, bcm2835 Headphones
- PULSE: Default, Bluetooth Audio (PULSEAUDIO)
- PULSE: Built-in Audio Digital Stereo (HDMI), HDMI / Display Port (PULSEAUDIO)
If you select "ALSA: bcm2835 Headphones, bcm2835 Headphones" I hear audio only from Jack 3.5
If I select "PULSE: Built-in Audio Digital Stereo (HDMI), HDMI / Display Port (PULSEAUDIO)" I hear the music in Jack 3.5 and the effects of the Kodi Gui on HDMI.
This whole system in LibreELEC 9.2.8 version worked perfectly.
You can help me?
Thank you