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,6 +36,11 @@ window.nitroAudio = new (function() {
function updateListener(pos, view) { function updateListener(pos, view) {
var listener = ctx.listener; var listener = ctx.listener;
if (listener.positionX == null) {
//use old setters. safari ios
listener.setPosition(pos[0], pos[1], pos[2]);
listener.setOrientation(view[8], -view[9], -view[10], view[4], view[5], view[6]);
} else {
listener.positionX.value = pos[0]; listener.positionX.value = pos[0];
listener.positionY.value = pos[1]; listener.positionY.value = pos[1];
listener.positionZ.value = pos[2]; listener.positionZ.value = pos[2];
@ -46,6 +51,7 @@ window.nitroAudio = new (function() {
listener.upY.value = view[5]; listener.upY.value = view[5];
listener.upZ.value = view[6]; listener.upZ.value = view[6];
} }
}
function tick() { function tick() {
for (var i=0; i<t.sounds.length; i++) { for (var i=0; i<t.sounds.length; i++) {