AUDIO: Fix Compiler Shadowing Warnings.

This commit is contained in:
D G Turner 2018-07-30 09:27:31 +01:00
parent ed384a0deb
commit 941fe1dd7e

View File

@ -1095,31 +1095,31 @@ void ModXmS3mStream::updateRow() {
}
}
int ModXmS3mStream::envelopeNextTick(Envelope &envelope, int tick, int keyOn) {
tick++;
if (envelope.looped && tick >= envelope.loopEndTick) {
tick = envelope.loopStartTick;
int ModXmS3mStream::envelopeNextTick(Envelope &envelope, int currentTick, int keyOn) {
int nextTick = currentTick + 1;
if (envelope.looped && nextTick >= envelope.loopEndTick) {
nextTick = envelope.loopStartTick;
}
if (envelope.sustain && keyOn && tick >= envelope.sustainTick) {
tick = envelope.sustainTick;
if (envelope.sustain && keyOn && nextTick >= envelope.sustainTick) {
nextTick = envelope.sustainTick;
}
return tick;
return nextTick;
}
int ModXmS3mStream::calculateAmpl(Envelope &envelope, int tick) {
int ModXmS3mStream::calculateAmpl(Envelope &envelope, int currentTick) {
int idx, point, dt, da;
int ampl = envelope.pointsAmpl[envelope.numPoints - 1];
if (tick < envelope.pointsTick[envelope.numPoints - 1]) {
if (currentTick < envelope.pointsTick[envelope.numPoints - 1]) {
point = 0;
for (idx = 1; idx < envelope.numPoints; idx++) {
if (envelope.pointsTick[idx] <= tick) {
if (envelope.pointsTick[idx] <= currentTick) {
point = idx;
}
}
dt = envelope.pointsTick[point + 1] - envelope.pointsTick[point];
da = envelope.pointsAmpl[point + 1] - envelope.pointsAmpl[point];
ampl = envelope.pointsAmpl[point];
ampl += ((da << 24) / dt) * (tick - envelope.pointsTick[point]) >> 24;
ampl += ((da << 24) / dt) * (currentTick - envelope.pointsTick[point]) >> 24;
}
return ampl;
}