Fix PAL audio

This commit is contained in:
James Lambert 2022-12-22 11:01:31 -07:00
parent 6332f2f5cf
commit d26a6408b5
4 changed files with 11 additions and 8 deletions

View file

@ -8,7 +8,7 @@
u8* gAudioHeapBuffer; u8* gAudioHeapBuffer;
ALHeap gAudioHeap; ALHeap gAudioHeap;
void initAudio(void) void initAudio(int fps)
{ {
ALSynConfig c; ALSynConfig c;
amConfig amc; amConfig amc;
@ -30,5 +30,5 @@ void initAudio(void)
amc.framesPerField = NUM_FIELDS; amc.framesPerField = NUM_FIELDS;
amc.maxACMDSize = MAX_RSP_CMDS; amc.maxACMDSize = MAX_RSP_CMDS;
amCreateAudioMgr(&c, AUDIO_PRIORITY, &amc); amCreateAudioMgr(&c, AUDIO_PRIORITY, &amc, fps);
} }

View file

@ -49,8 +49,8 @@ typedef struct {
} amConfig; } amConfig;
void amCreateAudioMgr(ALSynConfig *c, OSPri priority, amConfig *amc); void amCreateAudioMgr(ALSynConfig *c, OSPri priority, amConfig *amc, int fps);
void initAudio(void); void initAudio(int fps);
extern u64 audYieldBuf[]; extern u64 audYieldBuf[];
extern u8* gAudioHeapBuffer; extern u8* gAudioHeapBuffer;

View file

@ -89,7 +89,7 @@ static void __clearAudioDMA(void);
/****************************************************************************** /******************************************************************************
* Audio Manager API * Audio Manager API
*****************************************************************************/ *****************************************************************************/
void amCreateAudioMgr(ALSynConfig *c, OSPri pri, amConfig *amc) void amCreateAudioMgr(ALSynConfig *c, OSPri pri, amConfig *amc, int fps)
{ {
u32 i; u32 i;
f32 fsize; f32 fsize;
@ -103,7 +103,7 @@ void amCreateAudioMgr(ALSynConfig *c, OSPri pri, amConfig *amc)
* Calculate the frame sample parameters from the * Calculate the frame sample parameters from the
* video field rate and the output rate * video field rate and the output rate
*/ */
fsize = (f32) amc->framesPerField * c->outputRate / (f32) 60; fsize = (f32) amc->framesPerField * c->outputRate / (f32) fps;
frameSize = (s32) fsize; frameSize = (s32) fsize;
if (frameSize < fsize) if (frameSize < fsize)
frameSize++; frameSize++;

View file

@ -99,9 +99,12 @@ extern char _animation_segmentSegmentRomStart[];
static void gameProc(void* arg) { static void gameProc(void* arg) {
u8 schedulerMode = OS_VI_NTSC_LPF1; u8 schedulerMode = OS_VI_NTSC_LPF1;
int fps = 60;
switch (osTvType) { switch (osTvType) {
case 0: // PAL case 0: // PAL
schedulerMode = HIGH_RES ? OS_VI_PAL_HPF1 : OS_VI_PAL_LPF1; schedulerMode = HIGH_RES ? OS_VI_PAL_HPF1 : OS_VI_PAL_LPF1;
fps = 50;
break; break;
case 1: // NTSC case 1: // NTSC
schedulerMode = HIGH_RES ? OS_VI_NTSC_HPF1 : OS_VI_NTSC_LPF1; schedulerMode = HIGH_RES ? OS_VI_NTSC_HPF1 : OS_VI_NTSC_LPF1;
@ -155,10 +158,10 @@ static void gameProc(void* arg) {
dynamicSceneInit(); dynamicSceneInit();
contactSolverInit(&gContactSolver); contactSolverInit(&gContactSolver);
portalSurfaceCleanupQueueInit(); portalSurfaceCleanupQueueInit();
levelLoad(3); levelLoad(0);
cutsceneRunnerReset(); cutsceneRunnerReset();
controllersInit(); controllersInit();
initAudio(); initAudio(fps);
soundPlayerInit(); soundPlayerInit();
skSetSegmentLocation(CHARACTER_ANIMATION_SEGMENT, (unsigned)_animation_segmentSegmentRomStart); skSetSegmentLocation(CHARACTER_ANIMATION_SEGMENT, (unsigned)_animation_segmentSegmentRomStart);
sceneInit(&gScene); sceneInit(&gScene);