Browse Source

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.
tags/v0.9.1
Jasper Seidel Filipe Coelho <falktx@falktx.com> 6 years ago
parent
commit
868492c4fe
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      src/jacksettings.py

+ 9
- 5
src/jacksettings.py View File

@@ -706,10 +706,12 @@ class JackSettingsW(QDialog):
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Helper functions # Helper functions


def getAlsaDeviceList(self):
def getAlsaDeviceList(self, playback=True):
alsaDeviceList = [] 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: for line in aplay_out:
line = line.strip() line = line.strip()
if line.startswith("card "): if line.startswith("card "):
@@ -792,10 +794,12 @@ class JackSettingsW(QDialog):
self.ui.obj_driver_playback.addItem("none") self.ui.obj_driver_playback.addItem("none")


if LINUX: 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) self.ui.obj_driver_playback.addItem(dev)
for dev in dev_list_record:
self.ui.obj_driver_capture.addItem(dev)
else: else:
dev_list = gJackctl.GetParameterConstraint(["driver", "device"])[3] dev_list = gJackctl.GetParameterConstraint(["driver", "device"])[3]
for i in range(len(dev_list)): for i in range(len(dev_list)):


Loading…
Cancel
Save