eventDispatch nur nach initialisierung aufrufen

This commit is contained in:
ngb
2022-07-11 22:09:00 +02:00
parent 5557030e0d
commit 99d0e702aa

View File

@@ -194,7 +194,9 @@ public class Music implements Audio {
private void stream() { private void stream() {
audioLine.start(); audioLine.start();
playing = true; playing = true;
if( eventDispatcher != null ) {
eventDispatcher.dispatchEvent("start", Music.this); eventDispatcher.dispatchEvent("start", Music.this);
}
byte[] bytesBuffer = new byte[BUFFER_SIZE]; byte[] bytesBuffer = new byte[BUFFER_SIZE];
int bytesRead = -1; int bytesRead = -1;
@@ -221,8 +223,10 @@ public class Music implements Audio {
playing = false; playing = false;
streamingStopped(); streamingStopped();
if( eventDispatcher != null ) {
eventDispatcher.dispatchEvent("stop", Music.this); eventDispatcher.dispatchEvent("stop", Music.this);
} }
}
private boolean openLine() { private boolean openLine() {
if( audioLine != null ) { if( audioLine != null ) {