diff options
| author | Sonic Dreamcaster <alejandro.asenjo88@gmail.com> | 2024-11-12 13:21:26 -0300 |
|---|---|---|
| committer | Sonic Dreamcaster <alejandro.asenjo88@gmail.com> | 2024-11-12 13:21:26 -0300 |
| commit | 5ed3bb86d35e0bf8ce8c6ec39a91396e07d5e797 (patch) | |
| tree | 0c41930f741ddd7ce12217d909889fb4a15d1527 /src/engine/fox_game.c | |
| parent | c238f8a493aebaf2c42b7af98819e41c04f7e8df (diff) | |
audiospec fix
Diffstat (limited to 'src/engine/fox_game.c')
| -rw-r--r-- | src/engine/fox_game.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/src/engine/fox_game.c b/src/engine/fox_game.c index f6f131d7..2352b25c 100644 --- a/src/engine/fox_game.c +++ b/src/engine/fox_game.c @@ -4,7 +4,21 @@ #include "assets/ast_logo.h" #include "mods.h" #include "port/interpolation/FrameInterpolation.h" - +typedef struct { + /* 0x00 */ s16 count; + /* 0x02 */ u16 samplingFrequency; // Target sampling rate in Hz + /* 0x04 */ u16 aiSamplingFrequency; // True sampling rate of the audio interface (AI), see `osAiSetFrequency` + /* 0x06 */ s16 samplesPerFrameTarget; + /* 0x08 */ s16 maxAiBufferLength; + /* 0x0A */ s16 minAiBufferLength; + /* 0x0C */ s16 ticksPerUpdate; // for each audio thread update, number of ticks to process audio + /* 0x0E */ s16 samplesPerTick; + /* 0x10 */ s16 samplesPerTickMax; + /* 0x12 */ s16 samplesPerTickMin; + /* 0x14 */ f32 resampleRate; + /* 0x18 */ f32 ticksPerUpdateInv; // inverse (reciprocal) of ticksPerUpdate + /* 0x1C */ f32 ticksPerUpdateInvScaled; // ticksPerUpdateInv scaled down by a factor of 256 +} AudioBufferParameters; // size = 0x20 f32 gNextVsViewScale; f32 gVsViewScale; s32 gPlayerInactive[4]; @@ -165,8 +179,7 @@ void Game_InitMasterDL(Gfx** dList) { gDPSetDepthImage((*dList)++, &gZBuffer); gDPSetColorImage((*dList)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, RIGHT_MARGIN, &gZBuffer); gDPSetFillColor((*dList)++, FILL_COLOR(GPACK_ZDZ(G_MAXFBZ, 0))); - gDPFillWideRectangle((*dList)++, LEFT_MARGIN, SCREEN_MARGIN, RIGHT_MARGIN, - SCREEN_HEIGHT - SCREEN_MARGIN); + gDPFillWideRectangle((*dList)++, LEFT_MARGIN, SCREEN_MARGIN, RIGHT_MARGIN, SCREEN_HEIGHT - SCREEN_MARGIN); gDPSetColorImage((*dList)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, RIGHT_MARGIN, gFrameBuffer); if (gBlurAlpha < 255) { @@ -179,8 +192,7 @@ void Game_InitMasterDL(Gfx** dList) { } else { gDPSetFillColor((*dList)++, FILL_COLOR(gBgColor | 1)); } - gDPFillWideRectangle((*dList)++, LEFT_MARGIN, SCREEN_MARGIN, RIGHT_MARGIN, - SCREEN_HEIGHT - SCREEN_MARGIN); + gDPFillWideRectangle((*dList)++, LEFT_MARGIN, SCREEN_MARGIN, RIGHT_MARGIN, SCREEN_HEIGHT - SCREEN_MARGIN); gDPPipeSync((*dList)++); gDPSetColorDither((*dList)++, G_CD_MAGICSQ); } @@ -190,7 +202,8 @@ void Game_InitStandbyDL(Gfx** dList) { gDPSetScissor((*dList)++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT * 3); gDPSetFillColor((*dList)++, FILL_COLOR(0x0001)); gDPSetColorImage((*dList)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, RIGHT_MARGIN, gFrameBuffers[0].data); - gDPFillWideRectangle((*dList)++, OTRGetDimensionFromLeftEdge(0), 0, OTRGetRectDimensionFromRightEdge(0), SCREEN_HEIGHT * 3 - 1); + gDPFillWideRectangle((*dList)++, OTRGetDimensionFromLeftEdge(0), 0, OTRGetRectDimensionFromRightEdge(0), + SCREEN_HEIGHT * 3 - 1); gDPPipeSync((*dList)++); gDPSetColorDither((*dList)++, G_CD_MAGICSQ); } @@ -341,7 +354,8 @@ void Game_SetScene(void) { break; } } - +extern u8 gAudioSpecId; +extern AudioBufferParameters gAudioBufferParams; void Game_Update(void) { s32 i; u8 partialFill; @@ -554,8 +568,10 @@ void Game_Update(void) { partialFill = false; if (gCamCount == 1) { - Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH - 1), SCREEN_HEIGHT - 1, gPlayerGlareReds[0], - gPlayerGlareGreens[0], gPlayerGlareBlues[0], gPlayerGlareAlphas[0]); + Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0, + OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH - 1), SCREEN_HEIGHT - 1, + gPlayerGlareReds[0], gPlayerGlareGreens[0], gPlayerGlareBlues[0], + gPlayerGlareAlphas[0]); if ((gDrawMode == DRAW_PLAY) || (gDrawMode == DRAW_ENDING)) { Radio_Draw(); if (gShowHud) { @@ -591,8 +607,9 @@ void Game_Update(void) { Wipe_Draw(WIPE_CIRCULAR, gCircleWipeFrame); if (!partialFill) { - Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0, OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH - 1), SCREEN_HEIGHT - 1, gFillScreenRed, - gFillScreenGreen, gFillScreenBlue, gFillScreenAlpha); + Graphics_FillRectangle(&gMasterDisp, OTRGetRectDimensionFromLeftEdge(0), 0, + OTRGetRectDimensionFromRightEdge(SCREEN_WIDTH - 1), SCREEN_HEIGHT - 1, + gFillScreenRed, gFillScreenGreen, gFillScreenBlue, gFillScreenAlpha); } Audio_dummy_80016A50(); #if MODS_RAM_MOD == 1 @@ -605,6 +622,12 @@ void Game_Update(void) { Spawner(); #endif } + RCP_SetupDL(&gMasterDisp, SETUPDL_83); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); + Graphics_DisplaySmallText(10, 210, 1.0f, 1.0f, "AUDIOSPEC:"); + Graphics_DisplaySmallNumber(90, 210, gAudioSpecId); + Graphics_DisplaySmallText(10, 220, 1.0f, 1.0f, "TICKS:"); + Graphics_DisplaySmallNumber(90, 220, gAudioBufferParams.ticksPerUpdate); } #if MODS_FPS_COUNTER == 1 |
