This commit is contained in:
ThatGamerBlue
2021-02-08 09:54:39 +00:00
parent d9cc74671d
commit ccf1e8eb8b

View File

@@ -19,15 +19,6 @@ import org.slf4j.LoggerFactory;
@Singleton @Singleton
public class SoundManager public class SoundManager
{ {
private static final Logger log = LoggerFactory.getLogger(SoundManager.class);
private final RuneLiteConfig runeliteConfig;
@Inject
private SoundManager(RuneLiteConfig runeLiteConfig)
{
this.runeliteConfig = runeLiteConfig;
}
public void play(final Sound sound) public void play(final Sound sound)
{ {
new Thread(new Runnable() new Thread(new Runnable()
@@ -49,15 +40,8 @@ public class SoundManager
int volume = 50; int volume = 50;
FloatControl gainControl = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN); FloatControl gainControl = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
BooleanControl muteControl = (BooleanControl) line.getControl(BooleanControl.Type.MUTE); BooleanControl muteControl = (BooleanControl) line.getControl(BooleanControl.Type.MUTE);
if (volume == 0) muteControl.setValue(false);
{ gainControl.setValue((float) (Math.log((double) volume / 100.0) / Math.log(10.0) * 20.0));
muteControl.setValue(true);
}
else
{
muteControl.setValue(false);
gainControl.setValue((float) (Math.log((double) volume / 100.0) / Math.log(10.0) * 20.0));
}
} }
line.start(); line.start();
SoundManager.this.stream(AudioSystem.getAudioInputStream(outFormat, in), line); SoundManager.this.stream(AudioSystem.getAudioInputStream(outFormat, in), line);