Update XAudioServer.js

This commit is contained in:
jsemu 2019-04-27 03:07:44 -04:00
parent c7d1b38f0a
commit 07c792dd00

View file

@ -165,8 +165,17 @@ XAudioServer.prototype.initializeMozAudio = function () {
this.initializeResampler(XAudioJSMozAudioSampleRate); this.initializeResampler(XAudioJSMozAudioSampleRate);
} }
XAudioServer.prototype.initializeWebAudio = function () { XAudioServer.prototype.initializeWebAudio = function () {
if (!this.userEventLatch) {
this.setupWebAudio(); this.setupWebAudio();
this.resetCallbackAPIAudioBuffer(XAudioJSWebAudioContextHandle.sampleRate); }
else {
//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);
}
if (typeof AudioContext != "undefined" || typeof XAudioJSWebAudioContextHandle != "undefined") {
throw null;
}
this.audioType = 1; this.audioType = 1;
/* /*
Firefox has a bug in its web audio implementation... Firefox has a bug in its web audio implementation...
@ -237,6 +246,7 @@ XAudioServer.prototype.setupWebAudio = function () {
} }
XAudioJSWebAudioAudioNode.onaudioprocess = XAudioJSWebAudioEvent; //Connect the audio processing event to a handling function so we can manipulate output XAudioJSWebAudioAudioNode.onaudioprocess = XAudioJSWebAudioEvent; //Connect the audio processing event to a handling function so we can manipulate output
XAudioJSWebAudioAudioNode.connect(XAudioJSWebAudioContextHandle.destination); //Send and chain the output of the audio manipulation to the system audio output. XAudioJSWebAudioAudioNode.connect(XAudioJSWebAudioContextHandle.destination); //Send and chain the output of the audio manipulation to the system audio output.
this.resetCallbackAPIAudioBuffer(XAudioJSWebAudioContextHandle.sampleRate);
} }
XAudioServer.prototype.initializeFlashAudio = function () { XAudioServer.prototype.initializeFlashAudio = function () {
var existingFlashload = document.getElementById("XAudioJS"); var existingFlashload = document.getElementById("XAudioJS");