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

Commit 868492c

Browse files
jawsperfalkTX
authored andcommitted
Corrected ALSA capture device list on Linux.
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.
1 parent 0ecd439 commit 868492c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/jacksettings.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -706,10 +706,12 @@ def loadDriverSettings(self, reset=False, forceReset=False):
706706
# -----------------------------------------------------------------
707707
# Helper functions
708708

709-
def getAlsaDeviceList(self):
709+
def getAlsaDeviceList(self, playback=True):
710710
alsaDeviceList = []
711711

712-
aplay_out = getoutput("env LANG=C LC_ALL=C aplay -l").split("\n")
712+
executable = 'aplay' if playback else 'arecord'
713+
714+
aplay_out = getoutput("env LANG=C LC_ALL=C {} -l".format(executable)).split("\n")
713715
for line in aplay_out:
714716
line = line.strip()
715717
if line.startswith("card "):
@@ -792,10 +794,12 @@ def slot_checkDriverSelection(self, row):
792794
self.ui.obj_driver_playback.addItem("none")
793795

794796
if LINUX:
795-
dev_list = self.getAlsaDeviceList()
796-
for dev in dev_list:
797-
self.ui.obj_driver_capture.addItem(dev)
797+
dev_list_playback = self.getAlsaDeviceList(playback=True)
798+
dev_list_record = self.getAlsaDeviceList(playback=False)
799+
for dev in dev_list_playback:
798800
self.ui.obj_driver_playback.addItem(dev)
801+
for dev in dev_list_record:
802+
self.ui.obj_driver_capture.addItem(dev)
799803
else:
800804
dev_list = gJackctl.GetParameterConstraint(["driver", "device"])[3]
801805
for i in range(len(dev_list)):

0 commit comments

Comments
 (0)