mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-01-23 13:35:11 +03:00
current work
This commit is contained in:
parent
5ed3bb86d3
commit
4ae2fc22c1
@ -659,7 +659,7 @@ typedef struct {
|
||||
* processing audio commands. This struct parameterizes that buffer.
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 count;
|
||||
/* 0x00 */ s16 numBuffers;
|
||||
/* 0x02 */ u16 samplingFrequency; // Target sampling rate in Hz
|
||||
/* 0x04 */ u16 aiSamplingFrequency; // True sampling rate of the audio interface (AI), see `osAiSetFrequency`
|
||||
/* 0x06 */ s16 samplesPerFrameTarget;
|
||||
|
@ -144,91 +144,91 @@ ReverbSettings D_800C76A8[] = {
|
||||
{ 1, 0x30, 0x4FFF, 0, 0 },
|
||||
};
|
||||
AudioSpec gAudioSpecs[] = {
|
||||
/* 0 */ { 44100, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
/* 0 */ { 32000, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 1 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C74E0), D_800C74E0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C74E0), D_800C74E0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 2 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C74F0), D_800C74F0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C74F0), D_800C74F0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 3 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7500), D_800C7500, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7500), D_800C7500, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 4 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7510), D_800C7510, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7510), D_800C7510, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 5 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7520), D_800C7520, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7520), D_800C7520, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 6 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7530), D_800C7530, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7530), D_800C7530, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 7 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7540), D_800C7540, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7540), D_800C7540, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 8 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7550), D_800C7550, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7550), D_800C7550, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 9 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7560), D_800C7560, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7560), D_800C7560, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 10 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7570), D_800C7570, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7570), D_800C7570, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 11 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7580), D_800C7580, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7580), D_800C7580, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 12 */
|
||||
{ 44100, 1, 22, ARRAY_COUNT(D_800C7590), D_800C7590, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x2B000,
|
||||
{ 32000, 1, 22, ARRAY_COUNT(D_800C7590), D_800C7590, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x2B000,
|
||||
0x35000 },
|
||||
/* 13 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C75A0), D_800C75A0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75A0), D_800C75A0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 14 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C75B0), D_800C75B0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75B0), D_800C75B0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 15 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C75C0), D_800C75C0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75C0), D_800C75C0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x34000 },
|
||||
/* 16 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C75D8), D_800C75D8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75D8), D_800C75D8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 17 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C75E8), D_800C75E8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75E8), D_800C75E8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 18 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C75F8), D_800C75F8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C75F8), D_800C75F8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 19 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7608), D_800C7608, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7608), D_800C7608, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 20 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7618), D_800C7618, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7618), D_800C7618, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
/* 21 */
|
||||
{ 44100, 2, 32, ARRAY_COUNT(D_800C7628), D_800C7628, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 32, ARRAY_COUNT(D_800C7628), D_800C7628, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x00000 },
|
||||
/* 22 */
|
||||
{ 44100, 1, 32, ARRAY_COUNT(D_800C7638), D_800C7638, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 1, 32, ARRAY_COUNT(D_800C7638), D_800C7638, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x00000 },
|
||||
/* 23 */
|
||||
{ 44100, 1, 32, ARRAY_COUNT(D_800C7648), D_800C7648, 0x7FFF, 0x1200, 0xA000, 0, 0x5B00, 0x1D00, 0, 0x00000,
|
||||
{ 32000, 1, 32, ARRAY_COUNT(D_800C7648), D_800C7648, 0x7FFF, 0x1200, 0xA000, 0, 0x5B00, 0x1D00, 0, 0x00000,
|
||||
0x00000 },
|
||||
/* 24 */
|
||||
{ 44100, 1, 22, ARRAY_COUNT(D_800C7658), D_800C7658, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x00000,
|
||||
{ 32000, 1, 22, ARRAY_COUNT(D_800C7658), D_800C7658, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x00000,
|
||||
0x60000 },
|
||||
/* 25 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7668), D_800C7668, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7668), D_800C7668, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x00000 },
|
||||
/* 26 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C7678), D_800C7678, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C7678), D_800C7678, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x00000 },
|
||||
/* 27 */
|
||||
{ 44100, 2, 32, ARRAY_COUNT(D_800C7688), D_800C7688, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 32, ARRAY_COUNT(D_800C7688), D_800C7688, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x00000 },
|
||||
/* 28 */
|
||||
{ 44100, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
{ 32000, 2, 22, ARRAY_COUNT(D_800C74D0), D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000,
|
||||
0x35000 },
|
||||
};
|
||||
s32 D_800C7C28 = 0x20000000; // unused?
|
||||
|
@ -216,7 +216,7 @@ f32 func_80013B90(AdsrState* adsr) {
|
||||
break;
|
||||
default:
|
||||
if (adsr->delay >= 4) {
|
||||
adsr->delay = (adsr->delay * gAudioBufferParams.ticksPerUpdate / gAudioBufferParams.count) / 4;
|
||||
adsr->delay = (adsr->delay * gAudioBufferParams.ticksPerUpdate / gAudioBufferParams.numBuffers) / 4;
|
||||
}
|
||||
if (adsr->delay == 0) {
|
||||
adsr->delay = 1;
|
||||
|
@ -535,7 +535,7 @@ void AudioHeap_UpdateReverbs(void) {
|
||||
s32 count;
|
||||
s32 reverbIndex;
|
||||
|
||||
if (gAudioBufferParams.count == 2) {
|
||||
if (gAudioBufferParams.numBuffers == 2) {
|
||||
count = 2;
|
||||
} else {
|
||||
count = 1;
|
||||
@ -563,7 +563,7 @@ s32 AudioHeap_ResetStep(void) {
|
||||
s32 j;
|
||||
s32 sp24;
|
||||
|
||||
if (gAudioBufferParams.count == 2) {
|
||||
if (gAudioBufferParams.numBuffers == 2) {
|
||||
sp24 = 2;
|
||||
} else {
|
||||
sp24 = 1;
|
||||
@ -669,13 +669,13 @@ void AudioHeap_Init(void) {
|
||||
D_8014C1B0 = spec->unk_14;
|
||||
gMaxTempo = (u16) ((gAudioBufferParams.ticksPerUpdate * 2880000.0f / gSeqTicksPerBeat) / gMaxTempoTvTypeFactors);
|
||||
|
||||
gAudioBufferParams.count = spec->numBuffers;
|
||||
gAudioBufferParams.samplesPerFrameTarget *= gAudioBufferParams.count;
|
||||
gAudioBufferParams.maxAiBufferLength *= gAudioBufferParams.count;
|
||||
gAudioBufferParams.minAiBufferLength *= gAudioBufferParams.count;
|
||||
gAudioBufferParams.ticksPerUpdate *= gAudioBufferParams.count;
|
||||
gAudioBufferParams.numBuffers = spec->numBuffers;
|
||||
gAudioBufferParams.samplesPerFrameTarget *= gAudioBufferParams.numBuffers;
|
||||
gAudioBufferParams.maxAiBufferLength *= gAudioBufferParams.numBuffers;
|
||||
gAudioBufferParams.minAiBufferLength *= gAudioBufferParams.numBuffers;
|
||||
gAudioBufferParams.ticksPerUpdate *= gAudioBufferParams.numBuffers;
|
||||
|
||||
if (gAudioBufferParams.count >= 2) {
|
||||
if (gAudioBufferParams.numBuffers >= 2) {
|
||||
gAudioBufferParams.maxAiBufferLength -= 0x10;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ void AudioLoad_InitSampleDmaBuffers(s32 numNotes) {
|
||||
u8* dma;
|
||||
|
||||
gSampleDmaBuffSize = 0x2D0;
|
||||
for (i = 0; i < (3 * gNumNotes * gAudioBufferParams.count); i++) {
|
||||
for (i = 0; i < (3 * gNumNotes * gAudioBufferParams.numBuffers); i++) {
|
||||
dma = AudioHeap_Alloc(&gMiscPool, gSampleDmaBuffSize);
|
||||
gSampleDmas[gSampleDmaCount].ramAddr = dma;
|
||||
if (dma == NULL) {
|
||||
|
@ -674,9 +674,7 @@ Acmd* AudioSynth_Update(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLe
|
||||
aiBufPtr = aiBufStart;
|
||||
// @port: i = gAudioBufferParams.ticksPerUpdate - 1 // this change is necessary to avoid a crash, sounds like a
|
||||
// problem
|
||||
s32 temp = gGameState == GSTATE_MENU ? gAudioBufferParams.ticksPerUpdate-1 : gAudioBufferParams.ticksPerUpdate-1;
|
||||
|
||||
for (i = temp; i > 0; i--) {
|
||||
for (i = gAudioBufferParams.ticksPerUpdate; i > 0; i--) {
|
||||
if (i == 1) {
|
||||
printf("func_80009B64 i == 1\n");
|
||||
chunkLen = aiBufLen;
|
||||
@ -701,6 +699,7 @@ Acmd* AudioSynth_Update(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLe
|
||||
aCmdPtr =
|
||||
AudioSynth_DoOneAudioUpdate((s16*) aiBufPtr, chunkLen, aCmdPtr, gAudioBufferParams.ticksPerUpdate - i);
|
||||
aiBufLen -= chunkLen;
|
||||
// if (aiBufLen < 0) aiBufLen = 0;
|
||||
aiBufPtr += chunkLen*2;
|
||||
}
|
||||
|
||||
|
@ -75,19 +75,16 @@ void AudioThread_CreateNextAudioBuffer(s16* samples, u32 num_samples) {
|
||||
gAudioResetTimer++;
|
||||
}
|
||||
|
||||
gAudioCurTask = &gAudioRspTasks[gAudioTaskIndexQ];
|
||||
gCurAbiCmdBuffer = gAbiCmdBuffs[gAudioTaskIndexQ];
|
||||
|
||||
while (MQ_GET_MESG(gThreadCmdProcQueue, &msg)) {
|
||||
AudioThread_ProcessCmds(msg.data32);
|
||||
}
|
||||
|
||||
AudioSynth_Update(gCurAbiCmdBuffer, &abiCmdCount, samples, num_samples);
|
||||
memcpy(gAiBuffers[gCurAiBuffIndex], samples, num_samples);
|
||||
gAudioRandom = osGetCount() * (gAudioRandom + gAudioTaskCountQ);
|
||||
|
||||
|
||||
gAudioCurTask->msg = OS_MESG_PTR(NULL);
|
||||
// Spectrum Analyzer fix
|
||||
memcpy(gAiBuffers[gCurAiBuffIndex], samples, num_samples);
|
||||
|
||||
gAudioRandom = osGetCount() * (gAudioRandom + gAudioTaskCountQ);
|
||||
|
||||
if (gMaxAbiCmdCnt < abiCmdCount) {
|
||||
gMaxAbiCmdCnt = abiCmdCount;
|
||||
@ -109,7 +106,7 @@ SPTask* AudioThread_CreateTask() {
|
||||
s32 pad30;
|
||||
|
||||
gAudioTaskCountQ++;
|
||||
if ((gAudioTaskCountQ % gAudioBufferParams.count) != 0) {
|
||||
if ((gAudioTaskCountQ % gAudioBufferParams.numBuffers) != 0) {
|
||||
return gWaitingAudioTask;
|
||||
}
|
||||
osSendMesg(gAudioTaskStartQueue, OS_MESG_32(gAudioTaskCountQ), OS_MESG_NOBLOCK);
|
||||
@ -203,7 +200,7 @@ SPTask* AudioThread_CreateTask() {
|
||||
gMaxAbiCmdCnt = abiCmdCount;
|
||||
}
|
||||
|
||||
if (gAudioBufferParams.count == 1) {
|
||||
if (gAudioBufferParams.numBuffers == 1) {
|
||||
return gAudioCurTask;
|
||||
} else {
|
||||
gWaitingAudioTask = gAudioCurTask;
|
||||
|
@ -355,6 +355,7 @@ void Game_SetScene(void) {
|
||||
}
|
||||
}
|
||||
extern u8 gAudioSpecId;
|
||||
extern int audBuffer;
|
||||
extern AudioBufferParameters gAudioBufferParams;
|
||||
void Game_Update(void) {
|
||||
s32 i;
|
||||
@ -624,10 +625,17 @@ void Game_Update(void) {
|
||||
}
|
||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
|
||||
Graphics_DisplaySmallText(10, 200, 1.0f, 1.0f, "AUDIOBUF:");
|
||||
Graphics_DisplaySmallNumber(90, 200, audBuffer);
|
||||
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 (gControllerPress[0].button & L_JPAD) {
|
||||
//audBuffer-=10;
|
||||
} else if (gControllerPress[0].button & R_JPAD) {
|
||||
// audBuffer+=10;
|
||||
}
|
||||
}
|
||||
|
||||
#if MODS_FPS_COUNTER == 1
|
||||
|
@ -66,7 +66,7 @@ GameEngine::GameEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 44100, 1024, 2480 });
|
||||
this->context = Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 32000, 1024, 2480 });
|
||||
|
||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY, "Animation", static_cast<uint32_t>(SF64::ResourceType::AnimData), 0);
|
||||
@ -128,7 +128,14 @@ void GameEngine::StartFrame() const{
|
||||
#define NUM_AUDIO_CHANNELS 2
|
||||
#define SAMPLES_PER_FRAME (SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3)
|
||||
|
||||
void GameEngine::HandleAudioThread(){
|
||||
s16 audio_buffer[SAMPLES_PER_FRAME*2] = {0};
|
||||
|
||||
extern "C" s32 audBuffer = 0;
|
||||
#include <sf64audio_provisional.h>
|
||||
|
||||
extern "C" volatile s32 gAudioTaskCountQ;
|
||||
|
||||
void GameEngine::HandleAudioThread() {
|
||||
while (audio.running) {
|
||||
{
|
||||
std::unique_lock<std::mutex> Lock(audio.mutex);
|
||||
@ -144,10 +151,9 @@ void GameEngine::HandleAudioThread(){
|
||||
|
||||
std::unique_lock<std::mutex> Lock(audio.mutex);
|
||||
int samples_left = AudioPlayerBuffered();
|
||||
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
||||
s16 audio_buffer[SAMPLES_PER_FRAME] = {0};
|
||||
|
||||
for (int i = 0; i < AUDIO_FRAMES_PER_UPDATE; i++) {
|
||||
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? 560 : 528;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
AudioThread_CreateNextAudioBuffer(audio_buffer + i * (num_audio_samples * NUM_AUDIO_CHANNELS), num_audio_samples);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ class GameEngine {
|
||||
static void Create();
|
||||
void StartFrame() const;
|
||||
static void HandleAudioThread();
|
||||
static void ProcessAudioTask(s16* audio_buffer);
|
||||
static void StartAudioFrame();
|
||||
static void EndAudioFrame();
|
||||
static void AudioInit();
|
||||
|
Loading…
Reference in New Issue
Block a user