void getMP3METagInfo(char *filename, struct fileInfo *targetInfo){ //ID3: struct ID3Tag ID3; strcpy(MP3ME_fileName, filename); ParseID3(filename, &ID3); strcpy(targetInfo->title, ID3.ID3Title); strcpy(targetInfo->artist, ID3.ID3Artist); strcpy(targetInfo->album, ID3.ID3Album); strcpy(targetInfo->year, ID3.ID3Year); strcpy(targetInfo->genre, ID3.ID3GenreText); strcpy(targetInfo->trackNumber, ID3.ID3TrackText); targetInfo->length = ID3.ID3Length; targetInfo->encapsulatedPictureType = ID3.ID3EncapsulatedPictureType; targetInfo->encapsulatedPictureOffset = ID3.ID3EncapsulatedPictureOffset; targetInfo->encapsulatedPictureLength = ID3.ID3EncapsulatedPictureLength; MP3ME_info = *targetInfo; MP3ME_tagRead = 1; }
void MP3Play(char * path) { struct ID3Tag ID3; nowplaying = oslLoadImageFilePNG(nowplayingBgPath, OSL_IN_RAM, OSL_PF_8888); mp3Play = oslLoadImageFilePNG("system/app/apollo/play.png", OSL_IN_RAM, OSL_PF_8888); mp3Pause = oslLoadImageFilePNG("system/app/apollo/pause.png", OSL_IN_RAM, OSL_PF_8888); if (!nowplaying) debugDisplay(); scePowerSetClockFrequency(333, 333, 166); pspAudioInit(); int i, mp3Min = 0; MP3ME_Init(1); ParseID3(path, &ID3); MP3ME_Load(path); MP3ME_Play(); isPlaying = 1; while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); oslReadKeys(); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); if (MP3ME_playingTime > 59) { mp3Min += 1; MP3ME_playingTime = 0; } oslDrawImageXY(nowplaying, 0, 0); oslDrawStringf(240,76, "Playing: %.19s", folderIcons[current].name); oslDrawStringf(240,96, "Title: %.21s", ID3.ID3Title); oslDrawStringf(240,116, "Artist: %.20s", ID3.ID3Artist); oslDrawStringf(240,136, "Album: %.21s", ID3.ID3Album); oslDrawStringf(240,156, "Year: %.22s", ID3.ID3Year); oslDrawStringf(240,176, "Genre: %.21s", ID3.ID3GenreText); oslDrawStringf(435,206, "0%d:%.f", mp3Min, MP3ME_playingTime); if (MP3ME_isPlaying == 1) oslDrawImageXY(mp3Play, 230, 224); if (MP3ME_isPlaying == 0) oslDrawImageXY(mp3Pause, 230, 224); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); if(osl_keys->pressed.select) { oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return; } if(MP3ME_isPlaying == 1 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); MP3ME_Pause(); for(i=0; i<10; i++) { sceDisplayWaitVblankStart(); } } else if (MP3ME_isPlaying == 0 && osl_keys->pressed.cross) { MP3ME_Play(); } if (MP3ME_EndOfStream() == 1) { isPlaying = 0; endAudioLib(); MP3ME_Stop(); releaseAudio(); MP3ME_Play(); } if(osl_keys->pressed.circle) { endAudioLib(); MP3ME_Stop(); releaseAudio(); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); isPlaying = 0; setCpuBoot(); //Restore previous CPU state return; } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } }