Skip to content

Commit

Permalink
#2022 Audio output reset now reacquires gain and mute controls. (#2023)
Browse files Browse the repository at this point in the history
Co-authored-by: Dennis Sheirer <[email protected]>
  • Loading branch information
DSheirer and Dennis Sheirer authored Oct 16, 2024
1 parent 54a0ca5 commit 4977c3e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/main/java/io/github/dsheirer/audio/playback/AudioOutput.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 4977c3e

Please sign in to comment.