Pārlūkot izejas kodu

make sure not to desync channelID when loading sound data

ncannasse 10 gadi atpakaļ
vecāks
revīzija
7050799f74
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      hxd/snd/Worker.hx

+ 4 - 0
hxd/snd/Worker.hx

@@ -102,9 +102,13 @@ class Worker extends hxd.Worker<Message> {
 		switch( msg ) {
 		case Play(path, loop, volume, time):
 			var res = hxd.Res.loader.load(path).toSound();
+			var cid = channelID++;
 			var snd = res.getData();
 			snd.load(function() {
+				var old = channelID;
+				channelID = cid;
 				var c = allocChannel(null, loop, volume, time);
+				channelID = old;
 				if( c == null )
 					return;
 				c.res = res;