Fix MP3 streaming always looping

This commit is contained in:
cypress 2023-10-23 18:01:54 -04:00
parent 1c269181aa
commit 33dc5e3c9f
2 changed files with 13 additions and 6 deletions

View File

@ -53,7 +53,6 @@ namespace quake
static bool paused = false;
static bool enabled = false;
static float cdvolume = 0;
static int cd_loop = 0;
static char* last_track_string = "";
}
}
@ -61,6 +60,8 @@ namespace quake
using namespace quake;
using namespace quake::cd;
int cd_loop = 0;
static void CD_f (void)
{
char *command;

View File

@ -58,6 +58,7 @@ static int mp3_src_size = 0;
static int decode_thread(SceSize args, void *argp);
extern int cd_loop;
static void psp_sem_lock(SceUID sem)
{
@ -96,12 +97,17 @@ static int read_next_frame(int which_buffer)
mp3_src_pos += bytes_read;
if (bytes_read < MIN_INFRAME_SIZE)
{
// cypress -- don't always loop.
if (cd_loop == 0) {
mp3_job_started = 0;
return 0;
}
// Baker: end of file hit, restart + re-read
mp3_src_pos = 0;
sceIoLseek32(mp3_handle, mp3_src_pos, PSP_SEEK_SET);
bytes_read = sceIoRead(mp3_handle, mp3_src_buffer[which_buffer], sizeof(mp3_src_buffer[which_buffer]));
mp3_src_pos += bytes_read;
}
frame_offset = find_sync_word(mp3_src_buffer[which_buffer], bytes_read);
if (frame_offset < 0) {