mirror of
https://github.com/HarbourMasters/Starship
synced 2026-09-03 19:03:03 -04:00
audiospec fix
This commit is contained in:
+34
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user