aboutsummaryrefslogtreecommitdiff
path: root/audio/mods
diff options
context:
space:
mode:
Diffstat (limited to 'audio/mods')
-rw-r--r--audio/mods/mod_xm_s3m.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/audio/mods/mod_xm_s3m.cpp b/audio/mods/mod_xm_s3m.cpp
index 615e587380..264dfdc46c 100644
--- a/audio/mods/mod_xm_s3m.cpp
+++ b/audio/mods/mod_xm_s3m.cpp
@@ -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;
}