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
1 changed files with 6 additions and 6 deletions

View File

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