//
// Notes:
// ------
-// The emulator creates signed 16-bit samples. Make sure there's enough room in
-// your buffer for them!
+// The emulator creates signed 16-bit samples. Make sure there's enough room
+// in your buffer for them!
//
#include "psg.h"
#include <stdio.h>
#include <string.h>
-
struct Voice
{
uint8_t leftVolume;
static Voice voice[8];
static uint8_t memory[0x200];
-//static
static uint32_t sampleRate = 44100;
static uint32_t divisor;
-
void InitPSG(uint32_t s/*=44100*/)
{
sampleRate = s;
voice[i].noiseSeed = 1;
}
-
//
-// Note that it doesn't wipe out the buffer passed in, if you want it wiped,
-// you have to wipe it yourself. :-)
+// Note that it doesn't wipe out the buffer passed in; if you want it wiped,
+// you have to wipe it yourself. :-)
//
void UpdatePSG(uint8_t * buffer, int count)
{
}
}
-
void WritePSG(uint16_t address, uint8_t data)
{
if ((address >= 0x100) && (address <= 0x13F))
break;
case 1:
voice[channel].waveform = data >> 4;
- voice[channel].frequency = ((data & 0x0F) << 16)
+ voice[channel].frequency = ((data & 0x0F) << 16)
| (voice[channel].frequency & 0x0FFFF);
#if 0
printf("PSG: Setting waveform on channel %i to %i...\n", channel, voice[channel].waveform);
memory[address & 0x01FF] = data;
}
-
uint8_t ReadPSG(uint16_t address)
{
return memory[address & 0x01FF];
}
-