From a053315675e6764fe95c671139d796893c2b41a1 Mon Sep 17 00:00:00 2001 From: Denny Sheirer Date: Thu, 19 Feb 2026 03:54:10 -0500 Subject: [PATCH] #2364 Audio Playback supports 64-line alsa mixers as stereo output (#2374) Co-authored-by: denny --- .../AudioPlaybackDeviceDescriptor.java | 18 ++++- .../playback/AudioPlaybackDeviceManager.java | 69 +++++++++++++++---- 2 files changed, 72 insertions(+), 15 deletions(-) diff --git a/src/main/java/io/github/dsheirer/audio/playback/AudioPlaybackDeviceDescriptor.java b/src/main/java/io/github/dsheirer/audio/playback/AudioPlaybackDeviceDescriptor.java index d1f05b7b..31ed6b56 100644 --- a/src/main/java/io/github/dsheirer/audio/playback/AudioPlaybackDeviceDescriptor.java +++ b/src/main/java/io/github/dsheirer/audio/playback/AudioPlaybackDeviceDescriptor.java @@ -50,9 +50,25 @@ public class AudioPlaybackDeviceDescriptor implements Comparable 8) { - discoveredFormats.add(audioFormat); - devices.add(new AudioPlaybackDeviceDescriptor(mixerInfo, audioFormat)); + if(audioFormat.getSampleRate() == AudioSystem.NOT_SPECIFIED) + { + discoveredFormats.add(audioFormat); + //Modify the format for 8 kHz sample rate, 2 channels, 4 bytes per frame + AudioFormat updatedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, + 8000, 16, 2, 4, + 8000, false); + devices.add(new AudioPlaybackDeviceDescriptor(mixerInfo, updatedFormat)); + } + else if(audioFormat.getSampleRate() == 8000) + { + discoveredFormats.add(audioFormat); + //Modify the format for 8 kHz sample rate, 2 channels, 4 bytes per frame + AudioFormat updatedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, + audioFormat.getSampleRate(), 16, 2, 4, + audioFormat.getFrameRate(), false); + devices.add(new AudioPlaybackDeviceDescriptor(mixerInfo, updatedFormat)); + } } + //TODO: remove the 2 channels max restriction once supported +// else if(audioFormat.getChannels() > 2 && audioFormat.getChannels() <= 8) +// { +// if(audioFormat.getSampleRate() == AudioSystem.NOT_SPECIFIED) +// { +// discoveredFormats.add(audioFormat); +// //Modify the format for 8 kHz sample rate +// AudioFormat updatedFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, +// 8000, 16, audioFormat.getChannels(), audioFormat.getFrameSize(), +// 8000, false); +// devices.add(new AudioPlaybackDeviceDescriptor(mixerInfo, updatedFormat)); +// } +// else if(audioFormat.getSampleRate() == 8000) +// { +// discoveredFormats.add(audioFormat); +// devices.add(new AudioPlaybackDeviceDescriptor(mixerInfo, audioFormat)); +// } +// } } } }