X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2F940ctl.c;h=4bfd043c73b2dd907f14cb896b07ed632b5b5cd1;hb=e99d80480196f551f7e6c06deae3750de19b4c0e;hp=38a9f9dd321c0f6c89bf597937f54ca40da50864;hpb=b79118011b8b1ac835efed1ac5a9ce3bdc55c158;p=libpicofe.git diff --git a/gp2x/940ctl.c b/gp2x/940ctl.c index 38a9f9d..4bfd043 100644 --- a/gp2x/940ctl.c +++ b/gp2x/940ctl.c @@ -275,8 +275,6 @@ void sharedmem940_finish(void) } -extern char **g_argv; - void YM2612Init_940(int baseclock, int rate) { printf("YM2612Init_940()\n"); @@ -405,24 +403,24 @@ int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty) } +/***********************************************************/ + static int mp3_samples_ready = 0, mp3_buffer_offs = 0; static int mp3_play_bufsel = 0, mp3_job_started = 0; void mp3_update(int *buffer, int length, int stereo) { int length_mp3; - int cdda_on; - // playback was started, track not ended - cdda_on = loaded_mp3 && shared_ctl->mp3_offs < shared_ctl->mp3_len; - - if (!cdda_on) return; - - if (!(PicoOpt&0x200)) { + if (!(PicoOpt & POPT_EXT_FM)) { mp3_update_local(buffer, length, stereo); return; } + // check if playback was started, track not ended + if (loaded_mp3 == NULL || shared_ctl->mp3_offs >= shared_ctl->mp3_len) + return; + length_mp3 = length; if (PsndRate == 22050) length_mp3 <<= 1; // mp3s are locked to 44100Hz stereo else if (PsndRate == 11025) length_mp3 <<= 2; // so make length 44100ish @@ -475,13 +473,16 @@ void mp3_update(int *buffer, int length, int stereo) } -/***********************************************************/ - -void mp3_start_play(FILE *f, int pos) // pos is 0-1023 +void mp3_start_play(void *f_, int pos) // pos is 0-1023 { int byte_offs = 0; + FILE *f = f_; + + if (!(PicoOpt & POPT_EN_MCD_CDDA) || f == NULL) + return; - if (!(PicoOpt&0x800)) { // cdda disabled? + if (!(PicoOpt & POPT_EXT_FM)) { + mp3_start_play_local(f, pos); return; } @@ -522,31 +523,7 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023 mp3_job_started = 0; shared_ctl->mp3_buffsel = 1; // will change to 0 on first decode - if (PicoOpt & POPT_EXT_FM) - { - add_job_940(JOB940_MP3RESET); - if (CHECK_BUSY(JOB940_MP3RESET)) wait_busy_940(JOB940_MP3RESET); - } - else - mp3_start_local(); + add_job_940(JOB940_MP3RESET); + if (CHECK_BUSY(JOB940_MP3RESET)) wait_busy_940(JOB940_MP3RESET); } - -int mp3_get_offset(void) -{ - unsigned int offs1024 = 0; - int cdda_on; - - cdda_on = (PicoAHW & PAHW_MCD) && (PicoOpt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) && - (Pico_mcd->scd.Status_CDC & 1) && loaded_mp3; - - if (cdda_on) { - offs1024 = shared_ctl->mp3_offs << 7; - offs1024 /= shared_ctl->mp3_len >> 3; - } - printf("offs1024=%u (%i/%i)\n", offs1024, shared_ctl->mp3_offs, shared_ctl->mp3_len); - - return offs1024; -} - -