From 4496925ab3c71b6da8d1963d68564d46aac92979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20B=C3=B6sing?= Date: Sat, 23 Jan 2016 18:16:15 +0100 Subject: [PATCH] Change dynamic filterinterpolation(ram) to const(flash) greatly enhances ram-usage --- reSID/filter.cc | 20 +++---- reSID/filter.h | 20 ++++--- reSID/filter6581.h | 131 +++++++++++++++++++++++++++++++++++++++++++++ reSID/sid.cc | 35 ++++++------ reSID/sid.h | 9 ++-- 5 files changed, 174 insertions(+), 41 deletions(-) create mode 100644 reSID/filter6581.h diff --git a/reSID/filter.cc b/reSID/filter.cc index 7525691..8240b11 100644 --- a/reSID/filter.cc +++ b/reSID/filter.cc @@ -43,7 +43,7 @@ RESID_NAMESPACE_START // // NB! Cutoff frequency characteristics may vary, we have modeled two // particular Commodore 64s. - +/* const fc_point Filter::f0_points_6581[] = { // FC f FCHI FCLO @@ -80,6 +80,7 @@ const fc_point Filter::f0_points_6581[] = { 2047, 18000 }, // 0xff 0x07 { 2047, 18000 } // 0xff 0x07 - repeated end point }; +*/ /* const fc_point Filter::f0_points_8580[] = { @@ -131,12 +132,12 @@ Filter::Filter() Vnf = 0; enable_filter(true); - +/* // Create mappings from FC to cutoff frequency. interpolate(f0_points_6581, f0_points_6581 + sizeof(f0_points_6581)/sizeof(*f0_points_6581) - 1, PointPlotter(f0_6581), 1.0); -/* + interpolate(f0_points_8580, f0_points_8580 + sizeof(f0_points_8580)/sizeof(*f0_points_8580) - 1, PointPlotter(f0_8580), 1.0); @@ -145,10 +146,9 @@ Filter::Filter() {//instead: mixer_DC = -0xfff*0xff/18 >> 7; - f0 = f0_6581; - f0_points = f0_points_6581; - f0_count = sizeof(f0_points_6581)/sizeof(*f0_points_6581); - //Serial.print(f0_count); + //f0 = f0_6581; + // f0_points = f0_points_6581; + // f0_count = sizeof(f0_points_6581)/sizeof(*f0_points_6581); set_w0(); set_Q(); } @@ -301,12 +301,13 @@ void Filter::set_Q() // Return the array of spline interpolation points used to map the FC register // to filter cutoff frequency. // ---------------------------------------------------------------------------- +/* void Filter::fc_default(const fc_point*& points, int& count) { points = f0_points; count = f0_count; } - +*/ // ---------------------------------------------------------------------------- // Given an array of interpolation points p with n points, the following // statement will specify a new FC mapping: @@ -315,9 +316,10 @@ void Filter::fc_default(const fc_point*& points, int& count) // and that additional end points *must* be present since the end points // are not interpolated. // ---------------------------------------------------------------------------- +/* PointPlotter Filter::fc_plotter() { return PointPlotter(f0); } - +*/ RESID_NAMESPACE_STOP diff --git a/reSID/filter.h b/reSID/filter.h index 08684d3..24cc5ce 100644 --- a/reSID/filter.h +++ b/reSID/filter.h @@ -21,7 +21,8 @@ #define __FILTER_H__ #include "siddefs.h" -#include "spline.h" +//#include "spline.h" +#include "filter6581.h" RESID_NAMESPACE_START @@ -147,8 +148,8 @@ public: sound_sample output(); // Spline functions. - void fc_default(const fc_point*& points, int& count); - PointPlotter fc_plotter(); + // void fc_default(const fc_point*& points, int& count); + // PointPlotter fc_plotter(); protected: void set_w0(); @@ -190,13 +191,16 @@ protected: // Cutoff frequency tables. // FC is an 11 bit register. - sound_sample f0_6581[2048]; + //sound_sample f0_6581[2048]; //sound_sample f0_8580[2048]; - sound_sample* f0; - const static fc_point f0_points_6581[]; + //sound_sample* f0; + //const sound_sample* f0 = filter6581; + const short* f0 = filter6581; + //const static fc_point f0_points_6581[]; + //const static fc_point f0_points_8580[]; - const fc_point* f0_points; - int f0_count; + //const fc_point* f0_points; + //int f0_count; friend class SID; }; diff --git a/reSID/filter6581.h b/reSID/filter6581.h new file mode 100644 index 0000000..2f7f796 --- /dev/null +++ b/reSID/filter6581.h @@ -0,0 +1,131 @@ + +const short filter6581[] = { +0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, 0x00DC, +0x00DC, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, 0x00DD, +0x00DD, 0x00DD, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, 0x00DE, +0x00DE, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, 0x00DF, +0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E0, 0x00E1, 0x00E1, 0x00E1, +0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E1, 0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E2, +0x00E2, 0x00E2, 0x00E2, 0x00E2, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E3, 0x00E4, 0x00E4, +0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E4, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, 0x00E5, +0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E6, 0x00E7, 0x00E7, 0x00E7, 0x00E7, 0x00E7, 0x00E7, 0x00E7, +0x00E7, 0x00E7, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E8, 0x00E9, 0x00E9, 0x00E9, 0x00E9, 0x00E9, +0x00E9, 0x00E9, 0x00E9, 0x00E9, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EA, 0x00EB, 0x00EB, 0x00EB, +0x00EB, 0x00EB, 0x00EB, 0x00EB, 0x00EB, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00EC, 0x00ED, 0x00ED, 0x00ED, +0x00ED, 0x00ED, 0x00ED, 0x00ED, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EE, 0x00EF, 0x00EF, 0x00EF, 0x00EF, 0x00EF, +0x00EF, 0x00F0, 0x00F0, 0x00F0, 0x00F0, 0x00F0, 0x00F0, 0x00F1, 0x00F1, 0x00F1, 0x00F1, 0x00F1, 0x00F1, 0x00F2, 0x00F2, 0x00F2, +0x00F2, 0x00F2, 0x00F3, 0x00F3, 0x00F3, 0x00F3, 0x00F3, 0x00F4, 0x00F4, 0x00F4, 0x00F4, 0x00F4, 0x00F5, 0x00F5, 0x00F5, 0x00F5, +0x00F5, 0x00F6, 0x00F6, 0x00F6, 0x00F6, 0x00F7, 0x00F7, 0x00F7, 0x00F7, 0x00F8, 0x00F8, 0x00F8, 0x00F8, 0x00F9, 0x00F9, 0x00F9, +0x00FA, 0x00FA, 0x00FA, 0x00FA, 0x00FB, 0x00FB, 0x00FB, 0x00FB, 0x00FC, 0x00FC, 0x00FC, 0x00FC, 0x00FD, 0x00FD, 0x00FD, 0x00FE, +0x00FE, 0x00FE, 0x00FE, 0x00FF, 0x00FF, 0x00FF, 0x00FF, 0x0100, 0x0100, 0x0100, 0x0101, 0x0101, 0x0101, 0x0101, 0x0102, 0x0102, +0x0102, 0x0103, 0x0103, 0x0103, 0x0103, 0x0104, 0x0104, 0x0104, 0x0105, 0x0105, 0x0105, 0x0105, 0x0106, 0x0106, 0x0106, 0x0107, +0x0107, 0x0107, 0x0108, 0x0108, 0x0108, 0x0109, 0x0109, 0x0109, 0x010A, 0x010A, 0x010A, 0x010B, 0x010B, 0x010B, 0x010C, 0x010C, +0x010C, 0x010D, 0x010D, 0x010D, 0x010E, 0x010E, 0x010E, 0x010F, 0x010F, 0x0110, 0x0110, 0x0110, 0x0111, 0x0111, 0x0111, 0x0112, +0x0112, 0x0113, 0x0113, 0x0114, 0x0114, 0x0114, 0x0115, 0x0115, 0x0116, 0x0116, 0x0117, 0x0117, 0x0117, 0x0118, 0x0118, 0x0119, +0x0119, 0x011A, 0x011A, 0x011B, 0x011B, 0x011C, 0x011C, 0x011D, 0x011D, 0x011E, 0x011E, 0x011F, 0x011F, 0x0120, 0x0121, 0x0121, +0x0122, 0x0122, 0x0123, 0x0123, 0x0124, 0x0125, 0x0125, 0x0126, 0x0126, 0x0127, 0x0128, 0x0128, 0x0129, 0x012A, 0x012A, 0x012B, +0x012C, 0x012C, 0x012D, 0x012D, 0x012E, 0x012F, 0x012F, 0x0130, 0x0131, 0x0131, 0x0132, 0x0132, 0x0133, 0x0134, 0x0134, 0x0135, +0x0136, 0x0136, 0x0137, 0x0137, 0x0138, 0x0138, 0x0139, 0x013A, 0x013A, 0x013B, 0x013B, 0x013C, 0x013D, 0x013D, 0x013E, 0x013E, +0x013F, 0x0140, 0x0140, 0x0141, 0x0141, 0x0142, 0x0143, 0x0143, 0x0144, 0x0144, 0x0145, 0x0146, 0x0146, 0x0147, 0x0148, 0x0148, +0x0149, 0x0149, 0x014A, 0x014B, 0x014B, 0x014C, 0x014D, 0x014E, 0x014E, 0x014F, 0x0150, 0x0150, 0x0151, 0x0152, 0x0153, 0x0153, +0x0154, 0x0155, 0x0156, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, 0x015B, 0x015C, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, +0x0162, 0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, 0x0171, 0x0172, +0x0173, 0x0174, 0x0175, 0x0177, 0x0178, 0x0179, 0x017A, 0x017C, 0x017D, 0x017F, 0x0180, 0x0181, 0x0183, 0x0184, 0x0186, 0x0187, +0x0189, 0x018A, 0x018C, 0x018D, 0x018F, 0x0190, 0x0192, 0x0194, 0x0195, 0x0197, 0x0199, 0x019A, 0x019C, 0x019E, 0x01A0, 0x01A2, +0x01A4, 0x01A5, 0x01A7, 0x01A9, 0x01AB, 0x01AD, 0x01AF, 0x01B1, 0x01B3, 0x01B4, 0x01B6, 0x01B8, 0x01BA, 0x01BC, 0x01BE, 0x01C0, +0x01C2, 0x01C4, 0x01C6, 0x01C8, 0x01CA, 0x01CC, 0x01CE, 0x01D0, 0x01D2, 0x01D4, 0x01D6, 0x01D8, 0x01DA, 0x01DC, 0x01DE, 0x01E0, +0x01E2, 0x01E4, 0x01E6, 0x01E8, 0x01EA, 0x01EC, 0x01EF, 0x01F1, 0x01F3, 0x01F5, 0x01F7, 0x01F9, 0x01FC, 0x01FE, 0x0200, 0x0202, +0x0205, 0x0207, 0x0209, 0x020C, 0x020E, 0x0210, 0x0213, 0x0215, 0x0218, 0x021A, 0x021D, 0x021F, 0x0222, 0x0224, 0x0227, 0x0229, +0x022C, 0x022E, 0x0231, 0x0234, 0x0236, 0x0239, 0x023C, 0x023E, 0x0241, 0x0244, 0x0247, 0x024A, 0x024D, 0x024F, 0x0252, 0x0255, +0x0258, 0x025B, 0x025E, 0x0261, 0x0264, 0x0267, 0x026B, 0x026E, 0x0271, 0x0274, 0x0277, 0x027B, 0x027E, 0x0281, 0x0285, 0x0288, +0x028C, 0x028F, 0x0292, 0x0296, 0x029A, 0x029D, 0x02A1, 0x02A4, 0x02A8, 0x02AC, 0x02B0, 0x02B3, 0x02B7, 0x02BB, 0x02BF, 0x02C3, +0x02C7, 0x02CB, 0x02CF, 0x02D3, 0x02D7, 0x02DB, 0x02DF, 0x02E4, 0x02E8, 0x02EC, 0x02F1, 0x02F5, 0x02F9, 0x02FE, 0x0302, 0x0307, +0x030C, 0x0310, 0x0315, 0x0319, 0x031E, 0x0323, 0x0328, 0x032D, 0x0331, 0x0336, 0x033B, 0x0340, 0x0345, 0x034A, 0x034F, 0x0354, +0x0359, 0x035E, 0x0364, 0x0369, 0x036E, 0x0373, 0x0379, 0x037E, 0x0383, 0x0389, 0x038E, 0x0393, 0x0399, 0x039E, 0x03A4, 0x03AA, +0x03AF, 0x03B5, 0x03BA, 0x03C0, 0x03C6, 0x03CB, 0x03D1, 0x03D7, 0x03DD, 0x03E3, 0x03E9, 0x03EE, 0x03F4, 0x03FA, 0x0400, 0x0406, +0x040C, 0x0412, 0x0418, 0x041F, 0x0425, 0x042B, 0x0431, 0x0437, 0x043E, 0x0444, 0x044A, 0x0451, 0x0457, 0x045D, 0x0464, 0x046A, +0x0471, 0x0477, 0x047E, 0x0484, 0x048B, 0x0491, 0x0498, 0x049F, 0x04A5, 0x04AC, 0x04B3, 0x04B9, 0x04C0, 0x04C7, 0x04CE, 0x04D5, +0x04DB, 0x04E2, 0x04E9, 0x04F0, 0x04F7, 0x04FE, 0x0505, 0x050C, 0x0513, 0x051A, 0x0521, 0x0529, 0x0530, 0x0537, 0x053E, 0x0545, +0x054D, 0x0554, 0x055B, 0x0562, 0x056A, 0x0571, 0x0578, 0x0580, 0x0587, 0x058F, 0x0596, 0x059E, 0x05A5, 0x05AD, 0x05B4, 0x05BC, +0x05C3, 0x05CB, 0x05D3, 0x05DA, 0x05E2, 0x05EA, 0x05F1, 0x05F9, 0x0601, 0x0609, 0x0610, 0x0618, 0x0620, 0x0628, 0x0630, 0x0638, +0x0640, 0x0647, 0x0650, 0x0658, 0x0660, 0x0669, 0x0671, 0x067A, 0x0683, 0x068C, 0x0695, 0x069F, 0x06A8, 0x06B1, 0x06BB, 0x06C5, +0x06CF, 0x06D9, 0x06E3, 0x06ED, 0x06F7, 0x0701, 0x070C, 0x0716, 0x0721, 0x072C, 0x0736, 0x0741, 0x074C, 0x0757, 0x0762, 0x076E, +0x0779, 0x0784, 0x0790, 0x079B, 0x07A7, 0x07B2, 0x07BE, 0x07CA, 0x07D5, 0x07E1, 0x07ED, 0x07F9, 0x0805, 0x0811, 0x081D, 0x0829, +0x0835, 0x0842, 0x084E, 0x085A, 0x0866, 0x0873, 0x087F, 0x088B, 0x0898, 0x08A4, 0x08B1, 0x08BD, 0x08CA, 0x08D6, 0x08E3, 0x08EF, +0x08FC, 0x0908, 0x0915, 0x0921, 0x092E, 0x093B, 0x0947, 0x0954, 0x0961, 0x096E, 0x097B, 0x0988, 0x0995, 0x09A2, 0x09AF, 0x09BC, +0x09CA, 0x09D7, 0x09E4, 0x09F2, 0x09FF, 0x0A0D, 0x0A1A, 0x0A28, 0x0A36, 0x0A43, 0x0A51, 0x0A5F, 0x0A6D, 0x0A7B, 0x0A88, 0x0A96, +0x0AA5, 0x0AB3, 0x0AC1, 0x0ACF, 0x0ADD, 0x0AEB, 0x0AFA, 0x0B08, 0x0B17, 0x0B25, 0x0B34, 0x0B42, 0x0B51, 0x0B5F, 0x0B6E, 0x0B7D, +0x0B8C, 0x0B9B, 0x0BAA, 0x0BB9, 0x0BC8, 0x0BD7, 0x0BE6, 0x0BF5, 0x0C04, 0x0C13, 0x0C23, 0x0C32, 0x0C41, 0x0C51, 0x0C60, 0x0C70, +0x0C80, 0x0C8F, 0x0C9F, 0x0CAF, 0x0CBE, 0x0CCE, 0x0CDE, 0x0CEE, 0x0CFE, 0x0D0E, 0x0D1E, 0x0D2E, 0x0D3F, 0x0D4F, 0x0D5F, 0x0D6F, +0x0D80, 0x0D90, 0x0DA1, 0x0DB1, 0x0DC2, 0x0DD2, 0x0DE3, 0x0DF4, 0x0E05, 0x0E15, 0x0E26, 0x0E37, 0x0E48, 0x0E59, 0x0E6A, 0x0E7B, +0x0E8D, 0x0E9E, 0x0EAF, 0x0EC0, 0x0ED2, 0x0EE3, 0x0EF5, 0x0F06, 0x0F18, 0x0F29, 0x0F3B, 0x0F4D, 0x0F5E, 0x0F70, 0x0F82, 0x0F94, +0x0FA6, 0x0FB8, 0x0FCA, 0x0FDC, 0x0FEE, 0x1000, 0x1012, 0x1025, 0x1037, 0x1049, 0x105C, 0x106E, 0x1081, 0x1093, 0x10A6, 0x10B9, +0x10CC, 0x10DE, 0x10F2, 0x1105, 0x1119, 0x112D, 0x1141, 0x1156, 0x116B, 0x1180, 0x1195, 0x11AB, 0x11C0, 0x11D6, 0x11EC, 0x1203, +0x1219, 0x122F, 0x1246, 0x125D, 0x1273, 0x128A, 0x12A1, 0x12B8, 0x12CF, 0x12E6, 0x12FD, 0x1314, 0x132B, 0x1343, 0x135A, 0x1371, +0x1388, 0x139E, 0x13B5, 0x13CC, 0x13E4, 0x13FB, 0x1413, 0x142B, 0x1443, 0x145C, 0x1475, 0x148E, 0x14A9, 0x14C3, 0x14DF, 0x14FB, +0x1518, 0x1536, 0x1558, 0x157C, 0x15A3, 0x15CA, 0x15F3, 0x161B, 0x1644, 0x166C, 0x1696, 0x16C0, 0x16EB, 0x1717, 0x1743, 0x1770, +0x11F8, 0x1212, 0x122C, 0x1247, 0x1260, 0x1279, 0x1292, 0x12A9, 0x12C0, 0x12D5, 0x12EB, 0x1300, 0x1315, 0x132A, 0x133F, 0x1354, +0x1369, 0x137D, 0x1392, 0x13A6, 0x13BB, 0x13CF, 0x13E4, 0x13F8, 0x140D, 0x1421, 0x1436, 0x144A, 0x145F, 0x1474, 0x1489, 0x149E, +0x14B4, 0x14C9, 0x14DF, 0x14F4, 0x150A, 0x1520, 0x1536, 0x154D, 0x1563, 0x1579, 0x158F, 0x15A6, 0x15BC, 0x15D3, 0x15E9, 0x1600, +0x1616, 0x162C, 0x1643, 0x1659, 0x166F, 0x1685, 0x169B, 0x16B1, 0x16C7, 0x16DD, 0x16F2, 0x1707, 0x171D, 0x1732, 0x1746, 0x175B, +0x1770, 0x1784, 0x1798, 0x17AC, 0x17BF, 0x17D3, 0x17E6, 0x17F9, 0x180D, 0x1820, 0x1832, 0x1845, 0x1858, 0x186A, 0x187D, 0x188F, +0x18A2, 0x18B4, 0x18C6, 0x18D9, 0x18EB, 0x18FD, 0x190F, 0x1922, 0x1934, 0x1946, 0x1958, 0x196B, 0x197D, 0x1990, 0x19A2, 0x19B5, +0x19C8, 0x19DA, 0x19ED, 0x1A00, 0x1A13, 0x1A26, 0x1A39, 0x1A4B, 0x1A5E, 0x1A71, 0x1A84, 0x1A97, 0x1AAA, 0x1ABD, 0x1AD0, 0x1AE3, +0x1AF6, 0x1B09, 0x1B1C, 0x1B2F, 0x1B41, 0x1B54, 0x1B67, 0x1B7A, 0x1B8C, 0x1B9F, 0x1BB1, 0x1BC4, 0x1BD6, 0x1BE9, 0x1BFB, 0x1C0D, +0x1C20, 0x1C32, 0x1C44, 0x1C56, 0x1C68, 0x1C7A, 0x1C8C, 0x1C9E, 0x1CB0, 0x1CC2, 0x1CD4, 0x1CE6, 0x1CF8, 0x1D0A, 0x1D1C, 0x1D2E, +0x1D40, 0x1D51, 0x1D63, 0x1D75, 0x1D87, 0x1D99, 0x1DAB, 0x1DBD, 0x1DCE, 0x1DE0, 0x1DF2, 0x1E04, 0x1E16, 0x1E27, 0x1E39, 0x1E4B, +0x1E5D, 0x1E6E, 0x1E80, 0x1E92, 0x1EA4, 0x1EB5, 0x1EC7, 0x1ED9, 0x1EEA, 0x1EFC, 0x1F0E, 0x1F20, 0x1F31, 0x1F43, 0x1F55, 0x1F66, +0x1F78, 0x1F8A, 0x1F9C, 0x1FAD, 0x1FBF, 0x1FD1, 0x1FE2, 0x1FF4, 0x2006, 0x2017, 0x2029, 0x203B, 0x204D, 0x205E, 0x2070, 0x2082, +0x2094, 0x20A5, 0x20B7, 0x20C9, 0x20DA, 0x20EC, 0x20FE, 0x2110, 0x2122, 0x2133, 0x2145, 0x2157, 0x2169, 0x217B, 0x218C, 0x219E, +0x21B0, 0x21C2, 0x21D4, 0x21E6, 0x21F8, 0x220A, 0x221B, 0x222D, 0x223F, 0x2251, 0x2263, 0x2275, 0x2287, 0x2299, 0x22AB, 0x22BD, +0x22CF, 0x22E1, 0x22F4, 0x2306, 0x2318, 0x232A, 0x233C, 0x234E, 0x2360, 0x2373, 0x2385, 0x2397, 0x23A9, 0x23BC, 0x23CE, 0x23E0, +0x23F3, 0x2405, 0x2417, 0x242A, 0x243C, 0x244F, 0x2461, 0x2474, 0x2486, 0x2499, 0x24AB, 0x24BE, 0x24D1, 0x24E3, 0x24F6, 0x2509, +0x251C, 0x252E, 0x2541, 0x2554, 0x2567, 0x257A, 0x258C, 0x259F, 0x25B2, 0x25C5, 0x25D8, 0x25EB, 0x25FE, 0x2611, 0x2624, 0x2637, +0x264A, 0x265E, 0x2671, 0x2684, 0x2697, 0x26AA, 0x26BD, 0x26D1, 0x26E4, 0x26F7, 0x270A, 0x271E, 0x2731, 0x2744, 0x2758, 0x276B, +0x277E, 0x2792, 0x27A5, 0x27B9, 0x27CC, 0x27E0, 0x27F3, 0x2806, 0x281A, 0x282D, 0x2841, 0x2855, 0x2868, 0x287C, 0x288F, 0x28A3, +0x28B6, 0x28CA, 0x28DE, 0x28F1, 0x2905, 0x2918, 0x292C, 0x2940, 0x2953, 0x2967, 0x297B, 0x298E, 0x29A2, 0x29B6, 0x29CA, 0x29DD, +0x29F1, 0x2A05, 0x2A18, 0x2A2C, 0x2A40, 0x2A54, 0x2A67, 0x2A7B, 0x2A8F, 0x2AA3, 0x2AB7, 0x2ACA, 0x2ADE, 0x2AF2, 0x2B06, 0x2B19, +0x2B2D, 0x2B41, 0x2B55, 0x2B69, 0x2B7C, 0x2B90, 0x2BA4, 0x2BB8, 0x2BCC, 0x2BDF, 0x2BF3, 0x2C07, 0x2C1B, 0x2C2E, 0x2C42, 0x2C56, +0x2C6A, 0x2C7E, 0x2C91, 0x2CA5, 0x2CB9, 0x2CCD, 0x2CE0, 0x2CF4, 0x2D08, 0x2D1C, 0x2D2F, 0x2D43, 0x2D57, 0x2D6B, 0x2D7E, 0x2D92, +0x2DA6, 0x2DB9, 0x2DCD, 0x2DE1, 0x2DF4, 0x2E08, 0x2E1C, 0x2E2F, 0x2E43, 0x2E56, 0x2E6A, 0x2E7E, 0x2E91, 0x2EA5, 0x2EB8, 0x2ECC, +0x2EE0, 0x2EF3, 0x2F07, 0x2F1A, 0x2F2E, 0x2F42, 0x2F56, 0x2F6A, 0x2F7E, 0x2F92, 0x2FA6, 0x2FBA, 0x2FCE, 0x2FE2, 0x2FF6, 0x300B, +0x301F, 0x3033, 0x3048, 0x305C, 0x3070, 0x3085, 0x3099, 0x30AE, 0x30C3, 0x30D7, 0x30EC, 0x3100, 0x3115, 0x312A, 0x313E, 0x3153, +0x3168, 0x317D, 0x3191, 0x31A6, 0x31BB, 0x31D0, 0x31E5, 0x31F9, 0x320E, 0x3223, 0x3238, 0x324D, 0x3262, 0x3276, 0x328B, 0x32A0, +0x32B5, 0x32CA, 0x32DF, 0x32F3, 0x3308, 0x331D, 0x3332, 0x3346, 0x335B, 0x3370, 0x3384, 0x3399, 0x33AE, 0x33C2, 0x33D7, 0x33EB, +0x3400, 0x3414, 0x3429, 0x343D, 0x3452, 0x3466, 0x347A, 0x348F, 0x34A3, 0x34B7, 0x34CB, 0x34DF, 0x34F3, 0x3507, 0x351B, 0x352F, +0x3543, 0x3557, 0x356B, 0x357F, 0x3592, 0x35A6, 0x35B9, 0x35CD, 0x35E0, 0x35F3, 0x3607, 0x361A, 0x362D, 0x3640, 0x3653, 0x3666, +0x3679, 0x368C, 0x369E, 0x36B1, 0x36C3, 0x36D6, 0x36E8, 0x36FA, 0x370D, 0x371F, 0x3731, 0x3743, 0x3754, 0x3766, 0x3778, 0x3789, +0x379B, 0x37AC, 0x37BD, 0x37CF, 0x37E0, 0x37F1, 0x3801, 0x3812, 0x3823, 0x3833, 0x3844, 0x3854, 0x3864, 0x3874, 0x3884, 0x3894, +0x38A4, 0x38B3, 0x38C3, 0x38D2, 0x38E1, 0x38F0, 0x3900, 0x390F, 0x391D, 0x392C, 0x393B, 0x394A, 0x3958, 0x3967, 0x3975, 0x3983, +0x3992, 0x39A0, 0x39AE, 0x39BC, 0x39CA, 0x39D7, 0x39E5, 0x39F3, 0x3A00, 0x3A0E, 0x3A1B, 0x3A29, 0x3A36, 0x3A43, 0x3A50, 0x3A5D, +0x3A6A, 0x3A77, 0x3A84, 0x3A91, 0x3A9D, 0x3AAA, 0x3AB7, 0x3AC3, 0x3AD0, 0x3ADC, 0x3AE8, 0x3AF4, 0x3B01, 0x3B0D, 0x3B19, 0x3B25, +0x3B31, 0x3B3D, 0x3B49, 0x3B54, 0x3B60, 0x3B6C, 0x3B77, 0x3B83, 0x3B8E, 0x3B9A, 0x3BA5, 0x3BB1, 0x3BBC, 0x3BC7, 0x3BD3, 0x3BDE, +0x3BE9, 0x3BF4, 0x3BFF, 0x3C0A, 0x3C15, 0x3C20, 0x3C2B, 0x3C36, 0x3C41, 0x3C4C, 0x3C56, 0x3C61, 0x3C6C, 0x3C76, 0x3C81, 0x3C8C, +0x3C96, 0x3CA1, 0x3CAB, 0x3CB6, 0x3CC0, 0x3CCB, 0x3CD5, 0x3CDF, 0x3CEA, 0x3CF4, 0x3CFF, 0x3D09, 0x3D13, 0x3D1D, 0x3D28, 0x3D32, +0x3D3C, 0x3D46, 0x3D50, 0x3D5B, 0x3D65, 0x3D6F, 0x3D79, 0x3D83, 0x3D8D, 0x3D97, 0x3DA1, 0x3DAC, 0x3DB6, 0x3DC0, 0x3DCA, 0x3DD4, +0x3DDE, 0x3DE8, 0x3DF2, 0x3DFC, 0x3E06, 0x3E10, 0x3E1A, 0x3E24, 0x3E2F, 0x3E39, 0x3E43, 0x3E4D, 0x3E57, 0x3E61, 0x3E6B, 0x3E75, +0x3E80, 0x3E8A, 0x3E94, 0x3E9E, 0x3EA8, 0x3EB2, 0x3EBC, 0x3EC6, 0x3ED0, 0x3EDA, 0x3EE4, 0x3EEE, 0x3EF8, 0x3F02, 0x3F0C, 0x3F16, +0x3F20, 0x3F29, 0x3F33, 0x3F3D, 0x3F47, 0x3F51, 0x3F5A, 0x3F64, 0x3F6E, 0x3F77, 0x3F81, 0x3F8B, 0x3F94, 0x3F9E, 0x3FA7, 0x3FB1, +0x3FBA, 0x3FC4, 0x3FCD, 0x3FD7, 0x3FE0, 0x3FEA, 0x3FF3, 0x3FFC, 0x4006, 0x400F, 0x4018, 0x4021, 0x402B, 0x4034, 0x403D, 0x4046, +0x404F, 0x4058, 0x4061, 0x406A, 0x4074, 0x407D, 0x4085, 0x408E, 0x4097, 0x40A0, 0x40A9, 0x40B2, 0x40BB, 0x40C4, 0x40CC, 0x40D5, +0x40DE, 0x40E6, 0x40EF, 0x40F8, 0x4100, 0x4109, 0x4111, 0x411A, 0x4122, 0x412B, 0x4133, 0x413C, 0x4144, 0x414C, 0x4155, 0x415D, +0x4165, 0x416D, 0x4176, 0x417E, 0x4186, 0x418E, 0x4196, 0x419E, 0x41A6, 0x41AE, 0x41B6, 0x41BE, 0x41C6, 0x41CE, 0x41D5, 0x41DD, +0x41E5, 0x41ED, 0x41F4, 0x41FC, 0x4204, 0x420B, 0x4213, 0x421A, 0x4222, 0x4229, 0x4231, 0x4238, 0x4240, 0x4247, 0x424E, 0x4255, +0x425D, 0x4264, 0x426B, 0x4272, 0x4279, 0x4280, 0x4287, 0x428E, 0x4295, 0x429C, 0x42A3, 0x42AA, 0x42B1, 0x42B7, 0x42BE, 0x42C5, +0x42CC, 0x42D2, 0x42D9, 0x42DF, 0x42E6, 0x42EC, 0x42F3, 0x42F9, 0x42FF, 0x4306, 0x430C, 0x4312, 0x4318, 0x431E, 0x4324, 0x432A, +0x4330, 0x4336, 0x433C, 0x4342, 0x4348, 0x434E, 0x4354, 0x4359, 0x435F, 0x4365, 0x436A, 0x4370, 0x4376, 0x437B, 0x4381, 0x4386, +0x438C, 0x4391, 0x4396, 0x439C, 0x43A1, 0x43A6, 0x43AC, 0x43B1, 0x43B6, 0x43BB, 0x43C0, 0x43C5, 0x43CA, 0x43CF, 0x43D4, 0x43D9, +0x43DE, 0x43E3, 0x43E8, 0x43ED, 0x43F2, 0x43F6, 0x43FB, 0x4400, 0x4405, 0x4409, 0x440E, 0x4413, 0x4417, 0x441C, 0x4420, 0x4425, +0x4429, 0x442E, 0x4432, 0x4437, 0x443B, 0x443F, 0x4444, 0x4448, 0x444C, 0x4451, 0x4455, 0x4459, 0x445D, 0x4462, 0x4466, 0x446A, +0x446E, 0x4472, 0x4476, 0x447B, 0x447F, 0x4483, 0x4487, 0x448B, 0x448F, 0x4493, 0x4497, 0x449B, 0x449F, 0x44A2, 0x44A6, 0x44AA, +0x44AE, 0x44B2, 0x44B6, 0x44BA, 0x44BD, 0x44C1, 0x44C5, 0x44C9, 0x44CC, 0x44D0, 0x44D4, 0x44D8, 0x44DB, 0x44DF, 0x44E3, 0x44E6, +0x44EA, 0x44EE, 0x44F1, 0x44F5, 0x44F9, 0x44FC, 0x4500, 0x4503, 0x4507, 0x450B, 0x450E, 0x4512, 0x4515, 0x4519, 0x451C, 0x4520, +0x4524, 0x4527, 0x452B, 0x452E, 0x4531, 0x4535, 0x4538, 0x453C, 0x453F, 0x4542, 0x4545, 0x4549, 0x454C, 0x454F, 0x4552, 0x4555, +0x4559, 0x455C, 0x455F, 0x4562, 0x4565, 0x4568, 0x456B, 0x456E, 0x4571, 0x4574, 0x4577, 0x4579, 0x457C, 0x457F, 0x4582, 0x4585, +0x4588, 0x458A, 0x458D, 0x4590, 0x4592, 0x4595, 0x4598, 0x459A, 0x459D, 0x45A0, 0x45A2, 0x45A5, 0x45A7, 0x45AA, 0x45AC, 0x45AF, +0x45B1, 0x45B4, 0x45B6, 0x45B8, 0x45BB, 0x45BD, 0x45C0, 0x45C2, 0x45C4, 0x45C7, 0x45C9, 0x45CB, 0x45CD, 0x45D0, 0x45D2, 0x45D4, +0x45D6, 0x45D9, 0x45DB, 0x45DD, 0x45DF, 0x45E1, 0x45E3, 0x45E6, 0x45E8, 0x45EA, 0x45EC, 0x45EE, 0x45F0, 0x45F2, 0x45F4, 0x45F6, +0x45F8, 0x45FA, 0x45FC, 0x45FE, 0x4600, 0x4602, 0x4604, 0x4606, 0x4608, 0x460A, 0x460C, 0x460E, 0x4610, 0x4612, 0x4614, 0x4615, +0x4617, 0x4619, 0x461B, 0x461D, 0x461F, 0x4621, 0x4622, 0x4624, 0x4626, 0x4628, 0x462A, 0x462C, 0x462D, 0x462F, 0x4631, 0x4633, +0x4635, 0x4637, 0x4638, 0x463A, 0x463C, 0x463E, 0x463F, 0x4641, 0x4643, 0x4645, 0x4647, 0x4648, 0x464A, 0x464C, 0x464E, 0x464F, +}; diff --git a/reSID/sid.cc b/reSID/sid.cc index 4e8bb4d..bbf9ba3 100644 --- a/reSID/sid.cc +++ b/reSID/sid.cc @@ -55,9 +55,17 @@ SID::SID() bus_value_ttl = 0; ext_in = 0; -} - +} +/* +void SID::printFilter(void){ + Serial.print(filter.f0_count); + for (int i=0; i< 2048; i++) { + if (i % 16==0) Serial.println(); + Serial.printf("0x%04X, ",filter.f0_6581[i]); + } +} +*/ // ---------------------------------------------------------------------------- // Destructor. // ---------------------------------------------------------------------------- @@ -114,7 +122,6 @@ void SID::input(int sample) // ---------------------------------------------------------------------------- // Read sample from audio output. -// Both 16-bit and n-bit output is provided. // ---------------------------------------------------------------------------- int SID::output() { @@ -134,20 +141,6 @@ int SID::output() return sample; } -int SID::output(int bits) -{ - const int range = 1 << bits; - const int half = range >> 1; - int sample = extfilt.output()/((4095*255 >> 7)*3*15*2/range); - if (sample >= half) { - return half - 1; - } - if (sample < -half) { - return -half; - } - return sample; -} - // ---------------------------------------------------------------------------- // Read registers. @@ -530,20 +523,22 @@ void SID::adjust_sampling_frequency(float sample_freq) // Return array of default spline interpolation points to map FC to // filter cutoff frequency. // ---------------------------------------------------------------------------- +/* void SID::fc_default(const fc_point*& points, int& count) { filter.fc_default(points, count); } - +*/ // ---------------------------------------------------------------------------- // Return FC spline plotter object. // ---------------------------------------------------------------------------- +/* PointPlotter SID::fc_plotter() { return filter.fc_plotter(); } - +*/ // ---------------------------------------------------------------------------- // SID clocking - 1 cycle. @@ -729,6 +724,7 @@ int SID::clock_fast(cycle_count& delta_t, short* buf, int n) RESID_INLINE int SID::clock_interpolate(cycle_count& delta_t, short* buf, int n) { + int s = 0; int i; @@ -765,6 +761,7 @@ int SID::clock_interpolate(cycle_count& delta_t, short* buf, int n) sample_prev = output(); clock(); } + sample_offset -= delta_t << FIXP_SHIFT; delta_t = 0; return s; diff --git a/reSID/sid.h b/reSID/sid.h index e0eb553..3087e6f 100644 --- a/reSID/sid.h +++ b/reSID/sid.h @@ -33,7 +33,7 @@ class SID public: SID(); ~SID(); - + //void printFilter(void); //void set_chip_model(chip_model model); void enable_filter(bool enable); void enable_external_filter(bool enable); @@ -42,8 +42,8 @@ public: float filter_scale = 0.97); void adjust_sampling_frequency(float sample_freq); - void fc_default(const fc_point*& points, int& count); - PointPlotter fc_plotter(); + //void fc_default(const fc_point*& points, int& count); + //PointPlotter fc_plotter(); void clock(); void clock(cycle_count delta_t); @@ -85,8 +85,7 @@ public: // 16-bit output (AUDIO OUT). int output(); - // n-bit output. - int output(int bits); + protected: