mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-04-14 14:43:33 +02:00
Fehler beim erstellen eines AudioStreams behoben
This commit is contained in:
@@ -4,8 +4,10 @@ import schule.ngb.zm.tasks.TaskRunner;
|
|||||||
import schule.ngb.zm.util.ResourceStreamProvider;
|
import schule.ngb.zm.util.ResourceStreamProvider;
|
||||||
|
|
||||||
import javax.sound.sampled.*;
|
import javax.sound.sampled.*;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -154,9 +156,9 @@ public class Music implements Audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InputStream in = ResourceStreamProvider.getResourceStream(audioSource);
|
URL url = ResourceStreamProvider.getResourceURL(audioSource);
|
||||||
if( in != null ) {
|
if( url != null ) {
|
||||||
final AudioInputStream inStream = AudioSystem.getAudioInputStream(in);
|
final AudioInputStream inStream = AudioSystem.getAudioInputStream(url);
|
||||||
AudioFormat format = inStream.getFormat();
|
AudioFormat format = inStream.getFormat();
|
||||||
|
|
||||||
final int ch = format.getChannels();
|
final int ch = format.getChannels();
|
||||||
@@ -185,11 +187,17 @@ public class Music implements Audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void streamingStopped() {
|
private void streamingStopped() {
|
||||||
playing = false;
|
|
||||||
dispose();
|
dispose();
|
||||||
|
|
||||||
if( looping ) {
|
if( looping ) {
|
||||||
playOnce();
|
if( openLine() ) {
|
||||||
|
stream();
|
||||||
|
} else {
|
||||||
|
playing = false;
|
||||||
|
looping = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
playing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user