@@ -111,7 +111,8 @@ var WebAudioSoundManager = new Class({
111
111
var context = this . context ;
112
112
113
113
// setTimeout to avoid weird audio artifacts (thanks Apple)
114
- window . setTimeout ( function ( ) {
114
+ window . setTimeout ( function ( )
115
+ {
115
116
116
117
if ( context )
117
118
{
@@ -429,11 +430,12 @@ var WebAudioSoundManager = new Class({
429
430
{
430
431
var listener = this . context . listener ;
431
432
433
+ var x = GetFastValue ( this . listenerPosition , 'x' , null ) ;
434
+ var y = GetFastValue ( this . listenerPosition , 'y' , null ) ;
435
+
436
+
432
437
if ( listener && listener . positionX !== undefined )
433
438
{
434
- var x = GetFastValue ( this . listenerPosition , 'x' , null ) ;
435
- var y = GetFastValue ( this . listenerPosition , 'y' , null ) ;
436
-
437
439
if ( x && x !== this . _spatialx )
438
440
{
439
441
this . _spatialx = listener . positionX . value = x ;
@@ -444,6 +446,24 @@ var WebAudioSoundManager = new Class({
444
446
}
445
447
}
446
448
449
+ // Firefox doesn't currently implement positionX, positionY and positionZ properties on AudioListener,
450
+ // falling back on AudioListener.prototype.setPosition() method. @see https://developer.mozilla.org/en-US/docs/Web/API/AudioListener/setPosition
451
+ else if ( listener )
452
+ {
453
+ if ( x && x !== this . _spatialx )
454
+ {
455
+ this . _spatialx = x ;
456
+ }
457
+ if ( y && y !== this . _spatialy )
458
+ {
459
+ this . _spatialy = y ;
460
+ }
461
+
462
+ var z = GetFastValue ( listener , 'z' , 0 ) ;
463
+
464
+ listener . setPosition ( this . _spatialx || 0 , this . _spatialy || 0 , z ) ;
465
+ }
466
+
447
467
BaseSoundManager . prototype . update . call ( this , time , delta ) ;
448
468
449
469
// Resume interrupted audio on iOS only if the game has focus
0 commit comments