AUDIO: Reduce the static table sizes in the SID emulator

This commit is contained in:
Cameron Cawley 2022-12-22 21:54:50 +00:00 committed by Eugene Sandulenko
parent 4413719019
commit 5870b7d599
3 changed files with 19 additions and 16 deletions

View File

@ -430,7 +430,7 @@ public:
} }
}; };
fc_point Filter::f0_points_6581[] = { const fc_point Filter::f0_points_6581[] = {
// FC f FCHI FCLO // FC f FCHI FCLO
// ---------------------------- // ----------------------------
{ 0, 220 }, // 0x00 - repeated end point { 0, 220 }, // 0x00 - repeated end point
@ -798,7 +798,7 @@ void EnvelopeGenerator::reset() {
hold_zero = true; hold_zero = true;
} }
reg16 EnvelopeGenerator::rate_counter_period[] = { const data16 EnvelopeGenerator::rate_counter_period[] = {
9, // 2ms*1.0MHz/256 = 7.81 9, // 2ms*1.0MHz/256 = 7.81
32, // 8ms*1.0MHz/256 = 31.25 32, // 8ms*1.0MHz/256 = 31.25
63, // 16ms*1.0MHz/256 = 62.50 63, // 16ms*1.0MHz/256 = 62.50
@ -818,7 +818,7 @@ reg16 EnvelopeGenerator::rate_counter_period[] = {
}; };
reg8 EnvelopeGenerator::sustain_level[] = { const data8 EnvelopeGenerator::sustain_level[] = {
0x00, 0x00,
0x11, 0x11,
0x22, 0x22,

View File

@ -49,7 +49,10 @@ typedef unsigned int reg24;
typedef int cycle_count; typedef int cycle_count;
typedef int sound_sample; typedef int sound_sample;
typedef sound_sample fc_point[2];
typedef unsigned char data8;
typedef unsigned short data16;
typedef unsigned short fc_point[2];
class WaveformGenerator { class WaveformGenerator {
@ -116,10 +119,10 @@ protected:
reg12 outputNPST(); reg12 outputNPST();
// Sample data for combinations of waveforms. // Sample data for combinations of waveforms.
static const reg8 wave6581__ST[]; static const data8 wave6581__ST[];
static const reg8 wave6581_P_T[]; static const data8 wave6581_P_T[];
static const reg8 wave6581_PS_[]; static const data8 wave6581_PS_[];
static const reg8 wave6581_PST[]; static const data8 wave6581_PST[];
friend class Voice; friend class Voice;
friend class SID; friend class SID;
@ -186,8 +189,8 @@ protected:
// FC is an 11 bit register. // FC is an 11 bit register.
sound_sample f0_6581[2048]; sound_sample f0_6581[2048];
sound_sample* f0; sound_sample* f0;
static fc_point f0_points_6581[]; static const fc_point f0_points_6581[];
fc_point* f0_points; const fc_point* f0_points;
int f0_count; int f0_count;
friend class SID; friend class SID;
@ -229,10 +232,10 @@ protected:
// Lookup table to convert from attack, decay, or release value to rate // Lookup table to convert from attack, decay, or release value to rate
// counter period. // counter period.
static reg16 rate_counter_period[]; static const data16 rate_counter_period[];
// The 16 selectable sustain levels. // The 16 selectable sustain levels.
static reg8 sustain_level[]; static const data8 sustain_level[];
friend class SID; friend class SID;
}; };

View File

@ -30,7 +30,7 @@
namespace Resid { namespace Resid {
const reg8 WaveformGenerator::wave6581__ST[] = { const data8 WaveformGenerator::wave6581__ST[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 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, /* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -545,7 +545,7 @@ const reg8 WaveformGenerator::wave6581__ST[] = {
/* 0xff8: */ 0x3e, 0x3e, 0x3f, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, /* 0xff8: */ 0x3e, 0x3e, 0x3f, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f,
}; };
const reg8 WaveformGenerator::wave6581_P_T[] = { const data8 WaveformGenerator::wave6581_P_T[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 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, /* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1060,7 +1060,7 @@ const reg8 WaveformGenerator::wave6581_P_T[] = {
/* 0xff8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xff8: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
const reg8 WaveformGenerator::wave6581_PS_[] = { const data8 WaveformGenerator::wave6581_PS_[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 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, /* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -1575,7 +1575,7 @@ const reg8 WaveformGenerator::wave6581_PS_[] = {
/* 0xff8: */ 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, /* 0xff8: */ 0x7e, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
}; };
const reg8 WaveformGenerator::wave6581_PST[] = { const data8 WaveformGenerator::wave6581_PST[] = {
/* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x000: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x008: */ 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, /* 0x010: */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,