int Get_Track_Pos_CDD_c21 (void) { int elapsed_time; _msf MSF; #ifdef DEBUG_CD fprintf (debug_SCD_file, "command 201 : Cur LBA = %d", SCD.Cur_LBA); #endif CHECK_TRAY_OPEN CDD.Status &= 0xFF; if (!CD_Present) { SCD.Status_CDD = NOCD; CDD.Status |= SCD.Status_CDD; } // else if (!(CDC.CTRL.B.B0 & 0x80)) CDD.Status |= SCD.Status_CDD; CDD.Status |= SCD.Status_CDD; elapsed_time = SCD.Cur_LBA - Track_to_LBA (LBA_to_Track (SCD.Cur_LBA)); LBA_to_MSF (elapsed_time - 150, &MSF); #ifdef DEBUG_CD fprintf (debug_SCD_file, " elapsed = %d\n", elapsed_time); #endif CDD.Minute = INT_TO_BCDW (MSF.M); CDD.Seconde = INT_TO_BCDW (MSF.S); CDD.Frame = INT_TO_BCDW (MSF.F); CDD.Ext = 0; CDD_Complete = 1; return 0; }
PICO_INTERNAL int Get_Track_Pos_CDD_c21(void) { int elapsed_time; _msf MSF; cdprintf("command 201 : Cur LBA = %d", Pico_mcd->scd.Cur_LBA); CHECK_TRAY_OPEN Pico_mcd->cdd.Status &= 0xFF; if (!CD_Present) { Pico_mcd->scd.Status_CDD = NOCD; Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD; } // else if (!(CDC.CTRL.B.B0 & 0x80)) Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD; Pico_mcd->cdd.Status |= Pico_mcd->scd.Status_CDD; elapsed_time = Pico_mcd->scd.Cur_LBA - Track_to_LBA(LBA_to_Track(Pico_mcd->scd.Cur_LBA)); LBA_to_MSF(elapsed_time - 150, &MSF); cdprintf(" elapsed = %d", elapsed_time); Pico_mcd->cdd.Minute = INT_TO_BCDW(MSF.M); Pico_mcd->cdd.Seconde = INT_TO_BCDW(MSF.S); Pico_mcd->cdd.Frame = INT_TO_BCDW(MSF.F); Pico_mcd->cdd.Ext = 0; Pico_mcd->scd.CDD_Complete = 1; return 0; }
FILE* GetMP3TrackFile(int trackIndex, int* pDontLeaveFileOpen, int* pWhere_read) { FILE* decodedFile = Tracks[trackIndex].F_decoded; int usePartiallyDecodedFile = 0; char str [1024]; int curTrack = LBA_to_Track(SCD.Cur_LBA); int lbaOffset = SCD.Cur_LBA - Track_to_LBA(curTrack); int lba = lbaOffset; int outRead = 0; int forceNoDecode = 0; int& where_read = *pWhere_read; where_read = (lba) * 588*4 + 16; if(where_read < 0) where_read = 0; #ifdef _WIN32 if(!decodedFile) { Waiting_For_Preload_MP3_Synchronous = true; Preload_MP3(&Tracks[trackIndex].F_decoded, trackIndex); DWORD tgtime = timeGetTime(); //Modif N - give frame advance sound: bool soundCleared = false; sprintf(str, "%s/" PRELOADED_MP3_DIRECTORY PRELOADED_MP3_FILENAME, Gens_Path, trackIndex+1); while(!usePartiallyDecodedFile) { if(!decodedFile) decodedFile = fopen(str, "rb"); if(decodedFile) { int decodedSize; fseek(decodedFile, 0, SEEK_END); decodedSize = ftell(decodedFile); if(decodedSize >= where_read + 588*4) usePartiallyDecodedFile = 1; } if(!usePartiallyDecodedFile && noTracksQueued) { if(decodedFile) fclose(decodedFile); decodedFile = NULL; break; } #ifdef _WIN32 if(!usePartiallyDecodedFile) Sleep(5); #endif // win32 if(!soundCleared && timeGetTime() - tgtime >= 125) //eliminate stutter { int Clear_Sound_Buffer(void); Clear_Sound_Buffer(); soundCleared = true; } } if(!decodedFile) decodedFile = Tracks[trackIndex].F_decoded; Waiting_For_Preload_MP3_Synchronous = false; } #endif // threaded *pDontLeaveFileOpen = usePartiallyDecodedFile; return decodedFile; }