15 #include <zpuino-types.h>
19 #define SID_ADDR_BASE_V1 0x00
20 #define SID_ADDR_BASE_V2 0x07
21 #define SID_ADDR_BASE_V3 0x0E
23 #define SID_ADDR_FILTER_FC_LOW 0x15
24 #define SID_ADDR_FILTER_FC_HI 0x16
25 #define SID_ADDR_FILTER_RES_FILT 0x17
26 #define SID_ADDR_FILTER_MODE_VOL 0x18
28 #define SID_ADDR_MISC_ENV3 0x1C
30 #define SIDBASE IO_SLOT(14)
31 #define SIDREG(x) REGISTER(SIDBASE,x)
38 void setBase(
int address);
39 void setNote(
int note,
boolean active);
56 void setInstrument(
const char* name, byte attack, byte decay, byte sustain, byte release,
bool noise,
bool square,
bool sawtooth,
bool triangle,
int pwm);
57 void loadInstrument(byte instrument);
58 void handleCC(byte number, byte value);
62 void writeData(
unsigned char address,
unsigned char data);
63 void ringMod(byte baseOffset, byte valueOffset, byte value);
66 int SID_ADDR_FREQ_LOW;
70 int SID_ADDR_CONTROLREG;
71 int SID_ADDR_ATTACK_DECAY;
72 int SID_ADDR_SUSTAIN_RELEASE;
73 char instrumentName[25];
74 struct SID_REG_CONTROLREG_STRUCT{
75 unsigned int NOISE_WAVE : 1;
76 unsigned int SQUARE_WAVE : 1;
77 unsigned int SAWTOOTH_WAVE : 1;
78 unsigned int TRIANGLE_WAVE : 1;
79 unsigned int TEST : 1;
80 unsigned int RING_MOD : 1;
81 unsigned int SYNC : 1;
82 unsigned int GATE : 1;
84 SID_REG_CONTROLREG_STRUCT SID_REG_CONTROLREG;
86 struct SID_REG_ATTACK_DECAY_STRUCT{
87 unsigned int ATTACK : 4;
88 unsigned int DECAY : 4;
90 SID_REG_ATTACK_DECAY_STRUCT SID_REG_ATTACK_DECAY;
92 struct SID_REG_SUSTAIN_RELEASE_STRUCT{
93 unsigned int SUSTAIN : 4;
94 unsigned int RELEASE : 4;
96 SID_REG_SUSTAIN_RELEASE_STRUCT SID_REG_SUSTAIN_RELEASE;
106 static void writeData(
unsigned char address,
unsigned char data);
109 static const int MIDI2freq[129];
111 struct SID_REG_MODE_VOLUME_STRUCT{
112 unsigned int OFF : 1;
116 unsigned int VOLUME : 4;
118 SID_REG_MODE_VOLUME_STRUCT SID_REG_MODE_VOLUME;