debug bgm player, sound code refactoring

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@598 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2008-10-16 13:32:55 +00:00
parent 40644bfedd
commit 7b3f44c6b6
12 changed files with 161 additions and 86 deletions

View file

@ -609,7 +609,7 @@ static void sound_init(void)
lprintf("sceKernelCreateThread failed: %i\n", thid);
}
static void sound_prepare(void)
void emu_startSound(void)
{
static int PsndRate_old = 0, PicoOpt_old = 0, pal_old = 0;
int ret, stereo;
@ -648,7 +648,7 @@ static void sound_prepare(void)
}
}
static void sound_end(void)
void emu_endSound(void)
{
int i;
if (samples_done == 0)
@ -667,6 +667,14 @@ static void sound_end(void)
sceAudio_5C37C0AE();
}
/* wait until we can write more sound */
void emu_waitSound(void)
{
// TODO: test this
while (!sound_thread_exit && samples_made - samples_done > samples_block * 4)
psp_msleep(10);
}
static void sound_deinit(void)
{
sound_thread_exit = 1;
@ -944,7 +952,7 @@ void emu_Loop(void)
PsndOut = NULL;
if (currentConfig.EmuOpt & 4)
{
sound_prepare();
emu_startSound();
}
sceDisplayWaitVblankStart();
@ -1090,8 +1098,8 @@ void emu_Loop(void)
if (PicoAHW & PAHW_MCD) PicoCDBufferFree();
if (PsndOut != NULL) {
emu_endSound();
PsndOut = NULL;
sound_end();
}
// save SRAM