diff --git a/src/main/java/seng302/utilities/Sounds.java b/src/main/java/seng302/utilities/Sounds.java index 0678369c..b929205d 100644 --- a/src/main/java/seng302/utilities/Sounds.java +++ b/src/main/java/seng302/utilities/Sounds.java @@ -14,8 +14,9 @@ public class Sounds { private static MediaPlayer musicPlayer; private static MediaPlayer soundEffect; private static MediaPlayer soundPlayer; - private static AudioClip hoverSoundPlayer = new AudioClip(Sounds.class.getClassLoader().getResource("sounds/sound-over.wav").toExternalForm());; + private static MediaPlayer hoverSoundPlayer; + private static boolean hoverInitialized = false; private static boolean musicMuted = false; private static boolean soundEffectsMuted = false; @@ -168,7 +169,17 @@ public class Sounds { public static void playHoverSound() { if (!soundEffectsMuted) { - hoverSoundPlayer.setVolume(2.5); + if (!hoverInitialized) { + Media crashSound = new Media( + Sounds.class.getClassLoader().getResource("sounds/Error-sound-effect.mp3") + .toString()); + hoverSoundPlayer = new MediaPlayer(crashSound); + hoverInitialized = true; + } + hoverSoundPlayer.setVolume(0.5); + if (hoverSoundPlayer != null) { + hoverSoundPlayer.stop(); + } hoverSoundPlayer.play(); } } diff --git a/src/main/resources/sounds/Error-sound-effect.mp3 b/src/main/resources/sounds/Error-sound-effect.mp3 new file mode 100644 index 00000000..e27176ff Binary files /dev/null and b/src/main/resources/sounds/Error-sound-effect.mp3 differ diff --git a/src/main/resources/sounds/sound-over.wav b/src/main/resources/sounds/sound-over.wav deleted file mode 100644 index c3e06199..00000000 Binary files a/src/main/resources/sounds/sound-over.wav and /dev/null differ