aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-11 23:21:41 -0500
committerNebuleon Fumika2013-01-11 23:21:41 -0500
commit575e93abdcf6ca037f72943dca22d04861215e42 (patch)
tree0eef8db62f89853928179076094cfe6ac3707915 /source
parente0259e54c2413c9fd24713e4abde4a49c1f329dc (diff)
downloadsnes9x2005-575e93abdcf6ca037f72943dca22d04861215e42.tar.gz
snes9x2005-575e93abdcf6ca037f72943dca22d04861215e42.tar.bz2
snes9x2005-575e93abdcf6ca037f72943dca22d04861215e42.zip
Reduce memory access in noise generation.
Diffstat (limited to 'source')
-rw-r--r--source/soundux.cpp10
-rw-r--r--source/soundux.h3
2 files changed, 8 insertions, 5 deletions
diff --git a/source/soundux.cpp b/source/soundux.cpp
index ae5bbad..329f3bd 100644
--- a/source/soundux.cpp
+++ b/source/soundux.cpp
@@ -142,6 +142,8 @@ extern int Loop [16];
extern long FilterValues[4][2];
extern int NoiseFreq [32];
+static int noise_gen;
+
#undef ABS
#define ABS(a) ((a) < 0 ? -(a) : (a))
@@ -1134,9 +1136,9 @@ void MixStereo (int sample_count)
else
{
for (;VL > 0; VL--)
- if ((so.noise_gen <<= 1) & 0x80000000L)
- so.noise_gen ^= 0x0040001L;
- ch->sample = (so.noise_gen << 17) >> 17;
+ if ((noise_gen <<= 1) & 0x80000000L)
+ noise_gen ^= 0x0040001L;
+ ch->sample = (noise_gen << 17) >> 17;
ch->interpolate = 0;
}
@@ -1833,7 +1835,7 @@ void S9xResetSound (bool8 full)
FilterTaps [6] = 0;
FilterTaps [7] = 0;
so.mute_sound = TRUE;
- so.noise_gen = 1;
+ noise_gen = 1;
so.sound_switch = 255;
so.samples_mixed_so_far = 0;
so.play_position = 0;
diff --git a/source/soundux.h b/source/soundux.h
index a1417bd..b67dc2a 100644
--- a/source/soundux.h
+++ b/source/soundux.h
@@ -122,7 +122,8 @@ typedef struct {
int sound_switch;
int playback_rate;
int buffer_size;
- int noise_gen;
+ // int noise_gen;
+ // Moved to soundux.cpp's noise_gen; this doesn't need volatility! [Neb]
bool8 mute_sound;
#ifndef FOREVER_STEREO
int stereo;