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

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

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

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

@ -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 <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
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 <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"

Loading…
Cancel
Save