mirror of
https://github.com/nzp-team/dquakeplus.git
synced 2025-02-16 16:41:03 +00:00
Fix MP3 streaming always looping
This commit is contained in:
parent
1c269181aa
commit
33dc5e3c9f
2 changed files with 13 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
// 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;
|
||||
// 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) {
|
||||
|
|
Loading…
Reference in a new issue