5797260068e4c3642e33231b1661a543bb4f449e
[picodrive.git] / platform / gp2x / code940 / 940shared.h
1 #include "../../../pico/sound/ym2612.h"\r
2 #include "../../common/helix/pub/mp3dec.h"\r
3 \r
4 // max 16 jobs, lower num means higher prio\r
5 enum _940_job_t {\r
6         JOB940_INITALL = 1,\r
7         JOB940_INVALIDATE_DCACHE,\r
8         JOB940_YM2612RESETCHIP,\r
9         JOB940_YM2612UPDATEONE,\r
10         JOB940_MP3DECODE,\r
11         JOB940_PICOSTATELOAD,\r
12         JOB940_PICOSTATESAVE2,\r
13         JOB940_PICOSTATELOAD2_PREP,\r
14         JOB940_PICOSTATELOAD2,\r
15         JOB940_MP3RESET,\r
16 };\r
17 \r
18 //#define MAX_940JOBS   2\r
19 \r
20 typedef struct\r
21 {\r
22         YM2612  ym2612;                         /* current state of the emulated YM2612 */\r
23         HMP3Decoder mp3dec;                     /* mp3 decoder's handle */\r
24         int     ym_buffer[44100/50*2];          /* this is where the YM2612 samples will be mixed to */\r
25         short   mp3_buffer[2][1152*2];          /* buffers for mp3 decoder's output */\r
26 } _940_data_t;\r
27 \r
28 \r
29 typedef struct\r
30 {\r
31         int             vstarts[8];                             /* debug: 00: number of starts from each of 8 vectors */\r
32         int             last_lr;                                /* debug: 20: last exception's lr */\r
33 //      int             jobs[MAX_940JOBS];                      /* jobs for second core */\r
34 //      int             busy_;                                  /* unused */\r
35         int             length;                                 /* number of samples to mix (882 max) */\r
36         int             stereo;                                 /* mix samples as stereo, doubles sample count automatically */\r
37         int             baseclock;                              /* ym2612 settings */\r
38         int             rate;\r
39         int             writebuffsel;                   /* which write buffer to use (from 940 side) */\r
40         UINT16  writebuff0[2048];                       /* list of writes to ym2612, 1024 for savestates, 1024 extra */\r
41         UINT16  writebuff1[2048];\r
42         int             ym_active_chs;\r
43         int             mp3_len;                        /* data len of loaded mp3 */\r
44         int             mp3_offs;                       /* current playback offset (just after last decoded frame) */\r
45         int             mp3_buffsel;                    /* which output buffer to decode to */\r
46         int             loopc;                          /* debug: main loop counter */\r
47         int             mp3_errors;                     /* debug: mp3 decoder's error counter */\r
48         int             mp3_lasterr;                    /* debug: mp3 decoder's last error */\r
49         int             lastjob;                        /* debug: last job id */\r
50 } _940_ctl_t;\r