Skip to content

Commit 14ad4b3

Browse files
MegaMechgithub-actions[bot]
authored andcommitted
Clang Format
1 parent 8d4fa64 commit 14ad4b3

20 files changed

+388
-313
lines changed

include/PR/abi.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,13 @@ typedef short ENVMIX_STATE[40];
822822
/*
823823
* See aEnvMixer for more info.
824824
*/
825-
#define aEnvSetup1Alt(pkt,initialVolReverb,rampReverbL,rampReverbR,rampLeft,rampRight) { Acmd *_a = (Acmd *)pkt; _a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | _SHIFTL(initialVolReverb, 16, 8) | (_SHIFTL(rampReverbL, 8, 8)) | _SHIFTL(rampReverbR, 0, 8)); _a->words.w1 = _SHIFTL(rampLeft, 16, 16) | _SHIFTL(rampRight, 0, 16); }
825+
#define aEnvSetup1Alt(pkt, initialVolReverb, rampReverbL, rampReverbR, rampLeft, rampRight) \
826+
{ \
827+
Acmd* _a = (Acmd*) pkt; \
828+
_a->words.w0 = (_SHIFTL(A_ENVSETUP1, 24, 8) | _SHIFTL(initialVolReverb, 16, 8) | \
829+
(_SHIFTL(rampReverbL, 8, 8)) | _SHIFTL(rampReverbR, 0, 8)); \
830+
_a->words.w1 = _SHIFTL(rampLeft, 16, 16) | _SHIFTL(rampRight, 0, 16); \
831+
}
826832

827833
/*
828834
* See aEnvMixer for more info.

include/defines.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@
5454

5555
// Float version required for matching
5656
#ifdef VERSION_EU
57-
#define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50
58-
#ifdef AVOID_UB
59-
#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50
60-
#else
61-
#define COURSE_TIMER_ITER_f 0.01666666f //! 1 / 60 - Float unchanged in EU
62-
#endif
57+
#define COURSE_TIMER_ITER 0.020041665999999999 // 1 / 50
58+
#ifdef AVOID_UB
59+
#define COURSE_TIMER_ITER_f 0.020041665999999999f // 1 / 50
60+
#else
61+
#define COURSE_TIMER_ITER_f 0.01666666f //! 1 / 60 - Float unchanged in EU
62+
#endif
6363
#else
6464
#define COURSE_TIMER_ITER 0.01666666 // 1 / 60
6565
#define COURSE_TIMER_ITER_f 0.01666666f // 1 / 60
@@ -350,7 +350,6 @@ enum PLACE { FIRST_PLACE, SECOND_PLACE, THIRD_PLACE, FOURTH_PLACE };
350350
#define LIGHTNING_EFFECT 0x40000000 // being hit by lightning
351351
#define BOO_EFFECT 0x80000000 // being a boo
352352

353-
354353
/**
355354
* @brief durations of effects
356355
*/

