Timing-Problem beim Aufruf des AudioListeners behoben

This commit is contained in:
ngb
2022-12-13 10:17:25 +01:00
parent 44d0f79c6c
commit 25ce3a35e9

View File

@@ -235,8 +235,8 @@ public class Sound implements Audio {
} }
/** /**
* Lädt falls nötig den {@link Clip} für die * Lädt, falls nötig, den {@link Clip} für die
* {@link #audioSource Audioquelle} und startet die Wiedergabe. * {@link #audioSource Audioquelle}.
* *
* @return {@code true}, wenn der Clip geöffnet werden konnte, {@code false} * @return {@code true}, wenn der Clip geöffnet werden konnte, {@code false}
* sonst. * sonst.
@@ -264,10 +264,6 @@ public class Sound implements Audio {
} }
} else if( event.getType() == LineEvent.Type.STOP ) { } else if( event.getType() == LineEvent.Type.STOP ) {
playbackStopped(); playbackStopped();
if( eventDispatcher != null ) {
eventDispatcher.dispatchEvent("stop", Sound.this);
}
} }
} }
}); });
@@ -313,6 +309,10 @@ public class Sound implements Audio {
private void playbackStopped() { private void playbackStopped() {
playing = false; playing = false;
if( eventDispatcher != null ) {
eventDispatcher.dispatchEvent("stop", Sound.this);
}
if( disposeAfterPlay ) { if( disposeAfterPlay ) {
this.dispose(); this.dispose();
disposeAfterPlay = false; disposeAfterPlay = false;