Skip to content

Linux Audio Fixes#223

Merged
rruchte merged 1 commit into
JS8Call-improved:masterfrom
rruchte:audio_device_refactor
Mar 12, 2026
Merged

Linux Audio Fixes#223
rruchte merged 1 commit into
JS8Call-improved:masterfrom
rruchte:audio_device_refactor

Conversation

@rruchte

@rruchte rruchte commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

Refactor audio device settings to use device ID instead of description
Misc audio device identification and handling improvements
Audio device diagnostics

This is an attempt to alleviate some of the Linux audio problems. This does not address the problem where some oddball inputs are not listed, but it does solve the "Requested input audio format is not supported on device" problem. I'd like to get some Linux users to test this, particularly if you have experienced audio weirdness.

@rruchte rruchte requested review from Chris-AC9KH and wmiler March 8, 2026 21:59
@rruchte rruchte self-assigned this Mar 8, 2026
@rruchte rruchte added bug Something isn't working enhancement New feature or request WIP Work In Progress labels Mar 8, 2026
@wmiler

wmiler commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

Running it now @rruchte Rob. Seems to be working find so far.

I like the diagnostic output, that is generally helpful for other stuff as well.

@wmiler

wmiler commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

Couple other paths that would be nice to know, are for the config (JS8Call.ini) and the data directories (ALL.txt).

@rruchte rruchte force-pushed the audio_device_refactor branch 2 times, most recently from bd94fdf to d6b0411 Compare March 9, 2026 01:37
@rruchte

rruchte commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator Author

@wmiler Good idea, I've added this:

Screenshot From 2026-03-08 21-38-44

@wmiler wmiler left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything for my system is running well with this code. Just a note, I don't have pactl installed on my system, so I haven't tested that.

@rruchte

rruchte commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator Author

Great, thanks for testing. The pactl output will look like this:

pactl list sources short:
53	alsa_output.usb-BurrBrown_from_Texas_Instruments_USB_AUDIO_CODEC-00.analog-stereo.monitor	PipeWire	s16le 2ch 48000Hz	SUSPENDED
54	alsa_input.usb-BurrBrown_from_Texas_Instruments_USB_AUDIO_CODEC-00.iec958-stereo	PipeWire	s16le 2ch 48000Hz	RUNNING
55	alsa_output.pci-0000_00_1f.3.analog-stereo.monitor	PipeWire	s32le 2ch 48000Hz	RUNNING
56	alsa_input.pci-0000_00_1f.3.analog-stereo	PipeWire	s32le 2ch 48000Hz	SUSPENDED
3378	alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor	PipeWire	s32le 2ch 48000Hz	SUSPENDED

pactl list sinks short:
53	alsa_output.usb-BurrBrown_from_Texas_Instruments_USB_AUDIO_CODEC-00.analog-stereo	PipeWire	s16le 2ch 48000Hz	SUSPENDED
55	alsa_output.pci-0000_00_1f.3.analog-stereo	PipeWire	s32le 2ch 48000Hz	RUNNING
3378	alsa_output.pci-0000_01_00.1.hdmi-stereo	PipeWire	s32le 2ch 48000Hz	SUSPENDED

pactl info:
Server String: /run/user/1000/pulse/native
Library Protocol Version: 35
Server Protocol Version: 35
Is Local: yes
Client Index: 4109
Tile Size: 65472
User Name: rob
Host Name: straylight
Server Name: PulseAudio (on PipeWire 1.4.10)
Server Version: 15.0.0
Default Sample Specification: float32le 2ch 48000Hz
Default Channel Map: front-left,front-right
Default Sink: alsa_output.pci-0000_00_1f.3.analog-stereo
Default Source: alsa_input.usb-BurrBrown_from_Texas_Instruments_USB_AUDIO_CODEC-00.iec958-stereo
Cookie: f1b3:774f

@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

Wow, this is a lot to absorb in one sitting.

I'm not a linux user, other than when I absolutely have to be. But this is what the Audio Diagnostics spits out on MacOS:

JS8Call Audio Device Diagnostics
Timestamp: 2026-03-08T20:34:56

