Support the old Web Audio API for Firefox's sake
This commit is contained in:
parent
6d580af817
commit
45dbeacc4a
39
js/main.js
39
js/main.js
@ -267,15 +267,27 @@ class SFXPlayer {
|
|||||||
// designed to emulate my homegrown formula as closely as possible, since I did a lot of
|
// designed to emulate my homegrown formula as closely as possible, since I did a lot of
|
||||||
// fiddling to come up with that and I like how it came out.
|
// fiddling to come up with that and I like how it came out.
|
||||||
let listener = this.ctx.listener;
|
let listener = this.ctx.listener;
|
||||||
listener.positionX.value = 0;
|
if ('positionX' in listener) {
|
||||||
listener.positionY.value = 0;
|
listener.positionX.value = 0;
|
||||||
listener.positionZ.value = -8;
|
listener.positionY.value = 0;
|
||||||
listener.forwardX.value = 0;
|
listener.positionZ.value = -8;
|
||||||
listener.forwardY.value = 0;
|
}
|
||||||
listener.forwardZ.value = 1;
|
else {
|
||||||
listener.upX.value = 0;
|
// Old way, only one Firefox supports atm ú_ù
|
||||||
listener.upY.value = -1;
|
listener.setPosition(0, 0, -8);
|
||||||
listener.upZ.value = 0;
|
}
|
||||||
|
if ('forwardX' in listener) {
|
||||||
|
listener.forwardX.value = 0;
|
||||||
|
listener.forwardY.value = 0;
|
||||||
|
listener.forwardZ.value = 1;
|
||||||
|
listener.upX.value = 0;
|
||||||
|
listener.upY.value = -1;
|
||||||
|
listener.upZ.value = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Same as above
|
||||||
|
listener.setOrientation(0, 0, 1, 0, -1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
this.player_x = null;
|
this.player_x = null;
|
||||||
this.player_y = null;
|
this.player_y = null;
|
||||||
@ -448,8 +460,13 @@ class SFXPlayer {
|
|||||||
this.player_x = x;
|
this.player_x = x;
|
||||||
this.player_y = y;
|
this.player_y = y;
|
||||||
let listener = this.ctx.listener;
|
let listener = this.ctx.listener;
|
||||||
listener.positionX.value = x;
|
if ('positionX' in listener) {
|
||||||
listener.positionY.value = y;
|
listener.positionX.value = x;
|
||||||
|
listener.positionY.value = y;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
listener.setPosition(x, y, -8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
play_once(name, cell = null) {
|
play_once(name, cell = null) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user