examples/resources/js/vs-pannernode.js
function updatePositions(elements) {
  if (!audioReady)
    return;

  for (let i = 0; i < elements.length; i++) {
    let x = (elements[i].x - 0.5) * dimensions.width / 2;
    let y = 0;
    let z = (elements[i].y - 0.5) * dimensions.depth / 2;
    if (i == 0) {
      pannerNode.setPosition(x, y, z);
      foaSource.setPosition(x, y, z);
      toaSource.setPosition(x, y, z);
    } else {
      audioContext.listener.setPosition(x, y, z);
      foaScene.setListenerPosition(x, y, z);
      toaScene.setListenerPosition(x, y, z);
    }
  }
}
function updatePositions(elements) {
  if (!audioReady)
    return;

  for (let i = 0; i < elements.length; i++) {
    let x = (elements[i].x - 0.5) * dimensions.width / 2;
    let y = 0;
    let z = (elements[i].y - 0.5) * dimensions.depth / 2;
    if (i == 0) {
      pannerNode.setPosition(x, y, z);
      foaSource.setPosition(x, y, z);
      toaSource.setPosition(x, y, z);
    } else {
      audioContext.listener.setPosition(x, y, z);
      foaScene.setListenerPosition(x, y, z);
      toaScene.setListenerPosition(x, y, z);
    }
  }
}
function updatePositions ( elements ) { if ( ! audioReady ) return ; for ( let i = 0 ; i < elements . length ; i ++ ) { let x = ( elements [ i ] . x - 0.5 ) * dimensions . width / 2 ; let y = 0 ; let z = ( elements [ i ] . y - 0.5 ) * dimensions . depth / 2 ; if ( i == 0 ) { pannerNode . setPosition ( x , y , z ) ; foaSource . setPosition ( x , y , z ) ; toaSource . setPosition ( x , y , z ) ; } else { audioContext . listener . setPosition ( x , y , z ) ; foaScene . setListenerPosition ( x , y , z ) ; toaScene . setListenerPosition ( x , y , z ) ; } } }
Update the audio sound objects' positions.
@param {Object} elements
@private
Update the audio sound objects positions .