|  |  | @@ -1,5 +1,6 @@ | 
		
	
		
			
			|  |  |  | let playing = []; | 
		
	
		
			
			|  |  |  | let looping = {}; | 
		
	
		
			
			|  |  |  | let loopGains = {}; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | let waiting = {}; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
	
		
			
				|  |  | @@ -45,8 +46,8 @@ function playSfx(name) { | 
		
	
		
			
			|  |  |  | src.start(0); | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | function playLoop(name) { | 
		
	
		
			
			|  |  |  | if (audioDict[name] == undefined) { | 
		
	
		
			
			|  |  |  | function playLoop(name, volume=1) { | 
		
	
		
			
			|  |  |  | if (audioDict[name] === undefined) { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | if (waiting[name]) { | 
		
	
		
			
			|  |  |  | waiting[name].push({ | 
		
	
	
		
			
				|  |  | @@ -59,6 +60,8 @@ function playLoop(name) { | 
		
	
		
			
			|  |  |  | console.error(name + " is not loaded yet, dingus"); | 
		
	
		
			
			|  |  |  | return; | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | loopGains[name].gain.value = volume; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | // if already playing, just keep going | 
		
	
		
			
			|  |  |  | if (looping[name] && !looping[name].done) { | 
		
	
	
		
			
				|  |  | @@ -68,7 +71,8 @@ function playLoop(name) { | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | let src = audioContext.createBufferSource(); | 
		
	
		
			
			|  |  |  | src.buffer = audioDict[name]; | 
		
	
		
			
			|  |  |  | src.connect(gainControl); | 
		
	
		
			
			|  |  |  | src.connect(loopGains[name]); | 
		
	
		
			
			|  |  |  | loopGains[name].connect(gainControl); | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | looping[name] = src; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
	
		
			
				|  |  | @@ -132,6 +136,8 @@ function loadAudio(name, flush=false) { | 
		
	
		
			
			|  |  |  | return; | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | loopGains[name] = audioContext.createGain(); | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | waiting[name] = []; | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | // is the audio already stored locally? | 
		
	
	
		
			
				|  |  | 
 |