Fix audio on iOS

gh-pages
riperiperi 2019-06-11 00:11:11 +01:00
parent bbb61394f4
commit a773b60b95
1 changed files with 15 additions and 9 deletions

View File

@ -36,15 +36,21 @@ window.nitroAudio = new (function() {
function updateListener(pos, view) { function updateListener(pos, view) {
var listener = ctx.listener; var listener = ctx.listener;
listener.positionX.value = pos[0]; if (listener.positionX == null) {
listener.positionY.value = pos[1]; //use old setters. safari ios
listener.positionZ.value = pos[2]; listener.setPosition(pos[0], pos[1], pos[2]);
listener.forwardX.value = view[8]; listener.setOrientation(view[8], -view[9], -view[10], view[4], view[5], view[6]);
listener.forwardY.value = -view[9]; } else {
listener.forwardZ.value = -view[10]; listener.positionX.value = pos[0];
listener.upX.value = view[4]; listener.positionY.value = pos[1];
listener.upY.value = view[5]; listener.positionZ.value = pos[2];
listener.upZ.value = view[6]; listener.forwardX.value = view[8];
listener.forwardY.value = -view[9];
listener.forwardZ.value = -view[10];
listener.upX.value = view[4];
listener.upY.value = view[5];
listener.upZ.value = view[6];
}
} }
function tick() { function tick() {