瀏覽代碼

fixed time offset handling wrt haxe.Timer.stamp, prevent issues with fades etc when offsetting

Nicolas Cannasse 5 年之前
父節點
當前提交
1ac691620b
共有 1 個文件被更改,包括 13 次插入1 次删除
  1. 13 1
      hxd/snd/Manager.hx

+ 13 - 1
hxd/snd/Manager.hx

@@ -271,7 +271,19 @@ class Manager {
 	}
 
 	public function update() {
-		now = haxe.Timer.stamp() + timeOffset;
+		if( timeOffset != 0 ) {
+			var c = channels;
+			while( c != null ) {
+				c.lastStamp += timeOffset;
+				if( c.currentFade != null ) c.currentFade.start += timeOffset;
+				c = c.next;
+			}
+			for( s in sources )
+				for( b in s.buffers )
+					b.lastStop += timeOffset;
+			timeOffset = 0;
+		}
+		now = haxe.Timer.stamp();
 
 		if (driver == null) {
 			updateVirtualChannels(now);