diff --git a/IodineGBA/core/Emulator.js b/IodineGBA/core/Emulator.js index 23f8c4d..8fc47e4 100644 --- a/IodineGBA/core/Emulator.js +++ b/IodineGBA/core/Emulator.js @@ -376,7 +376,7 @@ GameBoyAdvanceEmulator.prototype.audioUnderrunAdjustment = function () { if (this.dynamicSpeedRefresh && this.settings.dynamicSpeed) { if (((this.audioBufferDynamicContainAmount | 0) - (remainingAmount | 0)) > 0) { var speed = +this.getSpeed(); - speed = Math.max((+speed) - 0.1, 0.1); + speed = Math.max((+speed) - 0.1, 0.003); this.processNewSpeed(+speed); } } @@ -386,7 +386,7 @@ GameBoyAdvanceEmulator.prototype.audioUnderrunAdjustment = function () { if (this.dynamicSpeedRefresh && this.settings.dynamicSpeed) { var speed = +this.getSpeed(); if ((+speed) < 1) { - speed = +Math.min((+speed) + 0.05, 1); + speed = +Math.min((+speed) + 0.01, 1); this.processNewSpeed(+speed); } } diff --git a/user_scripts/IodineGBAAudioGlueCode.js b/user_scripts/IodineGBAAudioGlueCode.js index db7089c..d851d62 100644 --- a/user_scripts/IodineGBAAudioGlueCode.js +++ b/user_scripts/IodineGBAAudioGlueCode.js @@ -162,9 +162,9 @@ function AudioBufferWrapper(channelCount, AudioBufferWrapper.prototype.initialize = function () { this.inBufferSize = this.bufferAmount * this.mixerChannelCount; this.inBuffer = getFloat32Array(this.inBufferSize); - this.outBufferSize = (Math.ceil(this.inBufferSize * this.mixerSampleRate / this.sampleRate / this.mixerChannelCount) * this.mixerChannelCount) + this.mixerChannelCount; + this.resampler = new Resampler(this.sampleRate, this.mixerSampleRate, this.mixerChannelCount, this.inBuffer); + this.outBufferSize = this.resampler.outputBuffer.length; this.outBuffer = getFloat32Array(this.outBufferSize); - this.resampler = new Resampler(this.sampleRate, this.mixerSampleRate, this.mixerChannelCount, this.outBufferSize, true); this.inputOffset = 0; this.resampleBufferStart = 0; this.resampleBufferEnd = 0; @@ -226,7 +226,7 @@ AudioBufferWrapper.prototype.shift = function () { AudioBufferWrapper.prototype.resampleRefill = function () { if (this.inputOffset > 0) { //Resample a chunk of audio: - var resampleLength = this.resampler.resampler(this.inBuffer, this.inputOffset); + var resampleLength = this.resampler.resampler(this.inputOffset); var resampledResult = this.resampler.outputBuffer; for (var index2 = 0; index2 < resampleLength;) { this.outBuffer[this.resampleBufferEnd++] = resampledResult[index2++]; diff --git a/user_scripts/XAudioJS b/user_scripts/XAudioJS index c3cd0b7..12116b1 160000 --- a/user_scripts/XAudioJS +++ b/user_scripts/XAudioJS @@ -1 +1 @@ -Subproject commit c3cd0b776aa4dc2510076806214027eac15eef36 +Subproject commit 12116b160d67d736c75388a7780d05311c77774a