src/audio/external.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ s8 func_800C16E8(f32 arg0, f32 arg1, u8 cameraId) {
231231
f32 var_f0;
232232
f32 var_f14;
233233
f32 new_var;
234-
f32 *new_var2;
234+
f32* new_var2;
235235
f32 var_f16;
236236
f32 var_f18;
237237
f32 var_f20;
@@ -1349,7 +1349,7 @@ void func_800C4398(void) {
13491349
}
13501350
if ((sSoundBanks[bank][sSoundBankFreeListFront[bank]].next != 0xFF) && (soundIndex != 0)) {
13511351
var_t2 = soundIndex = sSoundBankFreeListFront[bank];
1352-
sSoundBanks[bank][soundIndex].unk00 = (Vec3f*)&(*var_a2->position)[0];
1352+
sSoundBanks[bank][soundIndex].unk00 = (Vec3f*) &(*var_a2->position)[0];
13531353
sSoundBanks[bank][soundIndex].unk04 = &(*var_a2->position)[1];
13541354
sSoundBanks[bank][soundIndex].unk08 = &(*var_a2->position)[2];
13551355
sSoundBanks[bank][soundIndex].cameraId = var_a2->cameraId;
@@ -1398,7 +1398,8 @@ struct ActiveSfx {
13981398
u32 priority;
13991399
u8 soundIndex;
14001400
};
1401-
#define AUDIO_MK_CMD(b0,b1,b2,b3) ((((b0) & 0xFF) << 0x18) | (((b1) & 0xFF) << 0x10) | (((b2) & 0xFF) << 0x8) | (((b3) & 0xFF) << 0))
1401+
#define AUDIO_MK_CMD(b0, b1, b2, b3) \
1402+
((((b0) & 0xFF) << 0x18) | (((b1) & 0xFF) << 0x10) | (((b2) & 0xFF) << 0x8) | (((b3) & 0xFF) << 0))
14021403
void func_800C4888(u8 bankId) {
14031404
u8 j;
14041405
u8 numChannels;
@@ -1424,7 +1425,8 @@ void func_800C4888(u8 bankId) {
14241425
soundIndex = sSoundBanks[bankId][0].next;
14251426
k = 0;
14261427
while (soundIndex != 0xFF) {
1427-
if ((sSoundBanks[bankId][soundIndex].soundStatus == 1) && ((sSoundBanks[bankId][soundIndex].soundBits & 0x08000000) == 0x08000000)) {
1428+
if ((sSoundBanks[bankId][soundIndex].soundStatus == 1) &&
1429+
((sSoundBanks[bankId][soundIndex].soundBits & 0x08000000) == 0x08000000)) {
14281430
sSoundBanks[bankId][soundIndex].freshness -= 1;
14291431
}
14301432

@@ -1436,8 +1438,7 @@ void func_800C4888(u8 bankId) {
14361438
if (&D_800EA1C8 == entry[0].unk00) {
14371439
entry->distance = 0.0f;
14381440
} else {
1439-
entry->distance =
1440-
(*entry->unk00[0] * *entry->unk00[0]) + (*entry->unk08 * *entry->unk08);
1441+
entry->distance = (*entry->unk00[0] * *entry->unk00[0]) + (*entry->unk08 * *entry->unk08);
14411442
}
14421443
requestedPriority = (((u32) (entry->soundBits & 0xFF00)) >> 8);
14431444
if (entry->soundBits & 0x100000) {
@@ -1498,7 +1499,7 @@ void func_800C4888(u8 bankId) {
14981499

14991500
for (i = 0; i < numChannels; i++) {
15001501
needNewSfx = false;
1501-
activeSfx = (struct ActiveSfx*)&D_80192AB8[bankId][i];
1502+
activeSfx = (struct ActiveSfx*) &D_80192AB8[bankId][i];
15021503

15031504
if (activeSfx->soundIndex == 0xFF) {
15041505
needNewSfx = true;
@@ -1530,7 +1531,7 @@ void func_800C4888(u8 bankId) {
15301531
chosenEntryIndex = chosenSfx[j].soundIndex;
15311532
if ((chosenEntryIndex != 0xFF) && (sSoundBanks[bankId][chosenEntryIndex].soundStatus != 3)) {
15321533
for (k = 0; k < numChannels; k++) {
1533-
if (chosenEntryIndex == ((struct ActiveSfx*)(D_80192AB8[bankId]))[k].soundIndex) {
1534+
if (chosenEntryIndex == ((struct ActiveSfx*) (D_80192AB8[bankId]))[k].soundIndex) {
15341535
needNewSfx = false;
15351536
k = numChannels;
15361537
}
@@ -1950,7 +1951,7 @@ void func_800C6108(u8 playerId) {
19501951
D_800E9ED4[playerId] = D_800E9EE4[playerId] * 0.25f;
19511952
D_800E9F7C[playerId].unk_0C = D_800E9EC4[playerId] + D_800E9ED4[playerId] + D_800E9F34[playerId];
19521953
} else {
1953-
D_800E9F7C[playerId].unk_0C = D_800E9EB4[playerId] + D_800E9F34[playerId];
1954+
D_800E9F7C[playerId].unk_0C = D_800E9EB4[playerId] + D_800E9F34[playerId];
19541955
}
19551956
#ifdef VERSION_EU
19561957
if (D_800E9F7C[playerId].unk_0C < 0.0f) {
@@ -2943,8 +2944,8 @@ void func_800C90F4(u8 playerId, u32 soundBits) {
29432944
}
29442945

29452946
void func_800C9250(u8 playerIndex) {
2946-
func_800C90F4(playerIndex,
2947-
(gPlayers[playerIndex].characterId * 0x10) + (gAudioRandom & 1) + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x01));
2947+
func_800C90F4(playerIndex, (gPlayers[playerIndex].characterId * 0x10) + (gAudioRandom & 1) +
2948+
SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x01));
29482949
}
29492950

29502951
void func_800C92CC(u8 playerId, u32 soundBits) {
@@ -3362,7 +3363,8 @@ void func_800CA730(u8 playerIndex) {
33623363
if (D_800EA0EC[playerIndex] == 0) {
33633364
if ((D_800EA108 == 0) && (D_800EA10C[playerIndex] != 0)) {
33643365
play_sound(gPlayers[playerIndex].characterId * 0x10 + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x08),
3365-
&D_800E9F7C[playerIndex].pos, playerIndex, &D_800EA1D4, &D_800EA1D4, (s8*) &D_800E9F7C[playerIndex].unk_14);
3366+
&D_800E9F7C[playerIndex].pos, playerIndex, &D_800EA1D4, &D_800EA1D4,
3367+
(s8*) &D_800E9F7C[playerIndex].unk_14);
33663368
if (D_800EA10C[playerIndex] != 0) {
33673369
if ((s32) D_800EA1C0 >= 2) {
33683370
func_800C9018(playerIndex, SOUND_ARG_LOAD(0x01, 0x00, 0xFF, 0x2C));
@@ -3404,8 +3406,8 @@ void func_800CA984(u8 playerIndex) {
34043406

34053407
if ((D_800EA108 == 0) && (D_800EA0F0 == 0)) {
34063408
for (i = 0; i < D_800EA1C0 + 1; i++) {
3407-
temp_v0_2 =
3408-
func_800C1C88(playerIndex, gPlayers[playerIndex].pos, D_800EA1C8, &gPlayers[playerIndex].unk_098, (u8) i, SOUND_ITEM_STAR);
3409+
temp_v0_2 = func_800C1C88(playerIndex, gPlayers[playerIndex].pos, D_800EA1C8,
3410+
&gPlayers[playerIndex].unk_098, (u8) i, SOUND_ITEM_STAR);
34093411
if (temp_v0_2) {
34103412
play_sound(SOUND_ITEM_STAR, &temp_v0_2->unk18, i, &D_800EA1D4, &D_800EA1D4, &D_800EA1DC);
34113413
}
@@ -3483,8 +3485,8 @@ void func_800CADD0(u8 playerIndex, f32 arg1) {
34833485
arg1 = 0.0f;
34843486
}
34853487
D_800EA110[playerIndex] = arg1;
3486-
play_sound(0x1900A209U, &D_800E9F7C[playerIndex].pos, playerIndex, &D_800EA1D4, &D_800EA110[playerIndex],
3487-
(s8*) &D_800E9F7C[playerIndex].unk_14);
3488+
play_sound(0x1900A209U, &D_800E9F7C[playerIndex].pos, playerIndex, &D_800EA1D4,
3489+
&D_800EA110[playerIndex], (s8*) &D_800E9F7C[playerIndex].unk_14);
34883490
break;
34893491
default:
34903492
break;
@@ -3537,7 +3539,8 @@ void func_800CB064(u8 playerIndex) {
35373539
if ((u8) D_800EA168 == 0) {
35383540
func_800C36C4(0, 1U, 0x7FU, 0x19);
35393541
}
3540-
func_800C90F4(playerIndex, gPlayers[playerIndex].characterId * 0x10 + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x08));
3542+
func_800C90F4(playerIndex,
3543+
gPlayers[playerIndex].characterId * 0x10 + SOUND_ARG_LOAD(0x29, 0x00, 0x80, 0x08));
35413544
func_800C9018(playerIndex, SOUND_ARG_LOAD(0x01, 0x00, 0xFA, 0x4C));
35423545
D_800EA170[playerIndex] = 0;
35433546
}

src/audio/load.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,10 @@ void audio_init(void) {
787787
#ifdef TARGET_N64
788788
// It seems boot.s doesn't clear the .bss area for audio, so do it here.
789789
ptr64 = (u64*) ((u8*) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer));
790-
for (k = ((uintptr_t) &gAudioGlobalsEndMarker - (uintptr_t) ((u64 *)((u8 *) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer))) ) / 8; k >= 0; k--) {
790+
for (k = ((uintptr_t) &gAudioGlobalsEndMarker -
791+
(uintptr_t) ((u64*) ((u8*) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer)))) /
792+
8;
793+
k >= 0; k--) {
791794
*ptr64++ = 0;
792795
}
793796
#endif
@@ -882,7 +885,7 @@ void audio_init(void) {
882885

883886
// Load bank sets for each sequence
884887
gAlBankSets = soundAlloc(&gAudioInitPool, 0x100);
885-
audio_dma_copy_immediate((u8 *) &_instrument_setsSegmentRomStart, gAlBankSets, 0x100);
888+
audio_dma_copy_immediate((u8*) &_instrument_setsSegmentRomStart, gAlBankSets, 0x100);
886889

887890
sound_alloc_pool_init(&gUnkPool1.pool, soundAlloc(&gAudioInitPool, (u32) D_800EA5D8), (u32) D_800EA5D8);
888891
init_sequence_players();

src/audio/synthesis.c

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@ Acmd* synthesis_do_one_audio_update(s16* aiBuf, s32 bufLen, Acmd* acmd, s32 upda
330330
Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct NoteSynthesisState* synthesisState,
331331
UNUSED s16* aiBuf, s32 inBuf, Acmd* cmd, s32 updateIndex) {
332332
s32 pad[3];
333-
struct AudioBankSample *audioBookSample; // sp130
334-
struct AdpcmLoop *loopInfo; // sp12C
335-
s16 *curLoadedBook; // sp128
333+
struct AudioBankSample* audioBookSample; // sp130
334+
struct AdpcmLoop* loopInfo; // sp12C
335+
s16* curLoadedBook; // sp128
336336
s32 pad4;
337337
s32 nSamplesToLoad;
338338
s32 noteFinished; // sp11C
339-
s32 restart; // sp118
339+
s32 restart; // sp118
340340
s32 flags;
341341
u16 resamplingRateFixedPoint; // sp112
342342
s32 pad2[1];
@@ -347,22 +347,22 @@ Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct
347347
s32 pad3;
348348
s32 nAdpcmSamplesProcessed;
349349
s32 s4;
350-
u8 *sampleAddr; // spEC
350+
u8* sampleAddr; // spEC
351351
s32 s3;
352352
s32 samplesLenAdjusted; // spE4
353353
s32 leftRight;
354-
s32 endPos; // spDC
354+
s32 endPos; // spDC
355355
s32 nSamplesToProcess; // spD8
356356
u32 samplesLenFixedPoint;
357357
s32 var_s6;
358358
s32 nSamplesInThisIteration;
359359
u32 var_t2;
360-
u8 *var_a0_2;
360+
u8* var_a0_2;
361361
s32 s5Aligned;
362362
s32 temp_t6;
363363
s32 aligned;
364-
struct AudioBankSample *bankSample;
365-
s32 nParts; // spB0
364+
struct AudioBankSample* bankSample;
365+
s32 nParts; // spB0
366366
s32 curPart; // spAC
367367
s32 pad5;
368368
s16 addr;
@@ -371,7 +371,7 @@ Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct
371371
s32 samplesRemaining;
372372
s32 s1;
373373
u32 nEntries;
374-
struct Note *note;
374+
struct Note* note;
375375

376376
curLoadedBook = NULL;
377377
note = &gNotes[noteIndex];
@@ -420,7 +420,7 @@ Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct
420420
if (curLoadedBook != (*bankSample->book).book) {
421421
curLoadedBook = bankSample->book->book;
422422
nEntries = (16 * bankSample->book->order) * bankSample->book->npredictors;
423-
aLoadADPCM(cmd++, nEntries, VIRTUAL_TO_PHYSICAL2(noteSubEu->bookOffset+curLoadedBook));
423+
aLoadADPCM(cmd++, nEntries, VIRTUAL_TO_PHYSICAL2(noteSubEu->bookOffset + curLoadedBook));
424424
}
425425
if (noteSubEu->bookOffset != 0) {
426426
curLoadedBook = &gUnknownData_800F6290[0];
@@ -567,7 +567,8 @@ Acmd* synthesis_process_note(s32 noteIndex, struct NoteSubEu* noteSubEu, struct
567567
noteSubEu->needsInit = false;
568568
}
569569

570-
cmd = final_resample(cmd, synthesisState, inBuf * 2, resamplingRateFixedPoint, noteSamplesDmemAddrBeforeResampling, flags);
570+
cmd = final_resample(cmd, synthesisState, inBuf * 2, resamplingRateFixedPoint, noteSamplesDmemAddrBeforeResampling,
571+
flags);
571572
headsetPanRight = noteSubEu->headsetPanRight;
572573
if ((headsetPanRight & 0xFFFF) || synthesisState->prevHeadsetPanRight) {
573574
leftRight = 1;
@@ -619,66 +620,43 @@ Acmd* func_800B86A0(Acmd* cmd, struct NoteSubEu* note, struct NoteSynthesisState
619620

620621
sourceLeft = synthesisState->curVolLeft;
621622
sourceRight = synthesisState->curVolRight;
622-
623+
623624
targetLeft = (note->targetVolLeft) << 4;
624625
targetRight = (note->targetVolRight) << 4;
625626

626-
rampLeft = ((targetLeft - sourceLeft) / (nSamples >> 3));
627+
rampLeft = ((targetLeft - sourceLeft) / (nSamples >> 3));
627628
rampRight = ((targetRight - sourceRight) / (nSamples >> 3));
628-
targetLeft = sourceLeft + rampLeft * (nSamples >> 3);
629+
targetLeft = sourceLeft + rampLeft * (nSamples >> 3);
629630
targetRight = sourceRight + rampRight * (nSamples >> 3);
630631

631632
synthesisState->curVolLeft = targetLeft;
632633
synthesisState->curVolRight = targetRight;
633634

634635
if (note->usesHeadsetPanEffects) {
635636
aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DEFAULT_LEN_1CH);
636-
aEnvSetup1Alt(cmd++, note->reverbVol, sourceLeft, sourceRight, (u32)rampLeft, (u32)rampRight);
637+
aEnvSetup1Alt(cmd++, note->reverbVol, sourceLeft, sourceRight, (u32) rampLeft, (u32) rampRight);
637638
aEnvSetup2(cmd++, sourceLeft, sourceRight);
638639

639-
switch (headsetPanSettings) {;
640+
switch (headsetPanSettings) {
641+
;
640642
case 1:
641-
aEnvMixer(cmd++,
642-
inBuf, nSamples,
643-
0,
644-
note->stereoStrongRight, note->stereoStrongLeft,
645-
DMEM_ADDR_NOTE_PAN_TEMP,
646-
DMEM_ADDR_RIGHT_CH,
647-
DMEM_ADDR_WET_LEFT_CH,
648-
DMEM_ADDR_WET_RIGHT_CH);
643+
aEnvMixer(cmd++, inBuf, nSamples, 0, note->stereoStrongRight, note->stereoStrongLeft,
644+
DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_RIGHT_CH, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_RIGHT_CH);
649645
break;
650646
case 2:
651-
aEnvMixer(cmd++,
652-
inBuf, nSamples,
653-
0,
654-
note->stereoStrongRight, note->stereoStrongLeft,
655-
DMEM_ADDR_LEFT_CH,
656-
DMEM_ADDR_NOTE_PAN_TEMP,
657-
DMEM_ADDR_WET_LEFT_CH,
658-
DMEM_ADDR_WET_RIGHT_CH);
647+
aEnvMixer(cmd++, inBuf, nSamples, 0, note->stereoStrongRight, note->stereoStrongLeft, DMEM_ADDR_LEFT_CH,
648+
DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_RIGHT_CH);
659649
break;
660650
default:
661-
aEnvMixer(cmd++,
662-
inBuf, nSamples,
663-
0,
664-
note->stereoStrongRight, note->stereoStrongLeft,
665-
DMEM_ADDR_LEFT_CH,
666-
DMEM_ADDR_RIGHT_CH,
667-
DMEM_ADDR_WET_LEFT_CH,
668-
DMEM_ADDR_WET_RIGHT_CH);
651+
aEnvMixer(cmd++, inBuf, nSamples, 0, note->stereoStrongRight, note->stereoStrongLeft, DMEM_ADDR_LEFT_CH,
652+
DMEM_ADDR_RIGHT_CH, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_RIGHT_CH);
669653
break;
670654
}
671655
} else {
672-
aEnvSetup1Alt(cmd++, note->reverbVol, sourceLeft, sourceRight, (u32)rampLeft, (u32)rampRight);
656+
aEnvSetup1Alt(cmd++, note->reverbVol, sourceLeft, sourceRight, (u32) rampLeft, (u32) rampRight);
673657
aEnvSetup2(cmd++, sourceLeft, sourceRight);
674-
aEnvMixer(cmd++,
675-
inBuf, nSamples,
676-
0,
677-
note->stereoStrongRight, note->stereoStrongLeft,
678-
DMEM_ADDR_LEFT_CH,
679-
DMEM_ADDR_RIGHT_CH,
680-
DMEM_ADDR_WET_LEFT_CH,
681-
DMEM_ADDR_WET_RIGHT_CH);
658+
aEnvMixer(cmd++, inBuf, nSamples, 0, note->stereoStrongRight, note->stereoStrongLeft, DMEM_ADDR_LEFT_CH,
659+
DMEM_ADDR_RIGHT_CH, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_RIGHT_CH);
682660
}
683661
return cmd;
684662
}

0 commit comments

Comments
 (0)