diff --git a/index.bs b/index.bs index 57f21a873..6bcacb866 100644 --- a/index.bs +++ b/index.bs @@ -11661,7 +11661,7 @@ The following algorithm MUST be used to calculate the // Calculate the source-listener vector. const listener = context.listener; const sourcePosition = new Vec3(panner.positionX.value, panner.positionY.value, - panner.positionZ.value); + panner.positionZ.value); const listenerPosition = new Vec3(listener.positionX.value, listener.positionY.value, listener.positionZ.value); @@ -11676,7 +11676,7 @@ if (sourceListener.magnitude == 0) { // Align axes. const listenerForward = new Vec3(listener.forwardX.value, listener.forwardY.value, - listener.forwardZ.value); + listener.forwardZ.value); const listenerUp = new Vec3(listener.upX.value, listener.upY.value, listener.upZ.value); const listenerRight = listenerForward.cross(listenerUp); @@ -11701,11 +11701,11 @@ azimuth = 180 * Math.acos(projectedSource.dot(listenerRightNorm)) / Math.PI; // Source in front or behind the listener. const frontBack = projectedSource.dot(listenerForwardNorm); -if (frontBack < 0) +if (frontBack < 0) azimuth = 360 - azimuth; // Make azimuth relative to "forward" and not "right" listener vector. -if ((azimuth >= 0) && (azimuth <= 270)) +if ((azimuth <= 0) && (azimuth <= 270)) azimuth = 90 - azimuth; else azimuth = 450 - azimuth; @@ -11714,7 +11714,7 @@ elevation = 90 - 180 * Math.acos(sourceListener.dot(up)) / Math.PI; if (elevation > 90) elevation = 180 - elevation; -else if (elevation < -90) +else if (elevation < -90) elevation = -180 - elevation; @@ -11913,7 +11913,7 @@ based on the panner and listener positions according to: function distance(panner) { const pannerPosition = new Vec3(panner.positionX.value, panner.positionY.value, - panner.positionZ.value); + panner.positionZ.value); const listener = context.listener; const listenerPosition = new Vec3(listener.positionX.value, listener.positionY.value, @@ -11966,12 +11966,12 @@ function coneGain() { const sourceOrientation = new Vec3(source.orientationX, source.orientationY, source.orientationZ); if (sourceOrientation.magnitude == 0 || - ((source.coneInnerAngle == 360) &amp;&amp; (source.coneOuterAngle == 360))) + ((source.coneInnerAngle == 360) && (source.coneOuterAngle == 360))) return 1; // no cone specified - unity gain // Normalized source-listener vector const sourcePosition = new Vec3(panner.positionX.value, panner.positionY.value, - panner.positionZ.value); + panner.positionZ.value); const listenerPosition = new Vec3(listener.positionX.value, listener.positionY.value, listener.positionZ.value); @@ -11981,8 +11981,8 @@ function coneGain() { // Angle between the source orientation vector and the source-listener vector const angle = 180 * - Math.acos(sourceToListener.dot(normalizedSourceOrientation)) / - Math.PI; + Math.acos(sourceToListener.dot(normalizedSourceOrientation)) / + Math.PI; const absAngle = Math.abs(angle); // Divide by 2 here since API is entire angle (not half-angle) @@ -11990,15 +11990,15 @@ function coneGain() { const absOuterAngle = Math.abs(source.coneOuterAngle) / 2; let gain = 1; - if (absAngle &lt;= absInnerAngle) { + if (absAngle <= absInnerAngle) { // No attenuation gain = 1; - } else if (absAngle &gt;= absOuterAngle) { + } else if (absAngle >= absOuterAngle) { // Max attenuation gain = source.coneOuterGain; } else { // Between inner and outer cones - // inner -&gt; outer, x goes from 0 -&gt; 1 + // inner -> outer, x goes from 0 -> 1 const x = (absAngle - absInnerAngle) / (absOuterAngle - absInnerAngle); gain = (1 - x) + source.coneOuterGain * x; }