alsa: add support for different sound cards
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 23 Feb 2024 17:31:09 +0000 (12:31 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Fri, 1 Mar 2024 18:00:46 +0000 (13:00 -0500)
recipes-multimedia/musicpd/mpd_%.bbappend

index 0bb6f27..a158eb0 100644 (file)
@@ -7,13 +7,27 @@ SRC_URI:append = " \
      file://classique.m3u \
 "
 
+do_install:append() {
+    ALSA_MIXER="PCM"
+}
+
+do_install:append:wandboard() {
+    ALSA_DEVICE_NAME="imx6wandboardsg"
+}
+
+do_install:append:rpi() {
+    # Internal sound card
+    ALSA_DEVICE_NAME="headphones"
+}
+
 do_install:append() {
     echo "zeroconf_enabled    \"yes\"" >> ${D}/${sysconfdir}/mpd.conf
     echo "zeroconf_name       \"Serveur Musique MPD\"" >> ${D}/${sysconfdir}/mpd.conf
     echo "audio_output {" >> ${D}/${sysconfdir}/mpd.conf
     echo "    type    \"alsa\"" >> ${D}/${sysconfdir}/mpd.conf
-    echo "    name    \"My ALSA Device\"" >> ${D}/${sysconfdir}/mpd.conf
+    echo "    name    \"${ALSA_DEVICE_NAME}\"" >> ${D}/${sysconfdir}/mpd.conf
     echo "    device  \"hw:${ALSA_DEVICE_ID},0\"" >> ${D}/${sysconfdir}/mpd.conf
+    echo "    mixer_control \"${ALSA_MIXER}\"" >> ${D}/${sysconfdir}/mpd.conf
     echo "}" >> ${D}/${sysconfdir}/mpd.conf
 
     install -m 644 -o mpd -g audio ${WORKDIR}/*.m3u ${D}/${localstatedir}/lib/mpd/playlists/