Skip to content

Commit 5f07ac9

Browse files
author
Dennis Sheirer
committed
#2022 Audio output reset now reacquires gain and mute controls.
1 parent 54a0ca5 commit 5f07ac9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/main/java/io/github/dsheirer/audio/playback/AudioOutput.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,28 @@ private void playAudio(ByteBuffer buffer)
314314

315315
if(mOutput != null)
316316
{
317+
try
318+
{
319+
Control gain = mOutput.getControl(FloatControl.Type.MASTER_GAIN);
320+
mGainControl = (FloatControl) gain;
321+
}
322+
catch(IllegalArgumentException iae)
323+
{
324+
mLog.warn("Couldn't obtain MASTER GAIN control for stereo line [" +
325+
mMixer.getMixerInfo().getName() + " | " + getChannelName() + "]");
326+
}
327+
328+
try
329+
{
330+
Control mute = mOutput.getControl(BooleanControl.Type.MUTE);
331+
mMuteControl = (BooleanControl) mute;
332+
}
333+
catch(IllegalArgumentException iae)
334+
{
335+
mLog.warn("Couldn't obtain MUTE control for stereo line [" +
336+
mMixer.getMixerInfo().getName() + " | " + getChannelName() + "]");
337+
}
338+
317339
LOGGING_SUPPRESSOR.info("reopen audio output success", 5,
318340
"Closed and reopened audio output - success - mOutput is not null");
319341
}

0 commit comments

Comments
 (0)