Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
Corrected ALSA capture device list on Linux.
Browse files Browse the repository at this point in the history
This modifies the ALSA input device list to use the output of `arecord -l` instead of `aplay -l`.
With this, audio devices that are input-only are correctly shown in the capture list, and non-input devices are also hidden.
  • Loading branch information
jawsper authored and falkTX committed Nov 17, 2019
1 parent 0ecd439 commit 868492c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/jacksettings.py
Expand Up @@ -706,10 +706,12 @@ def loadDriverSettings(self, reset=False, forceReset=False):
# -----------------------------------------------------------------
# Helper functions

def getAlsaDeviceList(self):
def getAlsaDeviceList(self, playback=True):
alsaDeviceList = []

aplay_out = getoutput("env LANG=C LC_ALL=C aplay -l").split("\n")
executable = 'aplay' if playback else 'arecord'

aplay_out = getoutput("env LANG=C LC_ALL=C {} -l".format(executable)).split("\n")
for line in aplay_out:
line = line.strip()
if line.startswith("card "):
Expand Down Expand Up @@ -792,10 +794,12 @@ def slot_checkDriverSelection(self, row):
self.ui.obj_driver_playback.addItem("none")

if LINUX:
dev_list = self.getAlsaDeviceList()
for dev in dev_list:
self.ui.obj_driver_capture.addItem(dev)
dev_list_playback = self.getAlsaDeviceList(playback=True)
dev_list_record = self.getAlsaDeviceList(playback=False)
for dev in dev_list_playback:
self.ui.obj_driver_playback.addItem(dev)
for dev in dev_list_record:
self.ui.obj_driver_capture.addItem(dev)
else:
dev_list = gJackctl.GetParameterConstraint(["driver", "device"])[3]
for i in range(len(dev_list)):
Expand Down

0 comments on commit 868492c

Please sign in to comment.