mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 09:09:46 +02:00
Audio für Jar-File
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package de.heatup.audio;
|
package de.heatup.audio;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import javax.sound.sampled.AudioInputStream;
|
||||||
import javax.sound.sampled.AudioSystem;
|
import javax.sound.sampled.AudioSystem;
|
||||||
import javax.sound.sampled.Clip;
|
import javax.sound.sampled.Clip;
|
||||||
import javax.sound.sampled.Line;
|
import javax.sound.sampled.Line;
|
||||||
@@ -37,10 +40,13 @@ public class AudioPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
InputStream audioSrc = getClass().getResourceAsStream(file);
|
||||||
|
//add buffer for mark/reset support
|
||||||
|
InputStream bufferedIn = new BufferedInputStream(audioSrc);
|
||||||
|
AudioInputStream audioStream = AudioSystem.getAudioInputStream(bufferedIn);
|
||||||
|
|
||||||
|
|
||||||
|
clip.open(audioStream);
|
||||||
clip.open(AudioSystem.getAudioInputStream(cl.getResourceAsStream(file)));
|
|
||||||
clip.start();
|
clip.start();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -69,8 +75,12 @@ public class AudioPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
InputStream audioSrc = cl.getResourceAsStream(file);
|
||||||
clip.open(AudioSystem.getAudioInputStream(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);
|
clip.loop(clip.LOOP_CONTINUOUSLY);
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user