Fix initial HTML5 AudioSource gain/position

This commit is contained in:
Joshua Granick
2016-10-31 09:02:41 -07:00
parent 31b9b87b53
commit 7fe79ca748

View File

@@ -11,6 +11,7 @@ class HTML5AudioSource {
private var completed:Bool; private var completed:Bool;
private var gain:Float;
private var id:Int; private var id:Int;
private var length:Int; private var length:Int;
private var loops:Int; private var loops:Int;
@@ -23,6 +24,7 @@ class HTML5AudioSource {
this.parent = parent; this.parent = parent;
gain = 1;
position = new Vector4 (); position = new Vector4 ();
} }
@@ -58,6 +60,10 @@ class HTML5AudioSource {
completed = false; completed = false;
id = parent.buffer.__srcHowl.play (); id = parent.buffer.__srcHowl.play ();
setGain (parent.gain);
setPosition (parent.position);
parent.buffer.__srcHowl.on ("end", howl_onEnd, id); parent.buffer.__srcHowl.on ("end", howl_onEnd, id);
setCurrentTime (time); setCurrentTime (time);
@@ -180,17 +186,7 @@ class HTML5AudioSource {
public function getGain ():Float { public function getGain ():Float {
#if howlerjs return gain;
if (parent.buffer != null) {
return parent.buffer.__srcHowl.volume (id);
}
#end
return 0;
} }
@@ -207,7 +203,7 @@ class HTML5AudioSource {
#end #end
return value; return gain = value;
} }