Skip to content

Commit 87b825b

Browse files
committed
apparently moving a window just breaks onUpdate
1 parent cd631c6 commit 87b825b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/lime/_internal/backend/native/NativeAudioSource.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import sys.thread.Mutex;
66
import haxe.Timer;
77
import haxe.Int64;
88

9-
import lime.app.Application;
109
import lime.media.openal.AL;
1110
import lime.media.openal.ALBuffer;
1211
import lime.media.openal.ALSource;
@@ -129,6 +128,7 @@ class NativeAudioSource {
129128

130129
static var streamMutex:Mutex = new Mutex();
131130
static var streamThread:Thread;
131+
static var streamTimer:Timer;
132132

133133
var streamRemove:Bool;
134134

@@ -491,7 +491,7 @@ class NativeAudioSource {
491491
threadRunning = false;
492492
}
493493

494-
static function streamUpdate(_:Int) {
494+
static function streamUpdate() {
495495
if (!streamMutex.tryAcquire()) return;
496496

497497
var i = queuedStreamSources.length, source:NativeAudioSource;
@@ -514,7 +514,7 @@ class NativeAudioSource {
514514

515515
streamMutex.release();
516516
if (streamSources.length == 0) {
517-
Application.current.onUpdate.remove(streamUpdate);
517+
streamTimer.stop();
518518
if (threadRunning) streamThread.sendMessage(0);
519519
}
520520
else if (threadRunning || (threadRunning = (streamThread = Thread.create(streamThreadRun)) != null))
@@ -536,7 +536,7 @@ class NativeAudioSource {
536536
streamRemove = false;
537537
if (!queuedStreamSources.contains(this) && !streamSources.contains(this)) {
538538
queuedStreamSources.push(this);
539-
if (!Application.current.onUpdate.has(streamUpdate)) Application.current.onUpdate.add(streamUpdate);
539+
if (streamTimer == null || !streamTimer.mRunning) streamTimer = resetTimer(streamTimer, 0, streamUpdate);
540540
}
541541
}
542542

0 commit comments

Comments
 (0)