Skip to content

Commit

Permalink
Fix pannerAttr() not saving values on first call
Browse files Browse the repository at this point in the history
Fixes #1497
  • Loading branch information
goldfire committed Dec 19, 2021
1 parent dab32ba commit f128f9d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/plugins/howler.spatial.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,26 +514,28 @@
panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel
};

// Update the panner values or create a new panner if none exists.
// Create a new panner node if one doesn't already exist.
var panner = sound._panner;
if (panner) {
panner.coneInnerAngle = pa.coneInnerAngle;
panner.coneOuterAngle = pa.coneOuterAngle;
panner.coneOuterGain = pa.coneOuterGain;
panner.distanceModel = pa.distanceModel;
panner.maxDistance = pa.maxDistance;
panner.refDistance = pa.refDistance;
panner.rolloffFactor = pa.rolloffFactor;
panner.panningModel = pa.panningModel;
} else {
if (!panner) {
// Make sure we have a position to setup the node with.
if (!sound._pos) {
sound._pos = self._pos || [0, 0, -0.5];
}

// Create a new panner node.
setupPanner(sound, 'spatial');
panner = sound._panner
}

// Update the panner values or create a new panner if none exists.
panner.coneInnerAngle = pa.coneInnerAngle;
panner.coneOuterAngle = pa.coneOuterAngle;
panner.coneOuterGain = pa.coneOuterGain;
panner.distanceModel = pa.distanceModel;
panner.maxDistance = pa.maxDistance;
panner.refDistance = pa.refDistance;
panner.rolloffFactor = pa.rolloffFactor;
panner.panningModel = pa.panningModel;
}
}

Expand Down

0 comments on commit f128f9d

Please sign in to comment.