diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/MusicPlayer.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/MusicPlayer.java index 7a8c9f1f3f3c80a8cb0c0d6578281c58910ac47f..54ce76864432c489906aaf080116f7582a13901a 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/MusicPlayer.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/MusicPlayer.java @@ -23,7 +23,6 @@ public class MusicPlayer { private MediaPlayer mediaPlayer; - //Todo Make music play public void playGameMusic(MusicType musicType) throws IOException { Path pathTypeOfMusic = Paths.get(musicType.getPath()); @@ -33,7 +32,7 @@ public class MusicPlayer { playMusicLoop(resource); } - protected void playMusicLoop(String path ){ + protected void playMusicLoop(String path){ Thread thread = new Thread(() -> { Media media = new Media(getClass().getResource(path).toExternalForm()); mediaPlayer = new MediaPlayer(media); diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SFX.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SFX.java index 4c4dae812049378d829bd1a0c1d6d3504e350530..15b09e21a3fd921ad6ca01e4673cdfcf5089679a 100644 --- a/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SFX.java +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SFX.java @@ -1,10 +1,11 @@ package de.hdm_stuttgart.battlearena.Model.Sound; public enum SFX { - GRASS("/sound/sfx/steps/grass"), - STONE("/sound/sfx/steps/stone"), - COLLISION("/sound/sfx/collision"), - ATTACK("/sound/sfx/attack"); + BOOM("src/main/resources/sound/sfx/otSFX/explosion.mp3"), + POWERUP("src/main/resources/sound/sfx/otSFX/powerup.mp3"), + COIN_COLLECTED("src/main/resources/sound/sfx/otSFX/drop-coins.mp3"), + SWORD_HIT("src/main/resources/sound/sfx/otSFX/sword-hit.mp3"), + COLLISION("src/main/resources/sound/sfx/otSFX/body-falling-to-ground.mp3"); private String path; SFX(String path){ diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SFXLoop.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SFXLoop.java new file mode 100644 index 0000000000000000000000000000000000000000..8f8dec582efdcf33db9b47d15a7f38460c2d626a --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SFXLoop.java @@ -0,0 +1,17 @@ +package de.hdm_stuttgart.battlearena.Model.Sound; + +public enum SFXLoop { + GRASS("/sound/sfx/steps/grass"), + STONE("/sound/sfx/steps/stone"), + COLLISION("/sound/sfx/collision"), + ATTACK("/sound/sfx/attack"); + + private String path; + SFXLoop(String path){ + this.path = path; + } + + public String getPath(){ + return path; + } +} diff --git a/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SoundEffects.java b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SoundEffects.java new file mode 100644 index 0000000000000000000000000000000000000000..c422aa6191b5774ff70d55ebd92e7165756b55a1 --- /dev/null +++ b/src/main/java/de/hdm_stuttgart/battlearena/Model/Sound/SoundEffects.java @@ -0,0 +1,26 @@ +package de.hdm_stuttgart.battlearena.Model.Sound; + +import javafx.scene.media.AudioClip; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.LogManager; + +public class SoundEffects { + private static final Logger log = LogManager.getLogger(SoundEffects.class); + + + + public void playSoundEffect(SFXLoop soundeffect){ + + } + + public void playSoundEffectOnce(SFX soundEffect){ + String path = soundEffect.getPath(); + String resource = path.substring(18); // Begins at Ressource Folder + AudioClip audioClip = new AudioClip(getClass().getResource(resource).toExternalForm()); + } + + + private void playSFXFile(String soundEffect){ + + } +} diff --git a/src/main/resources/sound/sfx/otSFX/body-falling-to-ground.mp3 b/src/main/resources/sound/sfx/otSFX/body-falling-to-ground.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..701a73f47a8dc8013eabb1e7fc8a4a8d0a2b62f8 Binary files /dev/null and b/src/main/resources/sound/sfx/otSFX/body-falling-to-ground.mp3 differ diff --git a/src/main/resources/sound/sfx/otSFX/drop-coins.mp3 b/src/main/resources/sound/sfx/otSFX/drop-coins.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..f2d3de25f746a2effadbf80558cc66b9314e6d60 Binary files /dev/null and b/src/main/resources/sound/sfx/otSFX/drop-coins.mp3 differ diff --git a/src/main/resources/sound/sfx/otSFX/explosion.mp3 b/src/main/resources/sound/sfx/otSFX/explosion.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..f17a59c480ca97ee47e5bfb15141999d72c0a8d6 Binary files /dev/null and b/src/main/resources/sound/sfx/otSFX/explosion.mp3 differ diff --git a/src/main/resources/sound/sfx/otSFX/powerup.mp3 b/src/main/resources/sound/sfx/otSFX/powerup.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..eaa0ef201d75d1e3344a63dac598335861e5d524 Binary files /dev/null and b/src/main/resources/sound/sfx/otSFX/powerup.mp3 differ diff --git a/src/main/resources/sound/sfx/otSFX/sword-hit.mp3 b/src/main/resources/sound/sfx/otSFX/sword-hit.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..1a63129f0e675c128e2dc7f3864d3cb9b48f565e Binary files /dev/null and b/src/main/resources/sound/sfx/otSFX/sword-hit.mp3 differ