[EMSCRIPTEN] remove chrome workaround in RWebAudio, it didn't actually activate or work well anyway

This commit is contained in:
ToadKing 2013-10-30 21:52:38 -04:00
parent 8a617ffa0b
commit e03114b880

View File

@ -17,19 +17,12 @@ var LibraryRWebAudio = {
setStartTime: function() {
if (RA.context.currentTime) {
RA.startTime = window['performance']['now']() - RA.context.currentTime * 1000;
var time1 = RA.context.currentTime;
_usleep(50);
if (time1 === RA.context.currentTime) {
RA.currentTimeWorkaround = true;
if (RA.startTime === 0) throw 'startTime is 0';
}
Module["resumeMainLoop"]();
} else window['setTimeout'](RA.setStartTime, 0);
},
getCurrentPerfTime: function() {
if (!RA.currentTimeWorkaround) return RA.context.currentTime;
else if (RA.startTime) return (window['performance']['now']() - RA.startTime) / 1000;
if (RA.startTime) return (window['performance']['now']() - RA.startTime) / 1000;
else throw 'getCurrentPerfTime() called before start time set';
},
@ -66,7 +59,7 @@ var LibraryRWebAudio = {
var startTime;
if (RA.bufIndex) startTime = RA.buffers[RA.bufIndex - 1].endTime;
else startTime = RA.context.currentTime;
RA.buffers[index].endTime = startTime + RA.buffers[index].duration;
RA.buffers[index].endTime = RA.getCurrentPerfTime() + RA.buffers[index].duration;
var bufferSource = RA.context.createBufferSource();
bufferSource.buffer = RA.buffers[index];