Debian Codegraph @

src/engine/platform/sound/pokey/mzpokeysnd.h

raw symbols SCIP
1 #ifndef MZPOKEYSND_H_
2 #define MZPOKEYSND_H_
3
4 #include <stdlib.h>
5
6 struct stPokeyState;
7
8 typedef int (*readout_t)(struct stPokeyState* ps);
9 typedef void (*event_t)(struct stPokeyState* ps, int p5v, int p4v, int p917v);
10
11 #ifdef NONLINEAR_MIXING
12 /* Change queue event value type */
13 typedef double qev_t;
14 #else
15 typedef unsigned char qev_t;
16 #endif
17
18 /* State variables for single Pokey Chip */
19 typedef struct stPokeyState
20 {
21 int curtick;
22 /* Poly positions */
23 int poly4pos;
24 int poly5pos;
25 int poly17pos;
26 int poly9pos;
27
28 /* Main divider (64khz/15khz) */
29 int mdivk; /* 28 for 64khz, 114 for 15khz */
30
31 /* Main switches */
32 int selpoly9;
33 int c0_hf;
34 int c1_f0;
35 int c2_hf;
36 int c3_f2;
37
38 /* SKCTL for two-tone mode */
39 int skctl;
40
41 /* Main output state */
42 qev_t outvol_all;
43 int forcero; /* Force readout */
44
45 /* channel 0 state */
46
47 readout_t readout_0;
48 event_t event_0;
49
50 int c0divpos;
51 int c0divstart; /* AUDF0 recalculated */
52 int c0divstart_p; /* start value when c1_f0 */
53 int c0diva; /* AUDF0 register */
54
55 int c0t1; /* D - 5bit, Q goes to sw3 */
56 int c0t2; /* D - out sw2, Q goes to sw4 and t3 */
57 int c0t3; /* D - out t2, q goes to xor */
58
59 int c0sw1; /* in1 - 4bit, in2 - 17bit, out goes to sw2 */
60 int c0sw2; /* in1 - /Q t2, in2 - out sw1, out goes to t2 */
61 int c0sw3; /* in1 - +5, in2 - Q t1, out goes to C t2 */
62 int c0sw4; /* hi-pass sw */
63 int c0vo; /* volume only */
64
65 #ifndef NONLINEAR_MIXING
66 int c0stop; /* channel counter stopped */
67 #endif
68
69 int vol0;
70
71 int outvol_0;
72
73 /* channel 1 state */
74
75 readout_t readout_1;
76 event_t event_1;
77
78 int c1divpos;
79 int c1divstart;
80 int c1diva;
81
82 int c1t1;
83 int c1t2;
84 int c1t3;
85
86 int c1sw1;
87 int c1sw2;
88 int c1sw3;
89 int c1sw4;
90 int c1vo;
91
92 #ifndef NONLINEAR_MIXING
93 int c1stop; /* channel counter stopped */
94 #endif
95
96 int vol1;
97
98 int outvol_1;
99
100 /* channel 2 state */
101
102 readout_t readout_2;
103 event_t event_2;
104
105 int c2divpos;
106 int c2divstart;
107 int c2divstart_p; /* start value when c1_f0 */
108 int c2diva;
109
110 int c2t1;
111 int c2t2;
112
113 int c2sw1;
114 int c2sw2;
115 int c2sw3;
116 int c2vo;
117
118 #ifndef NONLINEAR_MIXING
119 int c2stop; /* channel counter stopped */
120 #endif
121
122 int vol2;
123
124 int outvol_2;
125
126 /* channel 3 state */
127
128 readout_t readout_3;
129 event_t event_3;
130
131 int c3divpos;
132 int c3divstart;
133 int c3diva;
134
135 int c3t1;
136 int c3t2;
137
138 int c3sw1;
139 int c3sw2;
140 int c3sw3;
141 int c3vo;
142
143 #ifndef NONLINEAR_MIXING
144 int c3stop; /* channel counter stopped */
145 #endif
146
147 int vol3;
148
149 int outvol_3;
150 } PokeyState;
151
152 void mzpokeysnd_process_16(PokeyState* ps, void* sndbuffer, int sndn);
153 void Update_pokey_sound_mz(PokeyState* ps, unsigned short addr, unsigned char val, unsigned char gain);
154
155 void ResetPokeyState(PokeyState* ps);
156
157 int MZPOKEYSND_Init(PokeyState* ps);
158
159 #endif /* MZPOKEYSND_H_ */