42c7b147 |
1 | #include "../../../Pico/sound/ym2612.h"\r |
2 | #include "../helix/pub/mp3dec.h"\r |
cc68a136 |
3 | \r |
4 | enum _940_job_t {\r |
42c7b147 |
5 | JOB940_INITALL = 1,\r |
cc68a136 |
6 | JOB940_YM2612RESETCHIP,\r |
7 | JOB940_YM2612UPDATEONE,\r |
8 | JOB940_PICOSTATELOAD,\r |
42c7b147 |
9 | JOB940_MP3DECODE,\r |
cc68a136 |
10 | JOB940_NUMJOBS\r |
11 | };\r |
12 | \r |
b837b69b |
13 | #define MAX_940JOBS 2\r |
cc68a136 |
14 | \r |
15 | typedef struct\r |
16 | {\r |
42c7b147 |
17 | YM2612 ym2612; /* current state of the emulated YM2612 */\r |
18 | HMP3Decoder mp3dec; /* mp3 decoder's handle */\r |
19 | int mix_buffer[44100/50*2]; /* this is where the YM2612 samples will be mixed to */\r |
20 | short mp3_buffer[2][1152*2]; /* buffers for mp3 decoder's output */\r |
cc68a136 |
21 | } _940_data_t;\r |
22 | \r |
23 | \r |
24 | typedef struct\r |
25 | {\r |
b837b69b |
26 | int jobs[MAX_940JOBS]; /* jobs for second core */\r |
4f265db7 |
27 | int busy_; /* unused */\r |
cc68a136 |
28 | int length; /* number of samples to mix (882 max) */\r |
29 | int stereo; /* mix samples as stereo, doubles sample count automatically */\r |
30 | int baseclock; /* ym2612 settings */\r |
31 | int rate;\r |
32 | int writebuffsel; /* which write buffer to use (from 940 side) */\r |
b837b69b |
33 | UINT16 writebuff0[2048]; /* list of writes to ym2612, 1024 for savestates, 1024 extra */\r |
cc68a136 |
34 | UINT16 writebuff1[2048];\r |
42c7b147 |
35 | int mp3_len; /* data len of loaded mp3 */\r |
36 | int mp3_offs; /* current playback offset (just after last decoded frame) */\r |
37 | int mp3_buffsel; /* which output buffer to decode to */\r |
cc68a136 |
38 | int vstarts[8]; /* debug: number of starts from each of 8 vectors */\r |
39 | int loopc; /* debug: main loop counter */\r |
42c7b147 |
40 | int mp3_errors; /* debug: mp3 decoder's error counter */\r |
41 | int mp3_lasterr; /* debug: mp3 decoder's last error */\r |
4f265db7 |
42 | int last_irq_pc; /* debug: PC value when IRQ happened */\r |
43 | int lastjob; /* debug: last job id */\r |
44 | int lastbusy; /* debug: */\r |
cc68a136 |
45 | } _940_ctl_t;\r |