Misc Cleanup 2 (#1521)

* begin cleanup

* more cleanup

* more cleanup

* more cleanup

* more cleanup

* more cleanup

* fake matches

* more cleanup

* more cleanup

* small thing

* PR Review

* PR Review
This commit is contained in:
engineer124
2024-03-23 22:04:07 +11:00
committed by GitHub
parent a7fa8cc241
commit 5bef89a6ff
84 changed files with 746 additions and 763 deletions
+1 -5
View File
@@ -5721,11 +5721,7 @@ void Audio_SetSequenceMode(u8 seqMode) {
if (seqMode != (sPrevSeqMode & 0x7F)) {
if (seqMode == SEQ_MODE_ENEMY) {
// If only seqMode = SEQ_MODE_ENEMY (Start)
if (gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume < 0) {
volumeFadeInTimer = -(gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume);
} else {
volumeFadeInTimer = gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume;
}
volumeFadeInTimer = ABS_ALT(gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume);
AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, sBgmEnemyVolume,
volumeFadeInTimer);
+5 -5
View File
@@ -139,7 +139,7 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaI
s32 bufferPos;
u32 i;
if ((arg2 != 0) || (*dmaIndexRef >= gAudioCtx.sampleDmaListSize1)) {
if (arg2 || (*dmaIndexRef >= gAudioCtx.sampleDmaListSize1)) {
for (i = gAudioCtx.sampleDmaListSize1; i < gAudioCtx.sampleDmaCount; i++) {
dma = &gAudioCtx.sampleDmas[i];
bufferPos = devAddr - dma->devAddr;
@@ -162,11 +162,11 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaI
}
}
if (arg2 == 0) {
if (!arg2) {
goto search_short_lived;
}
if (gAudioCtx.sampleDmaReuseQueue2RdPos != gAudioCtx.sampleDmaReuseQueue2WrPos && arg2 != 0) {
if ((gAudioCtx.sampleDmaReuseQueue2RdPos != gAudioCtx.sampleDmaReuseQueue2WrPos) && arg2) {
// Allocate a DMA from reuse queue 2, unless full.
dmaIndex = gAudioCtx.sampleDmaReuseQueue2[gAudioCtx.sampleDmaReuseQueue2RdPos];
gAudioCtx.sampleDmaReuseQueue2RdPos++;
@@ -1073,7 +1073,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
s32 loadStatus;
SoundFont* soundFont;
u32 realId = AudioLoad_GetRealTableIndex(tableType, id);
u32 pad;
s32 pad;
switch (tableType) {
case SEQUENCE_TABLE:
@@ -1638,7 +1638,7 @@ void AudioLoad_ProcessAsyncLoadUnkMedium(AudioAsyncLoad* asyncLoad, s32 resetSta
void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
u32 retMsg = asyncLoad->retMsg;
u32 fontId;
u32 pad;
s32 pad;
OSMesg doneMsg;
u32 sampleBankId1;
u32 sampleBankId2;
+6 -6
View File
@@ -27,13 +27,13 @@ void AudioPlayback_InitSampleState(Note* note, NoteSampleState* sampleState, Not
u64 pad;
u8 strongLeft;
u8 strongRight;
f32 vel;
f32 velocity;
u8 pan;
u8 targetReverbVol;
StereoData stereoData;
s32 stereoHeadsetEffects = note->playbackState.stereoHeadsetEffects;
vel = subAttrs->velocity;
velocity = subAttrs->velocity;
pan = subAttrs->pan;
targetReverbVol = subAttrs->targetReverbVol;
stereoData = subAttrs->stereoData;
@@ -116,11 +116,11 @@ void AudioPlayback_InitSampleState(Note* note, NoteSampleState* sampleState, Not
volRight = gDefaultPanVolume[0x7F - pan];
}
vel = 0.0f > vel ? 0.0f : vel;
vel = 1.0f < vel ? 1.0f : vel;
velocity = 0.0f > velocity ? 0.0f : velocity;
velocity = 1.0f < velocity ? 1.0f : velocity;
sampleState->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
sampleState->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
sampleState->targetVolLeft = (s32)((velocity * volLeft) * (0x1000 - 0.001f));
sampleState->targetVolRight = (s32)((velocity * volRight) * (0x1000 - 0.001f));
sampleState->gain = subAttrs->gain;
sampleState->filter = subAttrs->filter;
+3 -3
View File
@@ -821,7 +821,7 @@ s32 AudioScript_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
u8 semitone = cmd;
u16 sfxId;
s32 semitone2;
s32 vel;
s32 velocity;
f32 time;
f32 tuning;
s32 speed2;
@@ -896,10 +896,10 @@ s32 AudioScript_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
if (layer->portamento.mode != PORTAMENTO_MODE_OFF) {
portamento = &layer->portamento;
vel = (semitone > layer->portamentoTargetNote) ? semitone : layer->portamentoTargetNote;
velocity = (semitone > layer->portamentoTargetNote) ? semitone : layer->portamentoTargetNote;
if (instrument != NULL) {
tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, vel);
tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, velocity);
sameTunedSample = (layer->tunedSample == tunedSample);
layer->tunedSample = tunedSample;
tuning = tunedSample->tuning;