Fix for two sids (but requires 144MHZ, -O2)

master
Frank Bösing 8 years ago
parent ee02b07d33
commit 54b7f82887
  1. 24
      reSID.cpp
  2. 7
      reSID.h
  3. 5
      sid.h

@ -27,16 +27,14 @@
#include "reSID.h" #include "reSID.h"
#include <AudioStream.h> #include <AudioStream.h>
#define OVERSAMPLE 23 #define SAMPLERATE 44118
#define CLOCKFREQ (22.5 * SAMPLERATE) //nearest int to 985248
static SID sid;
void AudioPlaySID::begin(void) void AudioPlaySID::begin(void)
{ {
sidptr = &sid;
this->reset(); this->reset();
sid.set_sampling_parameters(OVERSAMPLE * AUDIO_SAMPLE_RATE_EXACT, SAMPLE_FAST, AUDIO_SAMPLE_RATE_EXACT); sid.set_sampling_parameters(CLOCKFREQ, SAMPLE_FAST, SAMPLERATE);
//sid.set_chip_model(MOS6581);
//sid.set_chip_model(MOS8580);
playing = true; playing = true;
} }
@ -52,13 +50,7 @@ void AudioPlaySID::stop(void)
__enable_irq(); __enable_irq();
} }
//inline
void AudioPlaySID::setreg(int ofs, int val) {
sid.write(ofs, val);
}
void AudioPlaySID::update(void) { void AudioPlaySID::update(void) {
unsigned int i;
audio_block_t *block; audio_block_t *block;
// only update if we're playing // only update if we're playing
@ -68,10 +60,10 @@ unsigned int i;
block = allocate(); block = allocate();
if (block == NULL) return; if (block == NULL) return;
for (i=0; i< AUDIO_BLOCK_SAMPLES; i++) { //I'm not 100% if this is correct:
sid.clock(OVERSAMPLE); cycle_count delta_t = CLOCKFREQ / (SAMPLERATE / AUDIO_BLOCK_SAMPLES);
block->data[i] = sid.output();
} sidptr->clock(delta_t, (short int*)block->data, AUDIO_BLOCK_SAMPLES);
transmit(block); transmit(block);
release(block); release(block);

@ -36,14 +36,15 @@ class AudioPlaySID : public AudioStream
public: public:
AudioPlaySID(void) : AudioStream(0, NULL) { begin(); } AudioPlaySID(void) : AudioStream(0, NULL) { begin(); }
void begin(void); void begin(void);
//inline inline void setreg(int ofs, int val) { sid.write(ofs, val); }
void setreg(int ofs, int val);// { sid.write(ofs, val);}
void reset(void); void reset(void);
void stop(void); void stop(void);
bool isPlaying(void) { return playing; } inline bool isPlaying(void) { return playing; }
private: private:
volatile bool playing; volatile bool playing;
virtual void update(void); virtual void update(void);
SID sid;
SID* sidptr;
}; };

@ -11,7 +11,7 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this library. If not, see <http://www.gnu.org/licenses/>. along with this library. If not, see <http://www.gnu.org/licenses/>.
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 Diese Bibliothek ist freie Software: Sie können es unter den Bedingungen
der GNU General Public License, wie von der Free Software Foundation, der GNU General Public License, wie von der Free Software Foundation,
Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
@ -22,8 +22,7 @@
Siehe die GNU General Public License für weitere Details. Siehe die GNU General Public License für weitere Details.
Sie sollten eine Kopie der GNU General Public License zusammen mit diesem Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>. Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
Der Helixdecoder selbst hat eine eigene Lizenz, bitte für mehr Informationen
in den Unterverzeichnissen nachsehen.
*/ */
#include "reSID/sid.h" #include "reSID/sid.h"

Loading…
Cancel
Save