|
228 | 228 | };
|
229 | 229 |
|
230 | 230 | /**
|
231 |
| - * Get/set the 3D spatial position of the audio source for this sound or |
232 |
| - * all in the group. The most common usage is to set the 'x' position for |
233 |
| - * left/right panning. Setting any value higher than 1.0 will begin to |
234 |
| - * decrease the volume of the sound as it moves further away. |
235 |
| - * @param {Number} x The x-position of the audio from -1000.0 to 1000.0. |
236 |
| - * @param {Number} y The y-position of the audio from -1000.0 to 1000.0. |
237 |
| - * @param {Number} z The z-position of the audio from -1000.0 to 1000.0. |
| 231 | + * Get/set the 3D spatial position of the audio source for this sound or group relative to the global listener. |
| 232 | + * @param {Number} x The x-position of the audio source. |
| 233 | + * @param {Number} y The y-position of the audio source. |
| 234 | + * @param {Number} z The z-position of the audio source. |
238 | 235 | * @param {Number} id (optional) The sound ID. If none is passed, all in group will be updated.
|
239 | 236 | * @return {Howl/Array} Returns self or the current 3D spatial position: [x, y, z].
|
240 | 237 | */
|
|
388 | 385 | * pannerAttr(o, id) -> Set's the values of passed sound id.
|
389 | 386 | *
|
390 | 387 | * Attributes:
|
391 |
| - * coneInnerAngle - (360 by default) There will be no volume reduction inside this angle. |
392 |
| - * coneOuterAngle - (360 by default) The volume will be reduced to a constant value of |
393 |
| - * `coneOuterGain` outside this angle. |
394 |
| - * coneOuterGain - (0 by default) The amount of volume reduction outside of `coneOuterAngle`. |
395 |
| - * distanceModel - ('inverse' by default) Determines algorithm to use to reduce volume as audio moves |
396 |
| - * away from listener. Can be `linear`, `inverse` or `exponential`. |
397 |
| - * maxDistance - (10000 by default) Volume won't reduce between source/listener beyond this distance. |
| 388 | + * coneInnerAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees, |
| 389 | + * inside of which there will be no volume reduction. |
| 390 | + * coneOuterAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees, |
| 391 | + * outside of which the volume will be reduced to a constant value of `coneOuterGain`. |
| 392 | + * coneOuterGain - (0 by default) A parameter for directional audio sources, this is the gain outside of the |
| 393 | + * `coneOuterAngle`. It is a linear value in the range `[0, 1]`. |
| 394 | + * distanceModel - ('inverse' by default) Determines algorithm used to reduce volume as audio moves away from |
| 395 | + * listener. Can be `linear`, `inverse` or `exponential. |
| 396 | + * maxDistance - (10000 by default) The maximum distance between source and listener, after which the volume |
| 397 | + * will not be reduced any further. |
| 398 | + * refDistance - (1 by default) A reference distance for reducing volume as source moves further from the listener. |
| 399 | + * This is simply a variable of the distance model and has a different effect depending on which model |
| 400 | + * is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance. |
| 401 | + * rolloffFactor - (1 by default) How quickly the volume reduces as source moves from listener. This is simply a |
| 402 | + * variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]` |
| 403 | + * with `inverse` and `exponential`. |
398 | 404 | * panningModel - ('HRTF' by default) Determines which spatialization algorithm is used to position audio.
|
399 | 405 | * Can be `HRTF` or `equalpower`.
|
400 |
| - * refDistance - (1 by default) A reference distance for reducing volume as the source |
401 |
| - * moves away from the listener. |
402 |
| - * rolloffFactor - (1 by default) How quickly the volume reduces as source moves from listener. |
403 | 406 | *
|
404 | 407 | * @return {Howl/Object} Returns self or current panner attributes.
|
405 | 408 | */
|
|
429 | 432 | coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : self._coneOuterGain,
|
430 | 433 | distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : self._distanceModel,
|
431 | 434 | maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : self._maxDistance,
|
432 |
| - panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : self._panningModel, |
433 | 435 | refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : self._refDistance,
|
434 | 436 | rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : self._rolloffFactor
|
| 437 | + panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : self._panningModel, |
435 | 438 | };
|
436 | 439 | }
|
437 | 440 | } else {
|
|
458 | 461 | coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : pa.coneOuterGain,
|
459 | 462 | distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : pa.distanceModel,
|
460 | 463 | maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : pa.maxDistance,
|
461 |
| - panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel, |
462 | 464 | refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : pa.refDistance,
|
463 | 465 | rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : pa.rolloffFactor
|
| 466 | + panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel, |
464 | 467 | };
|
465 | 468 |
|
466 | 469 | // Update the panner values or create a new panner if none exists.
|
|
471 | 474 | panner.coneOuterGain = pa.coneOuterGain;
|
472 | 475 | panner.distanceModel = pa.distanceModel;
|
473 | 476 | panner.maxDistance = pa.maxDistance;
|
474 |
| - panner.panningModel = pa.panningModel; |
475 | 477 | panner.refDistance = pa.refDistance;
|
476 | 478 | panner.rolloffFactor = pa.rolloffFactor;
|
| 479 | + panner.panningModel = pa.panningModel; |
477 | 480 | } else {
|
478 | 481 | // Make sure we have a position to setup the node with.
|
479 | 482 | if (!sound._pos) {
|
|
559 | 562 | sound._panner.coneOuterGain = sound._pannerAttr.coneOuterGain;
|
560 | 563 | sound._panner.distanceModel = sound._pannerAttr.distanceModel;
|
561 | 564 | sound._panner.maxDistance = sound._pannerAttr.maxDistance;
|
562 |
| - sound._panner.panningModel = sound._pannerAttr.panningModel; |
563 | 565 | sound._panner.refDistance = sound._pannerAttr.refDistance;
|
564 | 566 | sound._panner.rolloffFactor = sound._pannerAttr.rolloffFactor;
|
| 567 | + sound._panner.panningModel = sound._pannerAttr.panningModel; |
565 | 568 | sound._panner.setPosition(sound._pos[0], sound._pos[1], sound._pos[2]);
|
566 | 569 | sound._panner.setOrientation(sound._orientation[0], sound._orientation[1], sound._orientation[2]);
|
567 | 570 | } else {
|
|
0 commit comments