mirror of
https://github.com/DPS2004/gba.git
synced 2025-01-22 20:40:32 -03:00
Update XAudioServer.js
This commit is contained in:
parent
6c15b6a834
commit
b6c6d29c84
1 changed files with 19 additions and 9 deletions
|
@ -174,15 +174,25 @@ XAudioServer.prototype.initializeWebAudio = function () {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var parentObj = this;
|
var parentObj = this;
|
||||||
var lazyEnableWA = function () {
|
var XAudioJSWebAudioDelayedEvent = 0;
|
||||||
|
this.userEventLatch.addEventListener("click", function () {
|
||||||
|
if (XAudioJSWebAudioDelayedEvent == 0) {
|
||||||
parentObj.setupWebAudio();
|
parentObj.setupWebAudio();
|
||||||
|
XAudioJSWebAudioDelayedEvent |= 1;
|
||||||
}
|
}
|
||||||
try {
|
}, false);
|
||||||
this.userEventLatch.addEventListener("click", lazyEnableWA, false);
|
this.userEventLatch.addEventListener("touchstart", function () {
|
||||||
this.userEventLatch.addEventListener("touchstart", lazyEnableWA, false);
|
if (XAudioJSWebAudioDelayedEvent < 2) {
|
||||||
this.userEventLatch.addEventListener("touchend", lazyEnableWA, false);
|
parentObj.setupWebAudio();
|
||||||
|
XAudioJSWebAudioDelayedEvent |= 2;
|
||||||
}
|
}
|
||||||
catch (e) {}
|
}, false);
|
||||||
|
this.userEventLatch.addEventListener("touchend", function () {
|
||||||
|
if (XAudioJSWebAudioDelayedEvent < 4) {
|
||||||
|
parentObj.setupWebAudio();
|
||||||
|
XAudioJSWebAudioDelayedEvent |= 4;
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
//TODO: Restructure API to not have to potentially lie to end client about
|
//TODO: Restructure API to not have to potentially lie to end client about
|
||||||
//the samples in buffer before user driven event callback that actually starts WA.
|
//the samples in buffer before user driven event callback that actually starts WA.
|
||||||
this.resetCallbackAPIAudioBuffer(44100);
|
this.resetCallbackAPIAudioBuffer(44100);
|
||||||
|
|
Loading…
Add table
Reference in a new issue