diff --git a/HeatUp/src/de/heatup/audio/AudioPlayer.java b/HeatUp/src/de/heatup/audio/AudioPlayer.java index 7ac04bc..3570834 100644 --- a/HeatUp/src/de/heatup/audio/AudioPlayer.java +++ b/HeatUp/src/de/heatup/audio/AudioPlayer.java @@ -10,8 +10,11 @@ import javax.sound.sampled.LineListener; public class AudioPlayer { - public AudioPlayer(/** String file */) { - ///this.file = file; + public AudioPlayer() { + /** oder anstelle pfad an die methode play, + * immer an die klasse und dann einen Player für jedes Soundfile + */ + } public void play(String file) { @@ -27,7 +30,13 @@ public class AudioPlayer { } }); - clip.open(AudioSystem.getAudioInputStream(new File(file))); + File f = new File(file); + if(!f.exists()) { + System.out.println("File not found: " + f.getAbsolutePath()); + return; + } + + clip.open(AudioSystem.getAudioInputStream(f)); clip.start(); } catch (Exception e) {