mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 06:09:45 +02:00
Audio für Jar-File
This commit is contained in:
@@ -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