From ee02b07d332b52bfbd6218c7ee10fd51003d5ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20B=C3=B6sing?= Date: Thu, 21 Jan 2016 23:27:38 +0100 Subject: [PATCH] remove MOS8580 ..sound nearly the same but need too much resources --- reSID.cpp | 13 ++++++------- reSID.h | 10 +++++----- reSID/extfilt.cc | 8 ++++++-- reSID/extfilt.h | 2 +- reSID/filter.cc | 19 ++++++++++++++++--- reSID/filter.h | 6 +++--- reSID/sid.cc | 3 ++- reSID/sid.h | 2 +- reSID/siddefs.h | 2 +- reSID/voice.cc | 9 +++++++-- reSID/voice.h | 2 +- reSID/wave.cc | 13 +++++++++---- reSID/wave.h | 2 +- sid.cpp | 8 ++++---- 14 files changed, 63 insertions(+), 36 deletions(-) diff --git a/reSID.cpp b/reSID.cpp index fbd9422..b532289 100644 --- a/reSID.cpp +++ b/reSID.cpp @@ -11,7 +11,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library. If not, see . - The helix decoder itself as a different license, look at the subdirectories for more info. + Diese Bibliothek ist freie Software: Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation, Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren @@ -22,23 +22,21 @@ Siehe die GNU General Public License für weitere Details. Sie sollten eine Kopie der GNU General Public License zusammen mit diesem Programm erhalten haben. Wenn nicht, siehe . - Der Helixdecoder selbst hat eine eigene Lizenz, bitte für mehr Informationen - in den Unterverzeichnissen nachsehen. + */ #include "reSID.h" #include -#define OVERSAMPLE 20 +#define OVERSAMPLE 23 static SID sid; void AudioPlaySID::begin(void) { this->reset(); - sid.set_sampling_parameters(OVERSAMPLE * 44117, SAMPLE_FAST, 44117); + sid.set_sampling_parameters(OVERSAMPLE * AUDIO_SAMPLE_RATE_EXACT, SAMPLE_FAST, AUDIO_SAMPLE_RATE_EXACT); //sid.set_chip_model(MOS6581); - sid.set_chip_model(MOS8580); - + //sid.set_chip_model(MOS8580); playing = true; } @@ -54,6 +52,7 @@ void AudioPlaySID::stop(void) __enable_irq(); } +//inline void AudioPlaySID::setreg(int ofs, int val) { sid.write(ofs, val); } diff --git a/reSID.h b/reSID.h index 7d28faa..784b4bf 100644 --- a/reSID.h +++ b/reSID.h @@ -11,7 +11,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library. If not, see . - The helix decoder itself as a different license, look at the subdirectories for more info. + Diese Bibliothek ist freie Software: Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation, Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren @@ -22,8 +22,7 @@ Siehe die GNU General Public License für weitere Details. Sie sollten eine Kopie der GNU General Public License zusammen mit diesem Programm erhalten haben. Wenn nicht, siehe . - Der Helixdecoder selbst hat eine eigene Lizenz, bitte für mehr Informationen - in den Unterverzeichnissen nachsehen. + */ #include "sid.h" @@ -37,13 +36,14 @@ class AudioPlaySID : public AudioStream public: AudioPlaySID(void) : AudioStream(0, NULL) { begin(); } void begin(void); - void setreg(int ofs, int val); + //inline + void setreg(int ofs, int val);// { sid.write(ofs, val);} void reset(void); void stop(void); bool isPlaying(void) { return playing; } - virtual void update(void); private: volatile bool playing; + virtual void update(void); }; diff --git a/reSID/extfilt.cc b/reSID/extfilt.cc index ed34737..e9747f0 100644 --- a/reSID/extfilt.cc +++ b/reSID/extfilt.cc @@ -30,7 +30,10 @@ ExternalFilter::ExternalFilter() reset(); enable_filter(true); set_sampling_parameter(15915.6); - set_chip_model(MOS6581); + //set_chip_model(MOS6581); + {//instead: + mixer_DC = ((((0x800 - 0x380) + 0x800)*0xff*3 - 0xfff*0xff/18) >> 7)*0x0f; + } } @@ -65,6 +68,7 @@ void ExternalFilter::set_sampling_parameter(float pass_freq) // ---------------------------------------------------------------------------- // Set chip model. // ---------------------------------------------------------------------------- +/* void ExternalFilter::set_chip_model(chip_model model) { if (model == MOS6581) { @@ -78,7 +82,7 @@ void ExternalFilter::set_chip_model(chip_model model) mixer_DC = 0; } } - +*/ // ---------------------------------------------------------------------------- // SID reset. diff --git a/reSID/extfilt.h b/reSID/extfilt.h index a2bb027..7b67e52 100644 --- a/reSID/extfilt.h +++ b/reSID/extfilt.h @@ -44,7 +44,7 @@ public: void enable_filter(bool enable); void set_sampling_parameter(float pass_freq); - void set_chip_model(chip_model model); + //void set_chip_model(chip_model model); RESID_INLINE void clock(sound_sample Vi); RESID_INLINE void clock(cycle_count delta_t, sound_sample Vi); diff --git a/reSID/filter.cc b/reSID/filter.cc index 83deb4e..c0c62ca 100644 --- a/reSID/filter.cc +++ b/reSID/filter.cc @@ -80,7 +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[] = { // FC f FCHI FCLO @@ -105,7 +105,7 @@ const fc_point Filter::f0_points_8580[] = { 2047, 12500 }, // 0xff 0x07 { 2047, 12500 } // 0xff 0x07 - repeated end point }; - +*/ // ---------------------------------------------------------------------------- // Constructor. @@ -136,11 +136,22 @@ Filter::Filter() 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); +*/ +// set_chip_model(MOS6581); +{//instead: + mixer_DC = -0xfff*0xff/18 >> 7; - set_chip_model(MOS6581); + f0 = f0_6581; + f0_points = f0_points_6581; + f0_count = sizeof(f0_points_6581)/sizeof(*f0_points_6581); + set_w0(); + set_Q(); +} + } @@ -156,6 +167,7 @@ void Filter::enable_filter(bool enable) // ---------------------------------------------------------------------------- // Set chip model. // ---------------------------------------------------------------------------- +/* void Filter::set_chip_model(chip_model model) { if (model == MOS6581) { @@ -187,6 +199,7 @@ void Filter::set_chip_model(chip_model model) set_w0(); set_Q(); } +*/ // ---------------------------------------------------------------------------- diff --git a/reSID/filter.h b/reSID/filter.h index 4afbb68..08684d3 100644 --- a/reSID/filter.h +++ b/reSID/filter.h @@ -126,7 +126,7 @@ public: Filter(); void enable_filter(bool enable); - void set_chip_model(chip_model model); + // void set_chip_model(chip_model model); RESID_INLINE void clock(sound_sample voice1, sound_sample voice2, sound_sample voice3, @@ -191,10 +191,10 @@ protected: // Cutoff frequency tables. // FC is an 11 bit register. sound_sample f0_6581[2048]; - sound_sample f0_8580[2048]; + //sound_sample f0_8580[2048]; sound_sample* f0; const static fc_point f0_points_6581[]; - const static fc_point f0_points_8580[]; + //const static fc_point f0_points_8580[]; const fc_point* f0_points; int f0_count; diff --git a/reSID/sid.cc b/reSID/sid.cc index 033f825..b626593 100644 --- a/reSID/sid.cc +++ b/reSID/sid.cc @@ -74,6 +74,7 @@ SID::~SID() // ---------------------------------------------------------------------------- // Set chip model. // ---------------------------------------------------------------------------- +/* void SID::set_chip_model(chip_model model) { voice[0].set_chip_model(model); @@ -83,7 +84,7 @@ void SID::set_chip_model(chip_model model) filter.set_chip_model(model); extfilt.set_chip_model(model); } - +*/ // ---------------------------------------------------------------------------- // SID reset. diff --git a/reSID/sid.h b/reSID/sid.h index 229394d..b1ab911 100644 --- a/reSID/sid.h +++ b/reSID/sid.h @@ -34,7 +34,7 @@ public: SID(); ~SID(); - void set_chip_model(chip_model model); + //void set_chip_model(chip_model model); void enable_filter(bool enable); void enable_external_filter(bool enable); bool set_sampling_parameters(float clock_freq, sampling_method method, diff --git a/reSID/siddefs.h b/reSID/siddefs.h index a7b9394..cdc785d 100644 --- a/reSID/siddefs.h +++ b/reSID/siddefs.h @@ -66,7 +66,7 @@ typedef int cycle_count; typedef int sound_sample; typedef sound_sample fc_point[2]; -enum chip_model { MOS6581, MOS8580 }; +//enum chip_model { MOS6581, MOS8580 }; enum sampling_method { SAMPLE_FAST, SAMPLE_INTERPOLATE, SAMPLE_RESAMPLE_INTERPOLATE, SAMPLE_RESAMPLE_FAST }; diff --git a/reSID/voice.cc b/reSID/voice.cc index 081b098..e24bcdb 100644 --- a/reSID/voice.cc +++ b/reSID/voice.cc @@ -28,12 +28,17 @@ RESID_NAMESPACE_START Voice::Voice() : muted(false) { - set_chip_model(MOS6581); + //set_chip_model(MOS6581); + {//instead: + wave_zero = 0x380; + voice_DC = 0x800*0xff; + } } // ---------------------------------------------------------------------------- // Set chip model. // ---------------------------------------------------------------------------- +/* void Voice::set_chip_model(chip_model model) { wave.set_chip_model(model); @@ -107,7 +112,7 @@ void Voice::set_chip_model(chip_model model) voice_DC = 0; } } - +*/ // ---------------------------------------------------------------------------- // Set sync source. // ---------------------------------------------------------------------------- diff --git a/reSID/voice.h b/reSID/voice.h index 4af5366..119d26d 100644 --- a/reSID/voice.h +++ b/reSID/voice.h @@ -31,7 +31,7 @@ class Voice public: Voice(); - void set_chip_model(chip_model model); +// void set_chip_model(chip_model model); void set_sync_source(Voice*); void reset(); void mute(bool enable); diff --git a/reSID/wave.cc b/reSID/wave.cc index 4b72467..9da1a58 100644 --- a/reSID/wave.cc +++ b/reSID/wave.cc @@ -29,8 +29,13 @@ WaveformGenerator::WaveformGenerator() { sync_source = this; - set_chip_model(MOS6581); - + // set_chip_model(MOS6581); + {//instead: + wave__ST = &wave6581__ST[0]; + wave_P_T = &wave6581_P_T[0]; + wave_PS_ = &wave6581_PS_[0]; + wave_PST = &wave6581_PST[0]; + } reset(); } @@ -48,6 +53,7 @@ void WaveformGenerator::set_sync_source(WaveformGenerator* source) // ---------------------------------------------------------------------------- // Set chip model. // ---------------------------------------------------------------------------- +/* void WaveformGenerator::set_chip_model(chip_model model) { if (model == MOS6581) { @@ -62,9 +68,8 @@ void WaveformGenerator::set_chip_model(chip_model model) wave_PS_ = &wave8580_PS_[0]; wave_PST = &wave8580_PST[0]; } - } - +*/ // ---------------------------------------------------------------------------- // Register functions. diff --git a/reSID/wave.h b/reSID/wave.h index a42435e..0a26126 100644 --- a/reSID/wave.h +++ b/reSID/wave.h @@ -38,7 +38,7 @@ public: WaveformGenerator(); void set_sync_source(WaveformGenerator*); - void set_chip_model(chip_model model); + //void set_chip_model(chip_model model); RESID_INLINE void clock(); RESID_INLINE void clock(cycle_count delta_t); diff --git a/sid.cpp b/sid.cpp index db10806..a446ee4 100644 --- a/sid.cpp +++ b/sid.cpp @@ -11,7 +11,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library. If not, see . - The helix decoder itself as a different license, look at the subdirectories for more info. + Diese Bibliothek ist freie Software: Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation, Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren @@ -22,8 +22,7 @@ Siehe die GNU General Public License für weitere Details. Sie sollten eine Kopie der GNU General Public License zusammen mit diesem Programm erhalten haben. Wenn nicht, siehe . - Der Helixdecoder selbst hat eine eigene Lizenz, bitte für mehr Informationen - in den Unterverzeichnissen nachsehen. + */ #include "reSID/envelope.cc" @@ -39,11 +38,12 @@ #include "reSID/wave6581_PS_.cc" #include "reSID/wave6581_PST.cc" +/* #include "reSID/wave8580__ST.cc" #include "reSID/wave8580_P_T.cc" #include "reSID/wave8580_PS_.cc" #include "reSID/wave8580_PST.cc" - +*/ #include "reSID/wave.cc" #include "reSID/sid.cc" \ No newline at end of file