- switch (shared_ctl->jobs[job_num])\r
- {\r
- case JOB940_INITALL:\r
- /* ym2612 */\r
- shared_ctl->writebuff0[0] = shared_ctl->writebuff1[0] = 0xffff;\r
- YM2612Init_(shared_ctl->baseclock, shared_ctl->rate);\r
- /* Helix mp3 decoder */\r
- shared_data->mp3dec = MP3InitDecoder();\r
- break;\r
-\r
- case JOB940_YM2612RESETCHIP:\r
- YM2612ResetChip_();\r
- break;\r
-\r
- case JOB940_PICOSTATELOAD:\r
- YM2612PicoStateLoad_();\r
- break;\r
-\r
- case JOB940_YM2612UPDATEONE: {\r
- int i, dw, *wbuff;\r
- if (shared_ctl->writebuffsel == 1) {\r
- wbuff = (int *) shared_ctl->writebuff1;\r
- } else {\r
- wbuff = (int *) shared_ctl->writebuff0;\r
- }\r
-\r
- /* playback all writes */\r
- for (i = 2048/2; i > 0; i--) {\r
- UINT16 d;\r
- dw = *wbuff++;\r
- d = dw;\r
- if (d == 0xffff) break;\r
- YM2612Write_(d >> 8, d);\r
- d = (dw>>16);\r
- if (d == 0xffff) break;\r
- YM2612Write_(d >> 8, d);\r
- }\r
-\r
- YM2612UpdateOne_(0, shared_ctl->length, shared_ctl->stereo);\r
- break;\r
- }\r
-\r
- case JOB940_MP3DECODE: {\r
- int mp3_offs = shared_ctl->mp3_offs;\r
- unsigned char *readPtr = mp3_data + mp3_offs;\r
- int bytesLeft = shared_ctl->mp3_len - mp3_offs;\r
- int offset; // frame offset from readPtr\r
- int err;\r
-\r
- if (bytesLeft <= 0) break; // EOF, nothing to do\r
-\r
- offset = MP3FindSyncWord(readPtr, bytesLeft);\r
- if (offset < 0) {\r
- shared_ctl->mp3_offs = shared_ctl->mp3_len;\r
- break; // EOF\r
- }\r
- readPtr += offset;\r
- bytesLeft -= offset;\r
-\r
- err = MP3Decode(shared_data->mp3dec, &readPtr, &bytesLeft,\r
- shared_data->mp3_buffer[shared_ctl->mp3_buffsel], 0);\r
- if (err) {\r
- if (err == ERR_MP3_INDATA_UNDERFLOW) {\r
- shared_ctl->mp3_offs = shared_ctl->mp3_len; // EOF\r
- break;\r
- } else if (err <= -6 && err >= -12) {\r
- // ERR_MP3_INVALID_FRAMEHEADER, ERR_MP3_INVALID_*\r
- // just try to skip the offending frame..\r
- readPtr++;\r
- }\r
- shared_ctl->mp3_errors++;\r
- shared_ctl->mp3_lasterr = err;\r
- }\r
- shared_ctl->mp3_offs = readPtr - mp3_data;\r
- break;\r
- }\r
- }\r
+ case JOB940_INITALL:\r
+ /* ym2612 */\r
+ shared_ctl->writebuff0[0] = shared_ctl->writebuff1[0] = 0xffff;\r
+ YM2612Init_(shared_ctl->baseclock, shared_ctl->rate);\r
+ /* Helix mp3 decoder */\r
+ shared_data->mp3dec = MP3InitDecoder();\r
+ break;\r
+\r
+ case JOB940_INVALIDATE_DCACHE:\r
+ drain_wb();\r
+ dcache_clean_flush();\r
+ break;\r
+\r
+ case JOB940_YM2612RESETCHIP:\r
+ YM2612ResetChip_();\r
+ break;\r
+\r
+ case JOB940_PICOSTATELOAD:\r
+ YM2612PicoStateLoad_();\r
+ break;\r
+\r
+ case JOB940_PICOSTATESAVE2:\r
+ YM2612PicoStateSave2(0, 0);\r
+ _memcpy(shared_ctl->writebuff0, ym2612_940->REGS, 0x200);\r
+ break;\r
+\r
+ case JOB940_PICOSTATELOAD2_PREP:\r
+ ym_flush_writes();\r
+ break;\r
+\r
+ case JOB940_PICOSTATELOAD2:\r
+ _memcpy(ym2612_940->REGS, shared_ctl->writebuff0, 0x200);\r
+ YM2612PicoStateLoad2(0, 0);\r
+ break;\r
+\r
+ case JOB940_YM2612UPDATEONE:\r
+ ym_update(ym_buffer);\r
+ break;\r
+\r
+ case JOB940_MP3DECODE:\r
+ mp3_decode();\r
+ break;\r
+\r
+ case JOB940_MP3RESET:\r
+ if (shared_data->mp3dec) MP3FreeDecoder(shared_data->mp3dec);\r
+ shared_data->mp3dec = MP3InitDecoder();\r
+ break;\r