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