#include "types.h"
#include "log.h"
#include "v6808.h"
+#include "timing.h"
//using namespace std;
+#define AUDIO_SAMPLE_RATE 44100
+
// Local variables
SDL_AudioSpec desired;
{
// memory_malloc_secure((void **)&DACBuffer, BUFFER_SIZE * sizeof(uint16), "DAC buffer");
- desired.freq = 44100; // SDL will do conversion on the fly, if it can't get the exact rate. Nice!
+ desired.freq = AUDIO_SAMPLE_RATE; // SDL will do conversion on the fly, if it can't get the exact rate. Nice!
desired.format = AUDIO_U8; // This uses the native endian (for portability)...
desired.channels = 1;
// desired.samples = 4096; // Let's try a 4K buffer (can always go lower)
}
}
+/*
+The way to determine the # of cycles for each sample is to take the CPU clock frequency
+and divide by the sample rate.
+
+Like so:
+double cycles = M6808_CLOCK_SPEED_IN_HZ / AUDIO_SAMPLE_RATE;
+Then we need to separate out the fractional part from the integer part.
+*/
+
//
// Sound card callback handler
//
void SDLSoundCallback(void * userdata, Uint8 * buffer, int length)
{
extern V6808REGS soundCPU;
-// extern uint8 * sram;
extern uint8 sram[];
int cnt = 0;