summaryrefslogtreecommitdiff
path: root/src/code/audio_effects.c
diff options
context:
space:
mode:
authorRoman971 <32455037+Roman971@users.noreply.github.com>2021-11-24 03:07:48 +0100
committerGitHub <noreply@github.com>2021-11-23 21:07:48 -0500
commit0f58b15b2788a1fe5c299000c69ab8d3d71fc4c9 (patch)
treeac1b1b830614cfd6c74d49a75608e498b1bc5bfd /src/code/audio_effects.c
parent8d4828a3bee11e7de27cd3dfe96c5c9970a78edd (diff)
Minor data/ cleanups (#1025)
* Moved code_800D2E30's data to C * Moved some audio data from asm to C * Made separate data files for unknown pointer arrays * Fixed a few missing balign directives
Diffstat (limited to 'src/code/audio_effects.c')
-rw-r--r--src/code/audio_effects.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/code/audio_effects.c b/src/code/audio_effects.c
index 04aa5e006..b87186719 100644
--- a/src/code/audio_effects.c
+++ b/src/code/audio_effects.c
@@ -105,13 +105,13 @@ s16 Audio_GetVibratoPitchChange(VibratoState* vib) {
}
f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
+ static f32 D_80130510 = 0.0f;
+ static s32 D_80130514 = 0;
f32 pitchChange;
f32 extent;
f32 invExtent;
f32 result;
f32 temp;
- f32 twoToThe16th = 65536.0f;
- s32 one = 1;
SequenceChannel* channel = vib->channel;
if (vib->delay != 0) {
@@ -160,13 +160,11 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
extent = temp + 1.0f;
invExtent = 1.0f / extent;
- // fakematch: 2^16 and 1 need to be set at the very top of this function,
- // or else the addresses of D_80130510 and D_80130514 get computed once
- // instead of twice. 'temp' is also a fakematch sign; removing it causes
- // regalloc differences and reorderings at the top of the function.
- result = 1.0f / ((extent - invExtent) * pitchChange / twoToThe16th + invExtent);
+ result = 1.0f / ((extent - invExtent) * pitchChange / 65536.0f + invExtent);
+
D_80130510 += result;
- D_80130514 += one;
+ D_80130514++;
+
return result;
}