System
  Qt:           6.9.3
  OS:           macOS Tahoe (26.3.1) | Mac16,11
  Kernel:       darwin 25.3.0
  CPU arch:     AppleM4Pro
  AppImage:     

Qt Plugin Paths
  PluginsPath:  /Users/chris/development/JS8Call/build/Release/JS8Call.app/Contents/PlugIns
  LibraryPath:  /Users/chris/development/JS8Call/build/Release/JS8Call.app/Contents/lib
  BinariesPath: /Users/chris/development/JS8Call/build/Release/JS8Call.app/Contents/bin

Environment

Selected (from dialog)
  Input:        IC-7300 Audio In | ~:AMS2_Aggregate:0
  Output:       IC-7300 Audio Out | ~:AMS2_Aggregate:1
  Notification: Mac mini Speakers | BuiltInSpeakerDevice

QMediaDevices::audioInputs() (4)
  - description: BlackHole 2ch
    id:          BlackHole2ch_UID
    mode:        1
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 4
    formats:     1 2 3 4 
  - description: USB Audio CODEC
    id:          AppleUSBAudioEngine:Burr-Brown from TI:USB Audio CODEC:2140000:2
    mode:        1
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 2
    formats:     1 2 3 4 
  - description: PBT3014
    id:          FC-58-FA-35-16-2A:input
    mode:        1
    chConfig:    8
    prefFmt:     8000 Hz, 1 ch, 2
    formats:     1 2 3 4 
  - description: IC-7300 Audio In
    id:          ~:AMS2_Aggregate:0
    mode:        1
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 2
    formats:     1 2 3 4 

QMediaDevices::audioOutputs() (6)
  - description: PBT3014
    id:          FC-58-FA-35-16-2A:output
    mode:        2
    chConfig:    6
    prefFmt:     44100 Hz, 2 ch, 4
    formats:     1 2 3 4 
  - description: 100002480
    id:          3DCE0000-0000-0000-011E-0103802F1D78
    mode:        2
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 2
    formats:     1 2 3 4 
  - description: USB Audio CODEC
    id:          AppleUSBAudioEngine:Burr-Brown from TI:USB Audio CODEC:2140000:1
    mode:        2
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 2
    formats:     1 2 3 4 
  - description: BlackHole 2ch
    id:          BlackHole2ch_UID
    mode:        2
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 4
    formats:     1 2 3 4 
  - description: Mac mini Speakers
    id:          BuiltInSpeakerDevice
    mode:        2
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 4
    formats:     1 2 3 4 
  - description: IC-7300 Audio Out
    id:          ~:AMS2_Aggregate:1
    mode:        2
    chConfig:    6
    prefFmt:     48000 Hz, 2 ch, 2
    formats:     1 2 3 4 

Hints
  - If pactl/wpctl show a device but QMediaDevices does not, suspect QtMultimedia backend/plugin mismatch.
  - Try launching with QT_AUDIO_BACKEND=pulseaudio.
  - If QT_DEBUG_PLUGINS=1 is set before launch, plugin load failures will print to stderr.

So this all looks pretty good, except I don't have pactl/wpctl or pulseaudio. I got MacOS CoreAudio which shows:

chris@Hamshack-Mac % system_profiler SPAudioDataType
Audio:

    Devices:

        27" Studio Display:
          Manufacturer: Apple Inc.
          Output Channels: 16
          Current SampleRate: 48000
          Transport: Thunderbolt3
          Output Source: Default

        USB Audio CODEC:
          Manufacturer: Burr-Brown from TI
          Output Channels: 2
          Current SampleRate: 48000
          Transport: USB
          Output Source: Default

        USB Audio CODEC:
          Input Channels: 2
          Manufacturer: Burr-Brown from TI
          Current SampleRate: 48000
          Transport: USB
          Input Source: Default

        BlackHole 2ch:
          Default Input Device: Yes
          Input Channels: 2
          Manufacturer: Existential Audio Inc.
          Output Channels: 2
          Current SampleRate: 48000
          Transport: Virtual
          Input Source: Default
          Output Source: Default

        Mac mini Speakers:
          Manufacturer: Apple Inc.
          Output Channels: 2
          Current SampleRate: 48000
          Transport: Built-in
          Output Source: Mac mini Speakers

        PBT3014 Sound System:
          Input Channels: 4
          Manufacturer: Apple Inc.
          Current SampleRate: 48000
          Transport: Bluetooth
          Input Source: Default

        PBT3014 Sound System:
          Default Output Device: Yes
          Default System Output Device: Yes
          Manufacturer: Apple Inc.
          Output Channels: 16
          Current SampleRate: 48000
          Transport: Bluetooth
          Output Source: Default

        IC-7300 Audio In:
          Input Channels: 2
          Manufacturer: Apple Inc.
          Current SampleRate: 48000
          Transport: Virtual
          Input Source: Default

        IC-7300 Audio Out:
          Manufacturer: Apple Inc.
          Output Channels: 2
          Current SampleRate: 48000
          Transport: Virtual
          Output Source: Default

