aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-12 00:00:29 -0500
committerNebuleon Fumika2013-01-12 00:00:29 -0500
commit8338e199dfbd3b956265dfaf78d2b21b083de895 (patch)
treecd94640be8312b0bb4ade07f588e7bcea264c107
parent575e93abdcf6ca037f72943dca22d04861215e42 (diff)
downloadsnesemu-8338e199dfbd3b956265dfaf78d2b21b083de895.tar.gz
snesemu-8338e199dfbd3b956265dfaf78d2b21b083de895.tar.bz2
snesemu-8338e199dfbd3b956265dfaf78d2b21b083de895.zip
More efficient noise generation taken from blargg's code in Snes9x 1.53.
-rw-r--r--source/soundux.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/soundux.cpp b/source/soundux.cpp
index 329f3bd..d9a3436 100644
--- a/source/soundux.cpp
+++ b/source/soundux.cpp
@@ -1135,9 +1135,10 @@ void MixStereo (int sample_count)
}
else
{
- for (;VL > 0; VL--)
- if ((noise_gen <<= 1) & 0x80000000L)
- noise_gen ^= 0x0040001L;
+ // Snes9x 1.53's SPC_DSP.cpp, by blargg
+ int feedback = (noise_gen << 13) ^ (noise_gen << 14);
+ noise_gen = (feedback & 0x4000) ^ (noise_gen >> 1);
+ VL = 0;
ch->sample = (noise_gen << 17) >> 17;
ch->interpolate = 0;
}