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 {
|
||||
var parentObj = this;
|
||||
var lazyEnableWA = function () {
|
||||
parentObj.setupWebAudio();
|
||||
}
|
||||
try {
|
||||
this.userEventLatch.addEventListener("click", lazyEnableWA, false);
|
||||
this.userEventLatch.addEventListener("touchstart", lazyEnableWA, false);
|
||||
this.userEventLatch.addEventListener("touchend", lazyEnableWA, false);
|
||||
}
|
||||
catch (e) {}
|
||||
var XAudioJSWebAudioDelayedEvent = 0;
|
||||
this.userEventLatch.addEventListener("click", function () {
|
||||
if (XAudioJSWebAudioDelayedEvent == 0) {
|
||||
parentObj.setupWebAudio();
|
||||
XAudioJSWebAudioDelayedEvent |= 1;
|
||||
}
|
||||
}, false);
|
||||
this.userEventLatch.addEventListener("touchstart", function () {
|
||||
if (XAudioJSWebAudioDelayedEvent < 2) {
|
||||
parentObj.setupWebAudio();
|
||||
XAudioJSWebAudioDelayedEvent |= 2;
|
||||
}
|
||||
}, 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
|
||||
//the samples in buffer before user driven event callback that actually starts WA.
|
||||
this.resetCallbackAPIAudioBuffer(44100);
|
||||
|
|
Loading…
Add table
Reference in a new issue