So there is some differences between what Qt shows and what the Apple System Profiler shows. But it's close enuf fer guvvermint work.

@rruchte

rruchte commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator Author

Maybe I should limit the "Hints" to Linux only.

@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

I don't suspect Mac or Windows users will use it very often. So maybe just call it "Diagnostic hints for linux" instead of "Hints". Or if you want, the MacOS command to list the audio interfaces is system_profiler SPAudioDataType which can be run by any user. I'm sure Windows has one too.

@rruchte rruchte force-pushed the audio_device_refactor branch from d6b0411 to 49c7170 Compare March 10, 2026 01:14
@rruchte

rruchte commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator Author

I added Mac OS and Windows output and changed the hints to be generic and only output the Linux-specific line on Linux. I have not yet tested the changes on Mac and Win.

@rruchte rruchte force-pushed the audio_device_refactor branch from 49c7170 to fc2dce7 Compare March 10, 2026 01:25
@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

I'll pull this and test it for you on Mac.

But I do think the diagnostic output should be left in the code long-term. I think it might come in handy.

@rruchte

rruchte commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator Author

If it's expanded beyond audio (it arguably is already), we should think about putting it somewhere else. Maybe we should address that now before it gets released.

@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

@rruchte so I connected my iPhone to see how Qt enumerates that, and it does. I'm just posting the pertinent output here:

  • The Environment part does not work. On Mac this is privileged information that Qt itself is not allowed access to. You can list it for a specific application, and assume that app is installed in /Applications, but in this case it's not as I'm running it from the build directory
  • The MacOS Loader does not work, and never will. No userspace application is allowed access to that. You would have to use the Xcode commandline tool otool and that's only going to work on a machine that is used for development and has Xcode installed in it. And further the MacOS commandline terminal does not have access to ANYTHING outside of the user directory by default. So unless the user has given Terminal access to the full filesystem it won't work even with otool. May as well remove that one because the security protocols in MacOS are pretty tight.
  • You can remove the (best effort) for Mac because the system_profiler output worked fine
  • It looks like Qt lists the default devices currently being used for audio I/O by CoreAudio as "Qt Defaults". That's ok just for info, as on Mac any device or software can use the default devices (with permission).
JS8Call Audio Device Diagnostics
Timestamp: 2026-03-09T20:31:51

Environment
  Qt / Cross-platform
     QT_PLUGIN_PATH=<unset>
     QT_QPA_PLATFORM_PLUGIN_PATH=<unset>
     QT_QPA_PLATFORM=<unset>
     QT_DEBUG_PLUGINS=<unset>
     QT_LOGGING_RULES=<unset>
     QT_AUDIO_BACKEND=<unset>

  macOS Loader
     DYLD_LIBRARY_PATH=<unset>
     DYLD_FRAMEWORK_PATH=<unset>

Qt Defaults
  Default input:  Chris’ iPhone Microphone | 530B17CB-77CA-4BA5-9487-DEF800000003
  Default output: PBT3014 | FC-58-FA-35-16-2A:output

QMediaDevices::audioInputs() (5)
  - description: Chris’ iPhone Microphone
    id:          530B17CB-77CA-4BA5-9487-DEF800000003
    mode:        1
    chConfig:    8
    prefFmt:     48000 Hz, 1 ch, 4
    formats:     1 2 3 4 
 
macOS Audio (best effort)

sw_vers:
ProductName:		macOS
ProductVersion:		26.3.1
BuildVersion:		25D2128

