Open GoogleCodeExporter opened 9 years ago
here is a fix that gives a more useable value
Replace this code in WavSoundChannel.as (buffer function)
if (!finished) {
for (var i:int = 0; i < sampleBufferLength; i++) {
if (!finished) {
// write (transformed) samples to buffer
var sampleLeft:Number = samplesLeft[phase] * volumeLeft;
sampleBufferLeft[i] += sampleLeft;
leftPeakRecord = Math.max(Math.abs(sampleLeft), leftPeakRecord);
var channelValue:Number = ((needRightChannel && hasRightChannel) ? samplesRight[phase] : samplesLeft[phase]);
var sampleRight:Number = channelValue * volumeRight;
sampleBufferRight[i] += sampleRight;
rightPeakRecord = Math.max(Math.abs(sampleRight), rightPeakRecord);
// check playing and looping state
if (++phase >= samplesLength) {
phase = startPhase;
finished = loopsLeft-- == 0;
}
}
}
if (finished) {
dispatchEvent(new Event(Event.SOUND_COMPLETE));
}
}
_leftPeak = leftPeakRecord;
_rightPeak = rightPeakRecord;
Original comment by marc...@gmail.com
on 5 Jun 2014 at 11:46
Original issue reported on code.google.com by
jordanth...@gmail.com
on 25 May 2012 at 5:05Attachments: