fix: correctly flush sound data to avoid weird sound noises (#2689)

Fixes #2689
This commit is contained in:
Jindra Petřík
2026-04-06 17:46:44 +02:00
parent c7e5aa9607
commit 30b0ec4e26

View File

@@ -339,6 +339,7 @@ public class SoundTagPlayer implements MediaDisplay {
}
if (getPausedFlag()) {
sourceLine.flush();
synchronized (thread) {
try {
thread.wait(1000);
@@ -350,8 +351,8 @@ public class SoundTagPlayer implements MediaDisplay {
}
if (getClosedFlag()) {
sourceLine.drain();
sourceLine.stop();
sourceLine.flush();
sourceLine.close();
}
audioStream.close();
@@ -362,6 +363,7 @@ public class SoundTagPlayer implements MediaDisplay {
}
if (!getClosedFlag()) {
sourceLine.drain();
decreaseLoopCount();
int currentLoopCount;
@@ -383,7 +385,6 @@ public class SoundTagPlayer implements MediaDisplay {
firePlayingFinished();
if (getClosedFlag()) {
sourceLine.drain();
sourceLine.stop();
sourceLine.close();
return;