Skip to content

Commit

Permalink
spu: fixed Exponential decrease ADSR computation
Browse files Browse the repository at this point in the history
  • Loading branch information
JaCzekanski committed Mar 23, 2020
1 parent c17fb01 commit 8e03583
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/device/spu/voice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ void Voice::processEnvelope() {
cycles *= 4;
}
if (e.direction == Dir::Decrease) {
step = step * adsrVolume._reg / 0x8000;
// Note: Division by 0x8000 might cause value to become 0,
// using right shift by 15 ensures that minimum it can go is -1.
// Games affected: Doom (when paused music does not fade out)
// Little Princess - Marl Oukoku no Ningyou-hime 2 (voices stop playing after a while)
step = (step * adsrVolume._reg) >> 15;
}
}

Expand Down

0 comments on commit 8e03583

Please sign in to comment.