system_profiler SPAudioDataType:
Audio:

        Chris’ iPhone Microphone:
          Default Input Device: Yes
          Input Channels: 1
          Manufacturer: Apple Inc.
          Current SampleRate: 48000
          Transport: Bluetooth
          Input Source: Default

@wmiler

wmiler commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator

If it's expanded beyond audio (it arguably is already), we should think about putting it somewhere else. Maybe we should address that now before it gets released.

I'd agree with that.

@wmiler

wmiler commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator

@rruchte Rob, maybe a tab to the right of UI labeled Diagnostics or such would be the best place to move it too.

It's putting out really useful stuff, and has already helped me a bit with the QT styling enhancement I've been working on. 👍

@rruchte

rruchte commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator Author

@Chris-AC9KH Chris, are you saying that I should remove all of the Mac OS specific output?

@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

@Chris-AC9KH Chris, are you saying that I should remove all of the Mac OS specific output?

I would say, maybe. That information that Qt is trying to get is very hard to come by on MacOS due to the way libraries and loader paths are protected from malware trying to insert itself into the system. So the stuff that's labeled not set, if it can be removed individually for Mac, take it out. If it works on the other platforms, it doesn't hurt anything and can leave it in.

@rruchte

rruchte commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator Author

@Chris-AC9KH Roger, wilco.

@rruchte rruchte force-pushed the audio_device_refactor branch from fc2dce7 to 0f0353e Compare March 11, 2026 03:00
@rruchte

rruchte commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator Author

@wmiler That's a good place for it, I moved it to its own tab and reverted the Audio tab.

Screenshot From 2026-03-10 23-05-55

@rruchte rruchte force-pushed the audio_device_refactor branch from 0f0353e to 7e488ae Compare March 11, 2026 03:03
@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

@Chris-AC9KH Roger, wilco.

I would say, looking at the code, it's probably easier to leave it in there for the other platforms, at least for the Cross Platform block. From a malware standpoint, it would take a very sophisticated attack that tries to detect if Xcode is installed to use the Xcode tools to try to get that information, without exiting with a failure that would alert the user (and system) that there was an attempted malware attack. And even that would likely fail. MacOS doesn't use "Defender" or anything like that - it just uses the Unix permissions system to an extreme to protect itself.

So it's not going to flag anything as being "malware", just a permissions problem.

@rruchte

rruchte commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator Author

OK, I expect this to evolve a lot over time, maybe you can take ownership of the Mac aspects, and someone else can own Windows.

@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

OK, I expect this to evolve a lot over time, maybe you can take ownership of the Mac aspects, and someone else can own Windows.

Yeah, that would work fine. Go ahead and work on it, merge it, if I see anything in testing after that that could be an issue for MacOS I can submit a PR to fix it.

@rruchte

rruchte commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator Author

Sounds good, I'm done unless anyone else has suggestions.

Misc audio device identification and handling improvements
Adds diagnostics tab to settings to dump system, app, and device details
@rruchte rruchte force-pushed the audio_device_refactor branch from 7e488ae to 9a10826 Compare March 12, 2026 01:45
@rruchte rruchte changed the title Linux Audio Fixes (WIP) Linux Audio Fixes Mar 12, 2026
@rruchte rruchte removed the WIP Work In Progress label Mar 12, 2026
@rruchte rruchte merged commit 7286992 into JS8Call-improved:master Mar 12, 2026
@Joe-K0OG

Copy link
Copy Markdown
Collaborator

A very minor warning from the Windows JTSDK64-Tools build system with the configuration as shown, building commit 7286992. The resulting executable runs fine, and when the same source commit is built on Linux Mint 22.3, no such complaint appears, even though both build systems are at Qt 6.9.3. I notice no difference in the audio enumeration in the JS8Call settings on either Windows or Linux, and all runs fine.

            JTSDK x64 Tools v4.1.1
