metronome: update for volume api changes
This commit is contained in:
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.metronome;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Preferences;
|
||||
import net.runelite.api.SoundEffectID;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -77,20 +78,21 @@ public class MetronomePlugin extends Plugin
|
||||
{
|
||||
// As playSoundEffect only uses the volume argument when the in-game volume isn't muted, sound effect volume
|
||||
// needs to be set to the value desired for ticks or tocks and afterwards reset to the previous value.
|
||||
int previousVolume = client.getSoundEffectVolume();
|
||||
Preferences preferences = client.getPreferences();
|
||||
int previousVolume = preferences.getSoundEffectVolume();
|
||||
|
||||
if (shouldTock && config.tockVolume() > 0)
|
||||
{
|
||||
client.setSoundEffectVolume(config.tockVolume());
|
||||
preferences.setSoundEffectVolume(config.tockVolume());
|
||||
client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, config.tockVolume());
|
||||
}
|
||||
else if (config.tickVolume() > 0)
|
||||
{
|
||||
client.setSoundEffectVolume(config.tickVolume());
|
||||
preferences.setSoundEffectVolume(config.tickVolume());
|
||||
client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP, config.tickVolume());
|
||||
}
|
||||
|
||||
client.setSoundEffectVolume(previousVolume);
|
||||
preferences.setSoundEffectVolume(previousVolume);
|
||||
|
||||
shouldTock = !shouldTock;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user