From 4977c3e4faf320bce306d85af850ed5051623689 Mon Sep 17 00:00:00 2001 From: Denny Sheirer Date: Wed, 16 Oct 2024 04:09:37 -0400 Subject: [PATCH] #2022 Audio output reset now reacquires gain and mute controls. (#2023) Co-authored-by: Dennis Sheirer --- .../dsheirer/audio/playback/AudioOutput.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/io/github/dsheirer/audio/playback/AudioOutput.java b/src/main/java/io/github/dsheirer/audio/playback/AudioOutput.java index 65d43ae82..d383c4129 100644 --- a/src/main/java/io/github/dsheirer/audio/playback/AudioOutput.java +++ b/src/main/java/io/github/dsheirer/audio/playback/AudioOutput.java @@ -314,6 +314,28 @@ private void playAudio(ByteBuffer buffer) if(mOutput != null) { + try + { + Control gain = mOutput.getControl(FloatControl.Type.MASTER_GAIN); + mGainControl = (FloatControl) gain; + } + catch(IllegalArgumentException iae) + { + mLog.warn("Couldn't obtain MASTER GAIN control for stereo line [" + + mMixer.getMixerInfo().getName() + " | " + getChannelName() + "]"); + } + + try + { + Control mute = mOutput.getControl(BooleanControl.Type.MUTE); + mMuteControl = (BooleanControl) mute; + } + catch(IllegalArgumentException iae) + { + mLog.warn("Couldn't obtain MUTE control for stereo line [" + + mMixer.getMixerInfo().getName() + " | " + getChannelName() + "]"); + } + LOGGING_SUPPRESSOR.info("reopen audio output success", 5, "Closed and reopened audio output - success - mOutput is not null"); }