Debian Codegraph @

src/engine/platform/sound/nes_nsfplay/nes_fds.h

raw
1 #ifndef _NES_FDS_H_
2 #define _NES_FDS_H_
3
4 namespace xgm {
5
6 class NES_FDS
7 {
8 public:
9 enum
10 {
11 OPT_CUTOFF=0,
12 OPT_4085_RESET,
13 OPT_WRITE_PROTECT,
14 OPT_END
15 };
16
17 protected:
18 double rate, clock;
19 int mask;
20 int sm[2]; // stereo mix
21 int fout; // current output
22 int option[OPT_END];
23
24 bool master_io;
25 unsigned int master_vol;
26 unsigned int last_freq; // for trackinfo
27 unsigned int last_vol; // for trackinfo
28
29 // two wavetables
30 enum { TMOD=0, TWAV=1 };
31 int wave[2][64];
32 unsigned int freq[2];
33 unsigned int phase[2];
34 bool wav_write;
35 bool wav_halt;
36 bool env_halt;
37 bool mod_halt;
38 unsigned int mod_pos;
39 unsigned int mod_write_pos;
40
41 // two ramp envelopes
42 enum { EMOD=0, EVOL=1 };
43 bool env_mode[2];
44 bool env_disable[2];
45 unsigned int env_timer[2];
46 unsigned int env_speed[2];
47 unsigned int env_out[2];
48 unsigned int master_env_speed;
49
50 // 1-pole RC lowpass filter
51 int rc_accum;
52 int rc_k;
53 int rc_l;
54
55 public:
56 NES_FDS ();
57 ~NES_FDS ();
58
59 void Reset ();
60 void Tick (unsigned int clocks);
61 unsigned int Render (int b[2]);
62 bool Write (unsigned int adr, unsigned int val, unsigned int id=0);
63 bool Read (unsigned int adr, unsigned int & val, unsigned int id=0);
64 void SetRate (double);
65 void SetClock (double);
66 void SetOption (int, int);
67 void SetMask(int m){ mask = m&1; }
68 void SetStereoMix (int trk, short mixl, short mixr);
69 };
70
71 } // namespace xgm
72
73 #endif