xaudiojs update #5

Merged
merged 2 commits into from Nov 27, 2015
Jump to file or symbol
Failed to load files and symbols.
+5 −5
Diff settings

Always

Just for now

Next

Update

  • Loading branch information...
taisel committed Nov 27, 2015
commit 9a4e706fd5c284d0ecf5ed94c16f254b22fdeb83
@@ -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);
}
}
@@ -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++];