--------------------------------------------------
Package       Version/Status
--------------------------------------------------
Qt-MSYS2 ...: Disabled
Source .....: none
Qt .........: 6.9.3/mingw_64, Tools/mingw1310_64
Hamlib .....: Dynamic [Git: NONE]
FFTW .......: 3.3.10
LibUSB .....: 1.0.29
NSIS .......: 3.11
PkgConfig ..: 2.1.0
Ruby .......: 4.0.1-1
Subversion .: 1.14.5
CMake ......: 4.2.3
Boost ......: 1.88.0 Functional [mingw1310_64]
--------------------------------------------------

...

--------------------------------------------
-- The C compiler identification is GNU 13.1.0
-- The CXX compiler identification is GNU 13.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/JTSDK64-Tools/tools/Qt/Tools/mingw1310_64/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/JTSDK64-Tools/tools/Qt/Tools/mingw1310_64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found FFTW3: C:/JTSDK64-Tools/tools/fftw/3.3.10/libfftw3f-3.dll
-- Found Usb
-- Found Hamlib
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Configuring done (6.2s)
-- Generating done (0.4s)
-- Build files have been written to: C:/JTSDK64-Tools/tmp/wsjtx-output/qt/6.9.3/2.6.0/Release/build

[  0%] Built target JS8Call_autogen_timestamp_deps
[  1%] Automatic MOC and UIC for target JS8Call
[  1%] Built target JS8Call_autogen
[  2%] Running rcc for resource palettes
[  2%] Running rcc for resource data
[  3%] Running rcc for resource images
[  4%] Building CXX object CMakeFiles/JS8Call.dir/cmake_pch.hxx.gch

...

[ 91%] Building CXX object CMakeFiles/JS8Call.dir/JS8_UI/Configuration.cpp.obj
[ 92%] Building CXX object CMakeFiles/JS8Call.dir/JS8_UI/About.cpp.obj
[ 93%] Building CXX object CMakeFiles/JS8Call.dir/JS8_UI/LogQSO.cpp.obj
[ 94%] Building CXX object CMakeFiles/JS8Call.dir/JS8_UI/mainwindow.cpp.obj
[ 94%] Building CXX object CMakeFiles/JS8Call.dir/JS8_UI/MessageReplyDialog.cpp.obj
C:\JTSDK64-Tools\tmp\wsjtx\JS8_UI\Configuration.cpp: In member function 'QAudioDevice Configuration::impl::find_audio_device(QAudioDevice::Mode, QComboBox*, const QString&, const QString&, bool)':
C:\JTSDK64-Tools\tmp\wsjtx\JS8_UI\Configuration.cpp:4372:63: warning: unused parameter 'allow_monitors' [-Wunused-parameter]
 4372 |                                                    bool const allow_monitors)
      |                                                    ~~~~~~~~~~~^~~~~~~~~~~~~~
[ 95%] Building CXX object CMakeFiles/JS8Call.dir/JS8_UI/MessagePanel.cpp.obj
C:\JTSDK64-Tools\tmp\wsjtx\JS8_UI\Configuration.cpp: In member function 'void Configuration::impl::load_audio_devices(QAudioDevice::Mode, QComboBox*, QAudioDevice*, bool)':
C:\JTSDK64-Tools\tmp\wsjtx\JS8_UI\Configuration.cpp:4453:57: warning: unused parameter 'show_monitors' [-Wunused-parameter]
 4453 |                                              bool const show_monitors)
      |                                              ~~~~~~~~~~~^~~~~~~~~~~~~
[ 96%] Building CXX object CMakeFiles/JS8Call.dir/JS8_UI/WideGraph.cpp.obj
[ 97%] Building CXX object CMakeFiles/JS8Call.dir/JS8_Widgets/CheckableItemComboBox.cpp.obj
[ 98%] Building CXX object CMakeFiles/JS8Call.dir/JS8_Widgets/LazyFillComboBox.cpp.obj

73,
-Joe-
K0OG

@Chris-AC9KH

Copy link
Copy Markdown
Collaborator

allow_monitors et al are linux-specific parameters so you won't get that warning on linux. Don't get it on MacOS either. Probably just on Windows.

This is now merged to master, did not affect MacOS at all. Even the Diagnostic output is pretty good on Mac except for one block that is not allowed access on MacOS. Otherwise, if it fixes linux audio issues, I'd say it's great. I can try building it on arm64 Windows 11 with Qt Creator. But I only look at that if I absolutely have to because Windows 11 and me don't get along very well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants