Audio für Jar-File
This commit is contained in:
1 parent
a6be6c4710
commit
111188d0c7
1 file changed
+15
-5
@@ -1,7 +1,10 @@
|
||||
package de.heatup.audio;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.Clip;
|
||||
import javax.sound.sampled.Line;
|
||||
@@ -37,10 +40,13 @@ public class AudioPlayer {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
InputStream audioSrc = getClass().getResourceAsStream(file);
|
||||
//add buffer for mark/reset support
|
||||
InputStream bufferedIn = new BufferedInputStream(audioSrc);
|
||||
AudioInputStream audioStream = AudioSystem.getAudioInputStream(bufferedIn);
|
||||
|
||||
|
||||
|
||||
clip.open(AudioSystem.getAudioInputStream(cl.getResourceAsStream(file)));
|
||||
|
||||
clip.open(audioStream);
|
||||
clip.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -69,8 +75,12 @@ public class AudioPlayer {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
clip.open(AudioSystem.getAudioInputStream(cl.getResourceAsStream(file)));
|
||||
InputStream audioSrc = cl.getResourceAsStream(file);
|
||||
//add buffer for mark/reset support
|
||||
InputStream bufferedIn = new BufferedInputStream(audioSrc);
|
||||
//AudioInputStream audioStream = AudioSystem.getAudioInputStream(bufferedIn);
|
||||
clip.open(AudioSystem.getAudioInputStream(bufferedIn));
|
||||
//clip.open(AudioSystem.getAudioInputStream(cl.getResourceAsStream(file)));
|
||||
clip.loop(clip.LOOP_CONTINUOUSLY);
|
||||
|
||||
} catch(Exception e) {
|
||||
|
||||
Reference in new issue
Block a user