Skip to content

Commit f128f9d

Browse files
committed
Fix pannerAttr() not saving values on first call
Fixes goldfire#1497
1 parent dab32ba commit f128f9d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/plugins/howler.spatial.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -514,26 +514,28 @@
514514
panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel
515515
};
516516

517-
// Update the panner values or create a new panner if none exists.
517+
// Create a new panner node if one doesn't already exist.
518518
var panner = sound._panner;
519-
if (panner) {
520-
panner.coneInnerAngle = pa.coneInnerAngle;
521-
panner.coneOuterAngle = pa.coneOuterAngle;
522-
panner.coneOuterGain = pa.coneOuterGain;
523-
panner.distanceModel = pa.distanceModel;
524-
panner.maxDistance = pa.maxDistance;
525-
panner.refDistance = pa.refDistance;
526-
panner.rolloffFactor = pa.rolloffFactor;
527-
panner.panningModel = pa.panningModel;
528-
} else {
519+
if (!panner) {
529520
// Make sure we have a position to setup the node with.
530521
if (!sound._pos) {
531522
sound._pos = self._pos || [0, 0, -0.5];
532523
}
533524

534525
// Create a new panner node.
535526
setupPanner(sound, 'spatial');
527+
panner = sound._panner
536528
}
529+
530+
// Update the panner values or create a new panner if none exists.
531+
panner.coneInnerAngle = pa.coneInnerAngle;
532+
panner.coneOuterAngle = pa.coneOuterAngle;
533+
panner.coneOuterGain = pa.coneOuterGain;
534+
panner.distanceModel = pa.distanceModel;
535+
panner.maxDistance = pa.maxDistance;
536+
panner.refDistance = pa.refDistance;
537+
panner.rolloffFactor = pa.rolloffFactor;
538+
panner.panningModel = pa.panningModel;
537539
}
538540
}
539541

0 commit comments

Comments
 (0)