There are lot of existing LADSPA plugins which could be easily used out of the box together with ALSA and kodi. Unfortunately kodi does not support selecting custom ALSA entries. Here is what you need to setup to make it work.
ALSA comes with LADSPA plugin support. A common pattern is to overwrite the default ALSA device with your own including LADSPA. Unfortunately kodi does filter all ALSA devices except the ones directly bound to hardware.
To use LADSPA / ALSA together with kodi, we will have to
grep autospawn /etc/pulse/client.conf autospawn = no
/etc/asound.conf
#-------------------------------------------------- # Cards #-------------------------------------------------- pcm.audiophile { type hw card 1 device 0 subdevice 0 } ctl.audiophile { type hw card 1 device 0 subdevice 0 } #-------------------------------------------------- # Normal alsa #-------------------------------------------------- pcm.!default { type plug slave.pcm "duplex" } pcm.duplex { type asym playback.pcm "ladspa" capture.pcm "dsnooper" } pcm.leveler { type plug slave.pcm "ladspa" } # --- ladspa chain --- pcm.ladspa { type ladspa slave.pcm "dmixplug" path "/usr/lib/ladspa"; plugins [ { label "rms_leveler_3s" } ] } pcm.dmixplug { type plug slave.pcm "dmixer" } pcm.dmixer { type dmix ipc_key 1234 slave { pcm "audiophile" period_size 1024 buffer_size 4096 rate 44100 } } pcm.dsnooper { type dsnoop ipc_key 2048 ipc_perm 0666 slave.pcm "audiophile" slave { period_time 0 period_size 1024 buffer_size 4096 rate 44100 } bindings { 0 0 1 1 } } #-------------------------------------------------- # special entries for pulseaudio/apulse #-------------------------------------------------- pcm.duplexPulse { type asym playback.pcm "dmixerPulse" capture.pcm "dsnooper" } pcm.dmixerPulse { type dmix ipc_key 1234 slave { pcm "audiophile" period_size 1024 buffer_size 4096 rate 44100 } }
cat /usr/share/xsessions/kodi.desktop
[Desktop Entry] Name=Kodi Comment=This session will start Kodi media center Exec=/home/milan/startKodi.sh TryExec=/home/milan/startKodi.sh Type=Application
startKodi.sh
#!/bin/sh export LADSPA_PATH=/usr/lib/ladspa export AE_SINK=ALSA # kodi-standalone # /usr/local/bin/kodi-standalone /usr/local/bin/kodi
git clone git://github.com/xbmc/xbmc.git xbmc vim xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp index 4d87afa..8d9f80a 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp @@ -48,7 +48,8 @@ #define ALSA_CHMAP_KERNEL_BLACKLIST -#define ALSA_OPTIONS (SND_PCM_NO_AUTO_FORMAT | SND_PCM_NO_AUTO_CHANNELS | SND_PCM_NO_AUTO_RESAMPLE) +#define ALSA_OPTIONS (SND_PCM_NO_AUTO_CHANNELS) + #define ALSA_MAX_CHANNELS 16 static enum AEChannel LegacyALSAChannelMap[ALSA_MAX_CHANNELS + 1] = { @@ -1193,17 +1194,7 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force) * found by the enumeration process. Skip them as well ("hw", "dmix", * "plughw", "dsnoop"). */ - else if (baseName != "default" - && baseName != "sysdefault" - && baseName != "surround40" - && baseName != "surround41" - && baseName != "surround50" - && baseName != "surround51" - && baseName != "surround71" - && baseName != "hw" - && baseName != "dmix" - && baseName != "plughw" - && baseName != "dsnoop") + else { EnumerateDevice(list, name, desc ? desc : name, config); }
bootstrap configure make make install