void mp3_seek_set(const char *name, UINT32 frame) { if (mp3_thread >= 0) { strcpy(MP3_file, name); mp3_stop(); if ((mp3_fd = sceIoOpen(MP3_file, PSP_O_RDONLY, 0777)) < 0) { mp3_fsize = 0; mp3_status = MP3_STOP; mp3_start_frame = 0; mp3_newfile = 0; } else { mp3_fsize = sceIoLseek(mp3_fd, 0, PSP_SEEK_END); sceIoLseek(mp3_fd, 0, PSP_SEEK_SET); mp3_status = MP3_SEEK; mp3_start_frame = frame; mp3_newfile = 1; } } }
void mp3_thread_stop(void) { if (mp3_thread >= 0) { mp3_active = 0; mp3_stop(); sceKernelWakeupThread(mp3_thread); sceKernelWaitThreadEnd(mp3_thread, NULL); sceKernelDeleteThread(mp3_thread); mp3_thread = -1; sceAudioChRelease(mp3_handle); mp3_handle = -1; } }
int mp3_play(const char *name) { if (mp3_thread >= 0) { strcpy(MP3_file, name); mp3_stop(); if ((mp3_fd = sceIoOpen(MP3_file, PSP_O_RDONLY, 0777)) >= 0) { MP3_get_filesize(); mp3_status = MP3_PLAY; mp3_newfile = 1; mp3_set_volume(); sceKernelWakeupThread(mp3_thread); return 0; } } return 1; }
void SoundManagerClass::stop() { mp3_stop(); }