Un peu de ménage dans le git

This commit is contained in:
2024-12-02 20:51:28 +01:00
parent 0e6450f8c8
commit 9b2a314262
102 changed files with 49818 additions and 27 deletions

View File

@@ -0,0 +1,23 @@
package fr.monkhanny.dorfromantik.utils;
import javax.sound.sampled.*;
import java.io.File;
import java.io.IOException;
public class SoundLoader {
public static Clip loadMusic(String filePath) {
try {
File soundFile = new File(filePath);
AudioInputStream audioStream = AudioSystem.getAudioInputStream(soundFile);
Clip clip = AudioSystem.getClip();
clip.open(audioStream);
return clip;
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException e) {
e.printStackTrace();
System.err.println("Failed to load sound at path: " + filePath);
return null;
}
}
}