aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2010-08-03 00:02:46 +0000
committerMax Horn2010-08-03 00:02:46 +0000
commit39846310d79e75faf55482a239ec5ca8eaf34c2b (patch)
tree3a43b6e5d656669613a89d6d77a59e6a1bf24b81 /sound
parenta76f5449bc741d35a76ed9173350b3c18dbb87bd (diff)
downloadscummvm-rg350-39846310d79e75faf55482a239ec5ca8eaf34c2b.tar.gz
scummvm-rg350-39846310d79e75faf55482a239ec5ca8eaf34c2b.tar.bz2
scummvm-rg350-39846310d79e75faf55482a239ec5ca8eaf34c2b.zip
SOUND: Constify waveform table; slightly simplify code
svn-id: r51671
Diffstat (limited to 'sound')
-rw-r--r--sound/softsynth/sid.cpp13
-rw-r--r--sound/softsynth/sid.h13
-rw-r--r--sound/softsynth/wave6581.cpp15
3 files changed, 13 insertions, 28 deletions
diff --git a/sound/softsynth/sid.cpp b/sound/softsynth/sid.cpp
index d600ac28f5..e925f4a447 100644
--- a/sound/softsynth/sid.cpp
+++ b/sound/softsynth/sid.cpp
@@ -46,11 +46,6 @@ const int SID::FIXP_MASK = 0xffff;
WaveformGenerator::WaveformGenerator() {
sync_source = this;
- wave__ST = wave6581__ST;
- wave_P_T = wave6581_P_T;
- wave_PS_ = wave6581_PS_;
- wave_PST = wave6581_PST;
-
reset();
}
@@ -226,19 +221,19 @@ RESID_INLINE reg12 WaveformGenerator::outputN___() {
// Combined waveforms:
RESID_INLINE reg12 WaveformGenerator::output__ST() {
- return wave__ST[output__S_()] << 4;
+ return wave6581__ST[output__S_()] << 4;
}
RESID_INLINE reg12 WaveformGenerator::output_P_T() {
- return (wave_P_T[output___T() >> 1] << 4) & output_P__();
+ return (wave6581_P_T[output___T() >> 1] << 4) & output_P__();
}
RESID_INLINE reg12 WaveformGenerator::output_PS_() {
- return (wave_PS_[output__S_()] << 4) & output_P__();
+ return (wave6581_PS_[output__S_()] << 4) & output_P__();
}
RESID_INLINE reg12 WaveformGenerator::output_PST() {
- return (wave_PST[output__S_()] << 4) & output_P__();
+ return (wave6581_PST[output__S_()] << 4) & output_P__();
}
// Combined waveforms including noise:
diff --git a/sound/softsynth/sid.h b/sound/softsynth/sid.h
index d57ec73bad..c78f538441 100644
--- a/sound/softsynth/sid.h
+++ b/sound/softsynth/sid.h
@@ -118,15 +118,10 @@ protected:
reg12 outputNPST();
// Sample data for combinations of waveforms.
- static reg8 wave6581__ST[];
- static reg8 wave6581_P_T[];
- static reg8 wave6581_PS_[];
- static reg8 wave6581_PST[];
-
- reg8* wave__ST;
- reg8* wave_P_T;
- reg8* wave_PS_;
- reg8* wave_PST;
+ static const reg8 wave6581__ST[];
+ static const reg8 wave6581_P_T[];
+ static const reg8 wave6581_PS_[];
+ static const reg8 wave6581_PST[];
friend class Voice;
friend class SID;
diff --git a/sound/softsynth/wave6581.cpp b/sound/softsynth/wave6581.cpp
index 29998dcd0a..d1ddad1623 100644
--- a/sound/softsynth/wave6581.cpp
+++ b/sound/softsynth/wave6581.cpp
@@ -32,11 +32,9 @@
#include "sid.h"
-namespace Resid
-{
+namespace Resid {
-reg8 WaveformGenerator::wave6581__ST[] =
-{
+const reg8 WaveformGenerator::wave6581__ST[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -551,8 +549,7 @@ reg8 WaveformGenerator::wave6581__ST[] =
/* 0xff8: */ 0x3e, 0x3e, 0x3f, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f,
};
-reg8 WaveformGenerator::wave6581_P_T[] =
-{
+const reg8 WaveformGenerator::wave6581_P_T[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1067,8 +1064,7 @@ reg8 WaveformGenerator::wave6581_P_T[] =
/* 0xff8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
-reg8 WaveformGenerator::wave6581_PS_[] =
-{
+const reg8 WaveformGenerator::wave6581_PS_[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -1583,8 +1579,7 @@ reg8 WaveformGenerator::wave6581_PS_[] =
/* 0xff8: */ 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
};
-reg8 WaveformGenerator::wave6581_PST[] =
-{
+const reg8 WaveformGenerator::wave6581_PST[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,