summaryrefslogtreecommitdiff
path: root/apps/codecs/libasap/apokeysnd.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libasap/apokeysnd.c')
-rw-r--r--apps/codecs/libasap/apokeysnd.c920
1 files changed, 460 insertions, 460 deletions
diff --git a/apps/codecs/libasap/apokeysnd.c b/apps/codecs/libasap/apokeysnd.c
index a461fa96da..ead611be5f 100644
--- a/apps/codecs/libasap/apokeysnd.c
+++ b/apps/codecs/libasap/apokeysnd.c
@@ -30,178 +30,178 @@
30#define MUTE_USER 4 30#define MUTE_USER 4
31 31
32CONST_ARRAY(byte, poly4_lookup) 32CONST_ARRAY(byte, poly4_lookup)
33 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1 33 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1
34END_CONST_ARRAY; 34END_CONST_ARRAY;
35CONST_ARRAY(byte, poly5_lookup) 35CONST_ARRAY(byte, poly5_lookup)
36 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 36 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1,
37 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1 37 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1
38END_CONST_ARRAY; 38END_CONST_ARRAY;
39 39
40PRIVATE FUNC(void, PokeySound_InitializeChip, (P(PokeyState PTR, pst))) 40PRIVATE FUNC(void, PokeySound_InitializeChip, (P(PokeyState PTR, pst)))
41{ 41{
42 pst _ audctl = 0; 42 pst _ audctl = 0;
43 pst _ init = FALSE; 43 pst _ init = FALSE;
44 pst _ poly_index = 15 * 31 * 131071; 44 pst _ poly_index = 15 * 31 * 131071;
45 pst _ div_cycles = 28; 45 pst _ div_cycles = 28;
46 pst _ mute1 = MUTE_FREQUENCY | MUTE_USER; 46 pst _ mute1 = MUTE_FREQUENCY | MUTE_USER;
47 pst _ mute2 = MUTE_FREQUENCY | MUTE_USER; 47 pst _ mute2 = MUTE_FREQUENCY | MUTE_USER;
48 pst _ mute3 = MUTE_FREQUENCY | MUTE_USER; 48 pst _ mute3 = MUTE_FREQUENCY | MUTE_USER;
49 pst _ mute4 = MUTE_FREQUENCY | MUTE_USER; 49 pst _ mute4 = MUTE_FREQUENCY | MUTE_USER;
50 pst _ audf1 = 0; 50 pst _ audf1 = 0;
51 pst _ audf2 = 0; 51 pst _ audf2 = 0;
52 pst _ audf3 = 0; 52 pst _ audf3 = 0;
53 pst _ audf4 = 0; 53 pst _ audf4 = 0;
54 pst _ audc1 = 0; 54 pst _ audc1 = 0;
55 pst _ audc2 = 0; 55 pst _ audc2 = 0;
56 pst _ audc3 = 0; 56 pst _ audc3 = 0;
57 pst _ audc4 = 0; 57 pst _ audc4 = 0;
58 pst _ tick_cycle1 = NEVER; 58 pst _ tick_cycle1 = NEVER;
59 pst _ tick_cycle2 = NEVER; 59 pst _ tick_cycle2 = NEVER;
60 pst _ tick_cycle3 = NEVER; 60 pst _ tick_cycle3 = NEVER;
61 pst _ tick_cycle4 = NEVER; 61 pst _ tick_cycle4 = NEVER;
62 pst _ period_cycles1 = 28; 62 pst _ period_cycles1 = 28;
63 pst _ period_cycles2 = 28; 63 pst _ period_cycles2 = 28;
64 pst _ period_cycles3 = 28; 64 pst _ period_cycles3 = 28;
65 pst _ period_cycles4 = 28; 65 pst _ period_cycles4 = 28;
66 pst _ reload_cycles1 = 28; 66 pst _ reload_cycles1 = 28;
67 pst _ reload_cycles3 = 28; 67 pst _ reload_cycles3 = 28;
68 pst _ out1 = 0; 68 pst _ out1 = 0;
69 pst _ out2 = 0; 69 pst _ out2 = 0;
70 pst _ out3 = 0; 70 pst _ out3 = 0;
71 pst _ out4 = 0; 71 pst _ out4 = 0;
72 pst _ delta1 = 0; 72 pst _ delta1 = 0;
73 pst _ delta2 = 0; 73 pst _ delta2 = 0;
74 pst _ delta3 = 0; 74 pst _ delta3 = 0;
75 pst _ delta4 = 0; 75 pst _ delta4 = 0;
76 pst _ skctl = 3; 76 pst _ skctl = 3;
77 ZERO_ARRAY(pst _ delta_buffer); 77 ZERO_ARRAY(pst _ delta_buffer);
78} 78}
79 79
80FUNC(void, PokeySound_Initialize, (P(ASAP_State PTR, ast))) 80FUNC(void, PokeySound_Initialize, (P(ASAP_State PTR, ast)))
81{ 81{
82 V(int, i); 82 V(int, i);
83 V(int, reg); 83 V(int, reg);
84 reg = 0x1ff; 84 reg = 0x1ff;
85 for (i = 0; i < 511; i++) { 85 for (i = 0; i < 511; i++) {
86 reg = ((((reg >> 5) ^ reg) & 1) << 8) + (reg >> 1); 86 reg = ((((reg >> 5) ^ reg) & 1) << 8) + (reg >> 1);
87 ast _ poly9_lookup[i] = TO_BYTE(reg); 87 ast _ poly9_lookup[i] = TO_BYTE(reg);
88 } 88 }
89 reg = 0x1ffff; 89 reg = 0x1ffff;
90 for (i = 0; i < 16385; i++) { 90 for (i = 0; i < 16385; i++) {
91 reg = ((((reg >> 5) ^ reg) & 0xff) << 9) + (reg >> 8); 91 reg = ((((reg >> 5) ^ reg) & 0xff) << 9) + (reg >> 8);
92 ast _ poly17_lookup[i] = TO_BYTE(reg >> 1); 92 ast _ poly17_lookup[i] = TO_BYTE(reg >> 1);
93 } 93 }
94 ast _ sample_offset = 0; 94 ast _ sample_offset = 0;
95 ast _ sample_index = 0; 95 ast _ sample_index = 0;
96 ast _ samples = 0; 96 ast _ samples = 0;
97 ast _ iir_acc_left = 0; 97 ast _ iir_acc_left = 0;
98 ast _ iir_acc_right = 0; 98 ast _ iir_acc_right = 0;
99 PokeySound_InitializeChip(ADDRESSOF ast _ base_pokey); 99 PokeySound_InitializeChip(ADDRESSOF ast _ base_pokey);
100 PokeySound_InitializeChip(ADDRESSOF ast _ extra_pokey); 100 PokeySound_InitializeChip(ADDRESSOF ast _ extra_pokey);
101} 101}
102 102
103#define DO_TICK(ch) \ 103#define DO_TICK(ch) \
104 if (pst _ init) { \ 104 if (pst _ init) { \
105 switch (pst _ audc##ch >> 4) { \ 105 switch (pst _ audc##ch >> 4) { \
106 case 10: \ 106 case 10: \
107 case 14: \ 107 case 14: \
108 pst _ out##ch ^= 1; \ 108 pst _ out##ch ^= 1; \
109 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \ 109 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \
110 break; \ 110 break; \
111 default: \ 111 default: \
112 break; \ 112 break; \
113 } \ 113 } \
114 } \ 114 } \
115 else { \ 115 else { \
116 V(int, poly) = cycle + pst _ poly_index - (ch - 1); \ 116 V(int, poly) = cycle + pst _ poly_index - (ch - 1); \
117 V(int, newout) = pst _ out##ch; \ 117 V(int, newout) = pst _ out##ch; \
118 switch (pst _ audc##ch >> 4) { \ 118 switch (pst _ audc##ch >> 4) { \
119 case 0: \ 119 case 0: \
120 if (poly5_lookup[poly % 31] != 0) { \ 120 if (poly5_lookup[poly % 31] != 0) { \
121 if ((pst _ audctl & 0x80) != 0) \ 121 if ((pst _ audctl & 0x80) != 0) \
122 newout = ast _ poly9_lookup[poly % 511] & 1; \ 122 newout = ast _ poly9_lookup[poly % 511] & 1; \
123 else { \ 123 else { \
124 poly %= 131071; \ 124 poly %= 131071; \
125 newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \ 125 newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \
126 } \ 126 } \
127 } \ 127 } \
128 break; \ 128 break; \
129 case 2: \ 129 case 2: \
130 case 6: \ 130 case 6: \
131 newout ^= poly5_lookup[poly % 31]; \ 131 newout ^= poly5_lookup[poly % 31]; \
132 break; \ 132 break; \
133 case 4: \ 133 case 4: \
134 if (poly5_lookup[poly % 31] != 0) \ 134 if (poly5_lookup[poly % 31] != 0) \
135 newout = poly4_lookup[poly % 15]; \ 135 newout = poly4_lookup[poly % 15]; \
136 break; \ 136 break; \
137 case 8: \ 137 case 8: \
138 if ((pst _ audctl & 0x80) != 0) \ 138 if ((pst _ audctl & 0x80) != 0) \
139 newout = ast _ poly9_lookup[poly % 511] & 1; \ 139 newout = ast _ poly9_lookup[poly % 511] & 1; \
140 else { \ 140 else { \
141 poly %= 131071; \ 141 poly %= 131071; \
142 newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \ 142 newout = (ast _ poly17_lookup[poly >> 3] >> (poly & 7)) & 1; \
143 } \ 143 } \
144 break; \ 144 break; \
145 case 10: \ 145 case 10: \
146 case 14: \ 146 case 14: \
147 newout ^= 1; \ 147 newout ^= 1; \
148 break; \ 148 break; \
149 case 12: \ 149 case 12: \
150 newout = poly4_lookup[poly % 15]; \ 150 newout = poly4_lookup[poly % 15]; \
151 break; \ 151 break; \
152 default: \ 152 default: \
153 break; \ 153 break; \
154 } \ 154 } \
155 if (newout != pst _ out##ch) { \ 155 if (newout != pst _ out##ch) { \
156 pst _ out##ch = newout; \ 156 pst _ out##ch = newout; \
157 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \ 157 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta##ch = -pst _ delta##ch; \
158 } \ 158 } \
159 } 159 }
160 160
161/* Fills delta_buffer up to current_cycle basing on current AUDF/AUDC/AUDCTL values. */ 161/* Fills delta_buffer up to current_cycle basing on current AUDF/AUDC/AUDCTL values. */
162PRIVATE FUNC(void, PokeySound_GenerateUntilCycle, (P(ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, current_cycle))) 162PRIVATE FUNC(void, PokeySound_GenerateUntilCycle, (P(ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, current_cycle)))
163{ 163{
164 for (;;) { 164 for (;;) {
165 V(int, cycle) = current_cycle; 165 V(int, cycle) = current_cycle;
166 if (cycle > pst _ tick_cycle1) 166 if (cycle > pst _ tick_cycle1)
167 cycle = pst _ tick_cycle1; 167 cycle = pst _ tick_cycle1;
168 if (cycle > pst _ tick_cycle2) 168 if (cycle > pst _ tick_cycle2)
169 cycle = pst _ tick_cycle2; 169 cycle = pst _ tick_cycle2;
170 if (cycle > pst _ tick_cycle3) 170 if (cycle > pst _ tick_cycle3)
171 cycle = pst _ tick_cycle3; 171 cycle = pst _ tick_cycle3;
172 if (cycle > pst _ tick_cycle4) 172 if (cycle > pst _ tick_cycle4)
173 cycle = pst _ tick_cycle4; 173 cycle = pst _ tick_cycle4;
174 if (cycle == current_cycle) 174 if (cycle == current_cycle)
175 break; 175 break;
176 if (cycle == pst _ tick_cycle3) { 176 if (cycle == pst _ tick_cycle3) {
177 pst _ tick_cycle3 += pst _ period_cycles3; 177 pst _ tick_cycle3 += pst _ period_cycles3;
178 if ((pst _ audctl & 4) != 0 && pst _ delta1 > 0 && pst _ mute1 == 0) 178 if ((pst _ audctl & 4) != 0 && pst _ delta1 > 0 && pst _ mute1 == 0)
179 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta1 = -pst _ delta1; 179 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta1 = -pst _ delta1;
180 DO_TICK(3); 180 DO_TICK(3);
181 } 181 }
182 if (cycle == pst _ tick_cycle4) { 182 if (cycle == pst _ tick_cycle4) {
183 pst _ tick_cycle4 += pst _ period_cycles4; 183 pst _ tick_cycle4 += pst _ period_cycles4;
184 if ((pst _ audctl & 8) != 0) 184 if ((pst _ audctl & 8) != 0)
185 pst _ tick_cycle3 = cycle + pst _ reload_cycles3; 185 pst _ tick_cycle3 = cycle + pst _ reload_cycles3;
186 if ((pst _ audctl & 2) != 0 && pst _ delta2 > 0 && pst _ mute2 == 0) 186 if ((pst _ audctl & 2) != 0 && pst _ delta2 > 0 && pst _ mute2 == 0)
187 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta2 = -pst _ delta2; 187 pst _ delta_buffer[CYCLE_TO_SAMPLE(cycle)] += pst _ delta2 = -pst _ delta2;
188 DO_TICK(4); 188 DO_TICK(4);
189 } 189 }
190 if (cycle == pst _ tick_cycle1) { 190 if (cycle == pst _ tick_cycle1) {
191 pst _ tick_cycle1 += pst _ period_cycles1; 191 pst _ tick_cycle1 += pst _ period_cycles1;
192 if ((pst _ skctl & 0x88) == 8) /* two-tone, sending 1 (i.e. timer1) */ 192 if ((pst _ skctl & 0x88) == 8) /* two-tone, sending 1 (i.e. timer1) */
193 pst _ tick_cycle2 = cycle + pst _ period_cycles2; 193 pst _ tick_cycle2 = cycle + pst _ period_cycles2;
194 DO_TICK(1); 194 DO_TICK(1);
195 } 195 }
196 if (cycle == pst _ tick_cycle2) { 196 if (cycle == pst _ tick_cycle2) {
197 pst _ tick_cycle2 += pst _ period_cycles2; 197 pst _ tick_cycle2 += pst _ period_cycles2;
198 if ((pst _ audctl & 0x10) != 0) 198 if ((pst _ audctl & 0x10) != 0)
199 pst _ tick_cycle1 = cycle + pst _ reload_cycles1; 199 pst _ tick_cycle1 = cycle + pst _ reload_cycles1;
200 else if ((pst _ skctl & 8) != 0) /* two-tone */ 200 else if ((pst _ skctl & 8) != 0) /* two-tone */
201 pst _ tick_cycle1 = cycle + pst _ period_cycles1; 201 pst _ tick_cycle1 = cycle + pst _ period_cycles1;
202 DO_TICK(2); 202 DO_TICK(2);
203 } 203 }
204 } 204 }
205} 205}
206 206
207#ifdef APOKEYSND 207#ifdef APOKEYSND
@@ -209,351 +209,351 @@ PRIVATE FUNC(void, PokeySound_GenerateUntilCycle, (P(ASAP_State PTR, ast), P(Pok
209#define CURRENT_CYCLE 0 209#define CURRENT_CYCLE 0
210#define CURRENT_SAMPLE 0 210#define CURRENT_SAMPLE 0
211#define DO_STORE(reg) \ 211#define DO_STORE(reg) \
212 if (data == pst _ reg) \ 212 if (data == pst _ reg) \
213 break; \ 213 break; \
214 pst _ reg = data; 214 pst _ reg = data;
215 215
216#else 216#else
217 217
218#define CURRENT_CYCLE ast _ cycle 218#define CURRENT_CYCLE ast _ cycle
219#define CURRENT_SAMPLE CYCLE_TO_SAMPLE(ast _ cycle) 219#define CURRENT_SAMPLE CYCLE_TO_SAMPLE(ast _ cycle)
220#define DO_STORE(reg) \ 220#define DO_STORE(reg) \
221 if (data == pst _ reg) \ 221 if (data == pst _ reg) \
222 break; \ 222 break; \
223 PokeySound_GenerateUntilCycle(ast, pst, ast _ cycle); \ 223 PokeySound_GenerateUntilCycle(ast, pst, ast _ cycle); \
224 pst _ reg = data; 224 pst _ reg = data;
225 225
226#endif /* APOKEYSND */ 226#endif /* APOKEYSND */
227 227
228#define MUTE_CHANNEL(ch, cond, mask) \ 228#define MUTE_CHANNEL(ch, cond, mask) \
229 if (cond) { \ 229 if (cond) { \
230 pst _ mute##ch |= mask; \ 230 pst _ mute##ch |= mask; \
231 pst _ tick_cycle##ch = NEVER; \ 231 pst _ tick_cycle##ch = NEVER; \
232 } \ 232 } \
233 else { \ 233 else { \
234 pst _ mute##ch &= ~mask; \ 234 pst _ mute##ch &= ~mask; \
235 if (pst _ tick_cycle##ch == NEVER && pst _ mute##ch == 0) \ 235 if (pst _ tick_cycle##ch == NEVER && pst _ mute##ch == 0) \
236 pst _ tick_cycle##ch = CURRENT_CYCLE; \ 236 pst _ tick_cycle##ch = CURRENT_CYCLE; \
237 } 237 }
238 238
239#define DO_ULTRASOUND(ch) \ 239#define DO_ULTRASOUND(ch) \
240 MUTE_CHANNEL(ch, pst _ period_cycles##ch <= ULTRASOUND_CYCLES && (pst _ audc##ch >> 4 == 10 || pst _ audc##ch >> 4 == 14), MUTE_FREQUENCY) 240 MUTE_CHANNEL(ch, pst _ period_cycles##ch <= ULTRASOUND_CYCLES && (pst _ audc##ch >> 4 == 10 || pst _ audc##ch >> 4 == 14), MUTE_FREQUENCY)
241 241
242#define DO_AUDC(ch) \ 242#define DO_AUDC(ch) \
243 DO_STORE(audc##ch); \ 243 DO_STORE(audc##ch); \
244 if ((data & 0x10) != 0) { \ 244 if ((data & 0x10) != 0) { \
245 data = (data & 0xf) << DELTA_SHIFT_POKEY; \ 245 data = (data & 0xf) << DELTA_SHIFT_POKEY; \
246 if ((pst _ mute##ch & MUTE_USER) == 0) \ 246 if ((pst _ mute##ch & MUTE_USER) == 0) \
247 pst _ delta_buffer[CURRENT_SAMPLE] \ 247 pst _ delta_buffer[CURRENT_SAMPLE] \
248 += pst _ delta##ch > 0 ? data - pst _ delta##ch : data; \ 248 += pst _ delta##ch > 0 ? data - pst _ delta##ch : data; \
249 pst _ delta##ch = data; \ 249 pst _ delta##ch = data; \
250 } \ 250 } \
251 else { \ 251 else { \
252 data = (data & 0xf) << DELTA_SHIFT_POKEY; \ 252 data = (data & 0xf) << DELTA_SHIFT_POKEY; \
253 DO_ULTRASOUND(ch); \ 253 DO_ULTRASOUND(ch); \
254 if (pst _ delta##ch > 0) { \ 254 if (pst _ delta##ch > 0) { \
255 if ((pst _ mute##ch & MUTE_USER) == 0) \ 255 if ((pst _ mute##ch & MUTE_USER) == 0) \
256 pst _ delta_buffer[CURRENT_SAMPLE] \ 256 pst _ delta_buffer[CURRENT_SAMPLE] \
257 += data - pst _ delta##ch; \ 257 += data - pst _ delta##ch; \
258 pst _ delta##ch = data; \ 258 pst _ delta##ch = data; \
259 } \ 259 } \
260 else \ 260 else \
261 pst _ delta##ch = -data; \ 261 pst _ delta##ch = -data; \
262 } \ 262 } \
263 break; 263 break;
264 264
265#define DO_INIT(ch, cond) \ 265#define DO_INIT(ch, cond) \
266 MUTE_CHANNEL(ch, pst _ init && cond, MUTE_INIT) 266 MUTE_CHANNEL(ch, pst _ init && cond, MUTE_INIT)
267 267
268FUNC(void, PokeySound_PutByte, (P(ASAP_State PTR, ast), P(int, addr), P(int, data))) 268FUNC(void, PokeySound_PutByte, (P(ASAP_State PTR, ast), P(int, addr), P(int, data)))
269{ 269{
270 V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0 270 V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0
271 ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey; 271 ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey;
272 switch (addr & 0xf) { 272 switch (addr & 0xf) {
273 case 0x00: 273 case 0x00:
274 DO_STORE(audf1); 274 DO_STORE(audf1);
275 switch (pst _ audctl & 0x50) { 275 switch (pst _ audctl & 0x50) {
276 case 0x00: 276 case 0x00:
277 pst _ period_cycles1 = pst _ div_cycles * (data + 1); 277 pst _ period_cycles1 = pst _ div_cycles * (data + 1);
278 break; 278 break;
279 case 0x10: 279 case 0x10:
280 pst _ period_cycles2 = pst _ div_cycles * (data + 256 * pst _ audf2 + 1); 280 pst _ period_cycles2 = pst _ div_cycles * (data + 256 * pst _ audf2 + 1);
281 pst _ reload_cycles1 = pst _ div_cycles * (data + 1); 281 pst _ reload_cycles1 = pst _ div_cycles * (data + 1);
282 DO_ULTRASOUND(2); 282 DO_ULTRASOUND(2);
283 break; 283 break;
284 case 0x40: 284 case 0x40:
285 pst _ period_cycles1 = data + 4; 285 pst _ period_cycles1 = data + 4;
286 break; 286 break;
287 case 0x50: 287 case 0x50:
288 pst _ period_cycles2 = data + 256 * pst _ audf2 + 7; 288 pst _ period_cycles2 = data + 256 * pst _ audf2 + 7;
289 pst _ reload_cycles1 = data + 4; 289 pst _ reload_cycles1 = data + 4;
290 DO_ULTRASOUND(2); 290 DO_ULTRASOUND(2);
291 break; 291 break;
292 } 292 }
293 DO_ULTRASOUND(1); 293 DO_ULTRASOUND(1);
294 break; 294 break;
295 case 0x01: 295 case 0x01:
296 DO_AUDC(1) 296 DO_AUDC(1)
297 case 0x02: 297 case 0x02:
298 DO_STORE(audf2); 298 DO_STORE(audf2);
299 switch (pst _ audctl & 0x50) { 299 switch (pst _ audctl & 0x50) {
300 case 0x00: 300 case 0x00:
301 case 0x40: 301 case 0x40:
302 pst _ period_cycles2 = pst _ div_cycles * (data + 1); 302 pst _ period_cycles2 = pst _ div_cycles * (data + 1);
303 break; 303 break;
304 case 0x10: 304 case 0x10:
305 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * data + 1); 305 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * data + 1);
306 break; 306 break;
307 case 0x50: 307 case 0x50:
308 pst _ period_cycles2 = pst _ audf1 + 256 * data + 7; 308 pst _ period_cycles2 = pst _ audf1 + 256 * data + 7;
309 break; 309 break;
310 } 310 }
311 DO_ULTRASOUND(2); 311 DO_ULTRASOUND(2);
312 break; 312 break;
313 case 0x03: 313 case 0x03:
314 DO_AUDC(2) 314 DO_AUDC(2)
315 case 0x04: 315 case 0x04:
316 DO_STORE(audf3); 316 DO_STORE(audf3);
317 switch (pst _ audctl & 0x28) { 317 switch (pst _ audctl & 0x28) {
318 case 0x00: 318 case 0x00:
319 pst _ period_cycles3 = pst _ div_cycles * (data + 1); 319 pst _ period_cycles3 = pst _ div_cycles * (data + 1);
320 break; 320 break;
321 case 0x08: 321 case 0x08:
322 pst _ period_cycles4 = pst _ div_cycles * (data + 256 * pst _ audf4 + 1); 322 pst _ period_cycles4 = pst _ div_cycles * (data + 256 * pst _ audf4 + 1);
323 pst _ reload_cycles3 = pst _ div_cycles * (data + 1); 323 pst _ reload_cycles3 = pst _ div_cycles * (data + 1);
324 DO_ULTRASOUND(4); 324 DO_ULTRASOUND(4);
325 break; 325 break;
326 case 0x20: 326 case 0x20:
327 pst _ period_cycles3 = data + 4; 327 pst _ period_cycles3 = data + 4;
328 break; 328 break;
329 case 0x28: 329 case 0x28:
330 pst _ period_cycles4 = data + 256 * pst _ audf4 + 7; 330 pst _ period_cycles4 = data + 256 * pst _ audf4 + 7;
331 pst _ reload_cycles3 = data + 4; 331 pst _ reload_cycles3 = data + 4;
332 DO_ULTRASOUND(4); 332 DO_ULTRASOUND(4);
333 break; 333 break;
334 } 334 }
335 DO_ULTRASOUND(3); 335 DO_ULTRASOUND(3);
336 break; 336 break;
337 case 0x05: 337 case 0x05:
338 DO_AUDC(3) 338 DO_AUDC(3)
339 case 0x06: 339 case 0x06:
340 DO_STORE(audf4); 340 DO_STORE(audf4);
341 switch (pst _ audctl & 0x28) { 341 switch (pst _ audctl & 0x28) {
342 case 0x00: 342 case 0x00:
343 case 0x20: 343 case 0x20:
344 pst _ period_cycles4 = pst _ div_cycles * (data + 1); 344 pst _ period_cycles4 = pst _ div_cycles * (data + 1);
345 break; 345 break;
346 case 0x08: 346 case 0x08:
347 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * data + 1); 347 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * data + 1);
348 break; 348 break;
349 case 0x28: 349 case 0x28:
350 pst _ period_cycles4 = pst _ audf3 + 256 * data + 7; 350 pst _ period_cycles4 = pst _ audf3 + 256 * data + 7;
351 break; 351 break;
352 } 352 }
353 DO_ULTRASOUND(4); 353 DO_ULTRASOUND(4);
354 break; 354 break;
355 case 0x07: 355 case 0x07:
356 DO_AUDC(4) 356 DO_AUDC(4)
357 case 0x08: 357 case 0x08:
358 DO_STORE(audctl); 358 DO_STORE(audctl);
359 pst _ div_cycles = ((data & 1) != 0) ? 114 : 28; 359 pst _ div_cycles = ((data & 1) != 0) ? 114 : 28;
360 /* TODO: tick_cycles */ 360 /* TODO: tick_cycles */
361 switch (data & 0x50) { 361 switch (data & 0x50) {
362 case 0x00: 362 case 0x00:
363 pst _ period_cycles1 = pst _ div_cycles * (pst _ audf1 + 1); 363 pst _ period_cycles1 = pst _ div_cycles * (pst _ audf1 + 1);
364 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1); 364 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1);
365 break; 365 break;
366 case 0x10: 366 case 0x10:
367 pst _ period_cycles1 = pst _ div_cycles * 256; 367 pst _ period_cycles1 = pst _ div_cycles * 256;
368 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * pst _ audf2 + 1); 368 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf1 + 256 * pst _ audf2 + 1);
369 pst _ reload_cycles1 = pst _ div_cycles * (pst _ audf1 + 1); 369 pst _ reload_cycles1 = pst _ div_cycles * (pst _ audf1 + 1);
370 break; 370 break;
371 case 0x40: 371 case 0x40:
372 pst _ period_cycles1 = pst _ audf1 + 4; 372 pst _ period_cycles1 = pst _ audf1 + 4;
373 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1); 373 pst _ period_cycles2 = pst _ div_cycles * (pst _ audf2 + 1);
374 break; 374 break;
375 case 0x50: 375 case 0x50:
376 pst _ period_cycles1 = 256; 376 pst _ period_cycles1 = 256;
377 pst _ period_cycles2 = pst _ audf1 + 256 * pst _ audf2 + 7; 377 pst _ period_cycles2 = pst _ audf1 + 256 * pst _ audf2 + 7;
378 pst _ reload_cycles1 = pst _ audf1 + 4; 378 pst _ reload_cycles1 = pst _ audf1 + 4;
379 break; 379 break;
380 } 380 }
381 DO_ULTRASOUND(1); 381 DO_ULTRASOUND(1);
382 DO_ULTRASOUND(2); 382 DO_ULTRASOUND(2);
383 switch (data & 0x28) { 383 switch (data & 0x28) {
384 case 0x00: 384 case 0x00:
385 pst _ period_cycles3 = pst _ div_cycles * (pst _ audf3 + 1); 385 pst _ period_cycles3 = pst _ div_cycles * (pst _ audf3 + 1);
386 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1); 386 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1);
387 break; 387 break;
388 case 0x08: 388 case 0x08:
389 pst _ period_cycles3 = pst _ div_cycles * 256; 389 pst _ period_cycles3 = pst _ div_cycles * 256;
390 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * pst _ audf4 + 1); 390 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf3 + 256 * pst _ audf4 + 1);
391 pst _ reload_cycles3 = pst _ div_cycles * (pst _ audf3 + 1); 391 pst _ reload_cycles3 = pst _ div_cycles * (pst _ audf3 + 1);
392 break; 392 break;
393 case 0x20: 393 case 0x20:
394 pst _ period_cycles3 = pst _ audf3 + 4; 394 pst _ period_cycles3 = pst _ audf3 + 4;
395 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1); 395 pst _ period_cycles4 = pst _ div_cycles * (pst _ audf4 + 1);
396 break; 396 break;
397 case 0x28: 397 case 0x28:
398 pst _ period_cycles3 = 256; 398 pst _ period_cycles3 = 256;
399 pst _ period_cycles4 = pst _ audf3 + 256 * pst _ audf4 + 7; 399 pst _ period_cycles4 = pst _ audf3 + 256 * pst _ audf4 + 7;
400 pst _ reload_cycles3 = pst _ audf3 + 4; 400 pst _ reload_cycles3 = pst _ audf3 + 4;
401 break; 401 break;
402 } 402 }
403 DO_ULTRASOUND(3); 403 DO_ULTRASOUND(3);
404 DO_ULTRASOUND(4); 404 DO_ULTRASOUND(4);
405 DO_INIT(1, (data & 0x40) == 0); 405 DO_INIT(1, (data & 0x40) == 0);
406 DO_INIT(2, (data & 0x50) != 0x50); 406 DO_INIT(2, (data & 0x50) != 0x50);
407 DO_INIT(3, (data & 0x20) == 0); 407 DO_INIT(3, (data & 0x20) == 0);
408 DO_INIT(4, (data & 0x28) != 0x28); 408 DO_INIT(4, (data & 0x28) != 0x28);
409 break; 409 break;
410 case 0x09: 410 case 0x09:
411 /* TODO: STIMER */ 411 /* TODO: STIMER */
412 break; 412 break;
413 case 0x0f: 413 case 0x0f:
414 DO_STORE(skctl); 414 DO_STORE(skctl);
415 pst _ init = ((data & 3) == 0); 415 pst _ init = ((data & 3) == 0);
416 DO_INIT(1, (pst _ audctl & 0x40) == 0); 416 DO_INIT(1, (pst _ audctl & 0x40) == 0);
417 DO_INIT(2, (pst _ audctl & 0x50) != 0x50); 417 DO_INIT(2, (pst _ audctl & 0x50) != 0x50);
418 DO_INIT(3, (pst _ audctl & 0x20) == 0); 418 DO_INIT(3, (pst _ audctl & 0x20) == 0);
419 DO_INIT(4, (pst _ audctl & 0x28) != 0x28); 419 DO_INIT(4, (pst _ audctl & 0x28) != 0x28);
420 break; 420 break;
421 default: 421 default:
422 break; 422 break;
423 } 423 }
424} 424}
425 425
426FUNC(int, PokeySound_GetRandom, (P(ASAP_State PTR, ast), P(int, addr), P(int, cycle))) 426FUNC(int, PokeySound_GetRandom, (P(ASAP_State PTR, ast), P(int, addr), P(int, cycle)))
427{ 427{
428 V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0 428 V(PokeyState PTR, pst) = (addr & ast _ extra_pokey_mask) != 0
429 ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey; 429 ? ADDRESSOF ast _ extra_pokey : ADDRESSOF ast _ base_pokey;
430 V(int, i); 430 V(int, i);
431 if (pst _ init) 431 if (pst _ init)
432 return 0xff; 432 return 0xff;
433 i = cycle + pst _ poly_index; 433 i = cycle + pst _ poly_index;
434 if ((pst _ audctl & 0x80) != 0) 434 if ((pst _ audctl & 0x80) != 0)
435 return ast _ poly9_lookup[i % 511]; 435 return ast _ poly9_lookup[i % 511];
436 else { 436 else {
437 V(int, j); 437 V(int, j);
438 i %= 131071; 438 i %= 131071;
439 j = i >> 3; 439 j = i >> 3;
440 i &= 7; 440 i &= 7;
441 return ((ast _ poly17_lookup[j] >> i) + (ast _ poly17_lookup[j + 1] << (8 - i))) & 0xff; 441 return ((ast _ poly17_lookup[j] >> i) + (ast _ poly17_lookup[j + 1] << (8 - i))) & 0xff;
442 } 442 }
443} 443}
444 444
445PRIVATE FUNC(void, end_frame, (P(ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, cycle_limit))) 445PRIVATE FUNC(void, end_frame, (P(ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, cycle_limit)))
446{ 446{
447 V(int, m); 447 V(int, m);
448 PokeySound_GenerateUntilCycle(ast, pst, cycle_limit); 448 PokeySound_GenerateUntilCycle(ast, pst, cycle_limit);
449 pst _ poly_index += cycle_limit; 449 pst _ poly_index += cycle_limit;
450 m = ((pst _ audctl & 0x80) != 0) ? 15 * 31 * 511 : 15 * 31 * 131071; 450 m = ((pst _ audctl & 0x80) != 0) ? 15 * 31 * 511 : 15 * 31 * 131071;
451 if (pst _ poly_index >= 2 * m) 451 if (pst _ poly_index >= 2 * m)
452 pst _ poly_index -= m; 452 pst _ poly_index -= m;
453 if (pst _ tick_cycle1 != NEVER) 453 if (pst _ tick_cycle1 != NEVER)
454 pst _ tick_cycle1 -= cycle_limit; 454 pst _ tick_cycle1 -= cycle_limit;
455 if (pst _ tick_cycle2 != NEVER) 455 if (pst _ tick_cycle2 != NEVER)
456 pst _ tick_cycle2 -= cycle_limit; 456 pst _ tick_cycle2 -= cycle_limit;
457 if (pst _ tick_cycle3 != NEVER) 457 if (pst _ tick_cycle3 != NEVER)
458 pst _ tick_cycle3 -= cycle_limit; 458 pst _ tick_cycle3 -= cycle_limit;
459 if (pst _ tick_cycle4 != NEVER) 459 if (pst _ tick_cycle4 != NEVER)
460 pst _ tick_cycle4 -= cycle_limit; 460 pst _ tick_cycle4 -= cycle_limit;
461} 461}
462 462
463FUNC(void, PokeySound_StartFrame, (P(ASAP_State PTR, ast))) 463FUNC(void, PokeySound_StartFrame, (P(ASAP_State PTR, ast)))
464{ 464{
465 ZERO_ARRAY(ast _ base_pokey.delta_buffer); 465 ZERO_ARRAY(ast _ base_pokey.delta_buffer);
466 if (ast _ extra_pokey_mask != 0) 466 if (ast _ extra_pokey_mask != 0)
467 ZERO_ARRAY(ast _ extra_pokey.delta_buffer); 467 ZERO_ARRAY(ast _ extra_pokey.delta_buffer);
468} 468}
469 469
470FUNC(void, PokeySound_EndFrame, (P(ASAP_State PTR, ast), P(int, current_cycle))) 470FUNC(void, PokeySound_EndFrame, (P(ASAP_State PTR, ast), P(int, current_cycle)))
471{ 471{
472 end_frame(ast, ADDRESSOF ast _ base_pokey, current_cycle); 472 end_frame(ast, ADDRESSOF ast _ base_pokey, current_cycle);
473 if (ast _ extra_pokey_mask != 0) 473 if (ast _ extra_pokey_mask != 0)
474 end_frame(ast, ADDRESSOF ast _ extra_pokey, current_cycle); 474 end_frame(ast, ADDRESSOF ast _ extra_pokey, current_cycle);
475 ast _ sample_offset += current_cycle * ASAP_SAMPLE_RATE; 475 ast _ sample_offset += current_cycle * ASAP_SAMPLE_RATE;
476 ast _ sample_index = 0; 476 ast _ sample_index = 0;
477 ast _ samples = TO_INT(ast _ sample_offset / ASAP_MAIN_CLOCK); 477 ast _ samples = TO_INT(ast _ sample_offset / ASAP_MAIN_CLOCK);
478 ast _ sample_offset %= ASAP_MAIN_CLOCK; 478 ast _ sample_offset %= ASAP_MAIN_CLOCK;
479} 479}
480 480
481/* Fills buffer with samples from delta_buffer. */ 481/* Fills buffer with samples from delta_buffer. */
482FUNC(int, PokeySound_Generate, (P(ASAP_State PTR, ast), P(BYTEARRAY, buffer), P(int, buffer_offset), P(int, blocks), P(ASAP_SampleFormat, format))) 482FUNC(int, PokeySound_Generate, (P(ASAP_State PTR, ast), P(BYTEARRAY, buffer), P(int, buffer_offset), P(int, blocks), P(ASAP_SampleFormat, format)))
483{ 483{
484 V(int, i) = ast _ sample_index; 484 V(int, i) = ast _ sample_index;
485 V(int, samples) = ast _ samples; 485 V(int, samples) = ast _ samples;
486 V(int, acc_left) = ast _ iir_acc_left; 486 V(int, acc_left) = ast _ iir_acc_left;
487 V(int, acc_right) = ast _ iir_acc_right; 487 V(int, acc_right) = ast _ iir_acc_right;
488 if (blocks < samples - i) 488 if (blocks < samples - i)
489 samples = i + blocks; 489 samples = i + blocks;
490 else 490 else
491 blocks = samples - i; 491 blocks = samples - i;
492 for (; i < samples; i++) { 492 for (; i < samples; i++) {
493#ifdef ACTIONSCRIPT 493#ifdef ACTIONSCRIPT
494 acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10); 494 acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10);
495 var sample : Number = acc_left / 33553408; 495 var sample : Number = acc_left / 33553408;
496 buffer.writeFloat(sample); 496 buffer.writeFloat(sample);
497 if (ast.extra_pokey_mask != 0) { 497 if (ast.extra_pokey_mask != 0) {
498 acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10); 498 acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10);
499 sample = acc_right / 33553408; 499 sample = acc_right / 33553408;
500 } 500 }
501 buffer.writeFloat(sample); 501 buffer.writeFloat(sample);
502#else 502#else
503 V(int, sample); 503 V(int, sample);
504 acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10); 504 acc_left += ast _ base_pokey.delta_buffer[i] - (acc_left * 3 >> 10);
505 sample = acc_left >> 10; 505 sample = acc_left >> 10;
506#define STORE_SAMPLE \ 506#define STORE_SAMPLE \
507 if (sample < -32767) \ 507 if (sample < -32767) \
508 sample = -32767; \ 508 sample = -32767; \
509 else if (sample > 32767) \ 509 else if (sample > 32767) \
510 sample = 32767; \ 510 sample = 32767; \
511 switch (format) { \ 511 switch (format) { \
512 case ASAP_FORMAT_U8: \ 512 case ASAP_FORMAT_U8: \
513 buffer[buffer_offset++] = CAST(byte) ((sample >> 8) + 128); \ 513 buffer[buffer_offset++] = CAST(byte) ((sample >> 8) + 128); \
514 break; \ 514 break; \
515 case ASAP_FORMAT_S16_LE: \ 515 case ASAP_FORMAT_S16_LE: \
516 buffer[buffer_offset++] = TO_BYTE(sample); \ 516 buffer[buffer_offset++] = TO_BYTE(sample); \
517 buffer[buffer_offset++] = TO_BYTE(sample >> 8); \ 517 buffer[buffer_offset++] = TO_BYTE(sample >> 8); \
518 break; \ 518 break; \
519 case ASAP_FORMAT_S16_BE: \ 519 case ASAP_FORMAT_S16_BE: \
520 buffer[buffer_offset++] = TO_BYTE(sample >> 8); \ 520 buffer[buffer_offset++] = TO_BYTE(sample >> 8); \
521 buffer[buffer_offset++] = TO_BYTE(sample); \ 521 buffer[buffer_offset++] = TO_BYTE(sample); \
522 break; \ 522 break; \
523 } 523 }
524 STORE_SAMPLE; 524 STORE_SAMPLE;
525 if (ast _ extra_pokey_mask != 0) { 525 if (ast _ extra_pokey_mask != 0) {
526 acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10); 526 acc_right += ast _ extra_pokey.delta_buffer[i] - (acc_right * 3 >> 10);
527 sample = acc_right >> 10; 527 sample = acc_right >> 10;
528 STORE_SAMPLE; 528 STORE_SAMPLE;
529 } 529 }
530#endif /* ACTIONSCRIPT */ 530#endif /* ACTIONSCRIPT */
531 } 531 }
532 if (i == ast _ samples) { 532 if (i == ast _ samples) {
533 acc_left += ast _ base_pokey.delta_buffer[i]; 533 acc_left += ast _ base_pokey.delta_buffer[i];
534 acc_right += ast _ extra_pokey.delta_buffer[i]; 534 acc_right += ast _ extra_pokey.delta_buffer[i];
535 } 535 }
536 ast _ sample_index = i; 536 ast _ sample_index = i;
537 ast _ iir_acc_left = acc_left; 537 ast _ iir_acc_left = acc_left;
538 ast _ iir_acc_right = acc_right; 538 ast _ iir_acc_right = acc_right;
539#ifdef APOKEYSND 539#ifdef APOKEYSND
540 return buffer_offset; 540 return buffer_offset;
541#else 541#else
542 return blocks; 542 return blocks;
543#endif 543#endif
544} 544}
545 545
546FUNC(abool, PokeySound_IsSilent, (P(CONST PokeyState PTR, pst))) 546FUNC(abool, PokeySound_IsSilent, (P(CONST PokeyState PTR, pst)))
547{ 547{
548 return ((pst _ audc1 | pst _ audc2 | pst _ audc3 | pst _ audc4) & 0xf) == 0; 548 return ((pst _ audc1 | pst _ audc2 | pst _ audc3 | pst _ audc4) & 0xf) == 0;
549} 549}
550 550
551FUNC(void, PokeySound_Mute, (P(CONST ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, mask))) 551FUNC(void, PokeySound_Mute, (P(CONST ASAP_State PTR, ast), P(PokeyState PTR, pst), P(int, mask)))
552{ 552{
553 MUTE_CHANNEL(1, (mask & 1) != 0, MUTE_USER); 553 MUTE_CHANNEL(1, (mask & 1) != 0, MUTE_USER);
554 MUTE_CHANNEL(2, (mask & 2) != 0, MUTE_USER); 554 MUTE_CHANNEL(2, (mask & 2) != 0, MUTE_USER);
555 MUTE_CHANNEL(3, (mask & 4) != 0, MUTE_USER); 555 MUTE_CHANNEL(3, (mask & 4) != 0, MUTE_USER);
556 MUTE_CHANNEL(4, (mask & 8) != 0, MUTE_USER); 556 MUTE_CHANNEL(4, (mask & 8) != 0, MUTE_USER);
557} 557}
558 558
559#ifdef APOKEYSND 559#ifdef APOKEYSND
@@ -562,37 +562,37 @@ static ASAP_State asap;
562 562
563__declspec(dllexport) void APokeySound_Initialize(abool stereo) 563__declspec(dllexport) void APokeySound_Initialize(abool stereo)
564{ 564{
565 asap.extra_pokey_mask = stereo ? 0x10 : 0; 565 asap.extra_pokey_mask = stereo ? 0x10 : 0;
566 PokeySound_Initialize(&asap); 566 PokeySound_Initialize(&asap);
567 PokeySound_Mute(&asap, &asap.base_pokey, 0); 567 PokeySound_Mute(&asap, &asap.base_pokey, 0);
568 PokeySound_Mute(&asap, &asap.extra_pokey, 0); 568 PokeySound_Mute(&asap, &asap.extra_pokey, 0);
569 PokeySound_StartFrame(&asap); 569 PokeySound_StartFrame(&asap);
570} 570}
571 571
572__declspec(dllexport) void APokeySound_PutByte(int addr, int data) 572__declspec(dllexport) void APokeySound_PutByte(int addr, int data)
573{ 573{
574 PokeySound_PutByte(&asap, addr, data); 574 PokeySound_PutByte(&asap, addr, data);
575} 575}
576 576
577__declspec(dllexport) int APokeySound_GetRandom(int addr, int cycle) 577__declspec(dllexport) int APokeySound_GetRandom(int addr, int cycle)
578{ 578{
579 return PokeySound_GetRandom(&asap, addr, cycle); 579 return PokeySound_GetRandom(&asap, addr, cycle);
580} 580}
581 581
582__declspec(dllexport) int APokeySound_Generate(int cycles, byte buffer[], ASAP_SampleFormat format) 582__declspec(dllexport) int APokeySound_Generate(int cycles, byte buffer[], ASAP_SampleFormat format)
583{ 583{
584 int len; 584 int len;
585 PokeySound_EndFrame(&asap, cycles); 585 PokeySound_EndFrame(&asap, cycles);
586 len = PokeySound_Generate(&asap, buffer, 0, asap.samples, format); 586 len = PokeySound_Generate(&asap, buffer, 0, asap.samples, format);
587 PokeySound_StartFrame(&asap); 587 PokeySound_StartFrame(&asap);
588 return len; 588 return len;
589} 589}
590 590
591__declspec(dllexport) void APokeySound_About(const char **name, const char **author, const char **description) 591__declspec(dllexport) void APokeySound_About(const char **name, const char **author, const char **description)
592{ 592{
593 *name = "Another POKEY sound emulator, v" ASAP_VERSION; 593 *name = "Another POKEY sound emulator, v" ASAP_VERSION;
594 *author = "Piotr Fusik, (C) " ASAP_YEARS; 594 *author = "Piotr Fusik, (C) " ASAP_YEARS;
595 *description = "Part of ASAP, http://asap.sourceforge.net"; 595 *description = "Part of ASAP, http://asap.sourceforge.net";
596} 596}
597 597
598#endif /* APOKEYSND */ 598#endif /* APOKEYSND */