| 1 |
#ifndef _NES_VRC6_H_ |
| 2 |
#define _NES_VRC6_H_ |
| 3 |
|
| 4 |
namespace xgm |
| 5 |
{ |
| 6 |
|
| 7 |
class NES_VRC6 |
| 8 |
{ |
| 9 |
public: |
| 10 |
enum |
| 11 |
{ |
| 12 |
OPT_END |
| 13 |
}; |
| 14 |
protected: |
| 15 |
unsigned int counter[3]; // frequency divider |
| 16 |
unsigned int phase[3]; // phase counter |
| 17 |
unsigned int freq2[3]; // adjusted frequency |
| 18 |
int count14; // saw 14-stage counter |
| 19 |
|
| 20 |
//int option[OPT_END]; |
| 21 |
int mask; |
| 22 |
int sm[2][3]; // stereo mix |
| 23 |
int duty[2]; |
| 24 |
int volume[3]; |
| 25 |
int enable[3]; |
| 26 |
int gate[3]; |
| 27 |
unsigned int freq[3]; |
| 28 |
short calc_sqr (int i, unsigned int clocks); |
| 29 |
short calc_saw (unsigned int clocks); |
| 30 |
bool halt; |
| 31 |
int freq_shift; |
| 32 |
double clock, rate; |
| 33 |
int out[3]; |
| 34 |
|
| 35 |
public: |
| 36 |
NES_VRC6 (); |
| 37 |
~NES_VRC6 (); |
| 38 |
|
| 39 |
void Reset (); |
| 40 |
void Tick (unsigned int clocks); |
| 41 |
unsigned int Render (int b[2]); |
| 42 |
bool Read (unsigned int adr, unsigned int & val, unsigned int id=0); |
| 43 |
bool Write (unsigned int adr, unsigned int val, unsigned int id=0); |
| 44 |
void SetClock (double); |
| 45 |
void SetRate (double); |
| 46 |
void SetOption (int, int); |
| 47 |
void SetMask (int m){ mask = m; } |
| 48 |
void SetStereoMix (int trk, short mixl, short mixr); |
| 49 |
}; |
| 50 |
|
| 51 |
} // namespace |
| 52 |
|
| 53 |
#endif |