1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 22:44:30 +00:00

audio_heap: 1 non-matching (#381)

* Audio_AllocDmaMemory

* Audio_AllocDmaMemoryZeroed

* func_800DE238

* Audio_SessionPoolsInit

* func_800DE2B0

* func_800DE258

* Audio_DiscardSequence

* Audio_DiscardBank

* func_800DE12C

* Audio_ResetLoadStatus

* func_800DDE3C

* func_800DDE20

* Audio_InitMainPools

* Audio_SoundAllocPoolInit

* Audio_PersistentPoolClear

* Audio_TemporaryPoolClear

* func_800DE4A0

* Audio_PersistentPoolsInit

* Audio_TemporaryPoolsInit

* Formatting

* Audio_SeqAndBankPoolInit

* Audio_Alloc

* Audio_AllocZeroed

* func_800DE4B0

* func_800DF0CC

* func_800DF074

* func_800DF1D8

* func_800DF688

* func_800DF5DC, func_800DF630

* func_800DF7BC

* func_800DF7C4

* func_800DF888

* Fix AudioBufferParameters

* Audio_ResetStep

* Struct work

* oops

* structsss

* wip on func_800DFBF8

* func_800E04E8

* func_800E0540

* func_800E0964

* func_800E1148

* func_800DF5AC

* func_800E0E6C

* func_800E0E90

* func_800E0BF8

* func_800E0634

* func_800E05C4

* func_800E0CBC

* func_800E0C80

* naming

* func_800E0BB4

* func_800E0AD8

* func_800E0E0C

* func_800E0EB4

* func_800E06CC

* Audio_AllocBankOrSeq

* Use true/false macros

* fixup

* Format

* comments

* review

* unk instrument -> sfx

* Reword comment

* Change AVOID_UB to a comment

Co-authored-by: zelda2774 <zelda2774@invalid>
This commit is contained in:
zelda2774 2020-09-20 19:22:09 +02:00 committed by GitHub
parent 9018841660
commit 055d1d2bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 1725 additions and 3420 deletions

View file

@ -21,7 +21,7 @@ void Audio_SequenceChannelProcessSound(SequenceChannel* seqChannel, s32 recalcul
chanFreqScale = seqChannel->freqScale;
if (b != 0) {
chanFreqScale *= seqChannel->seqPlayer->unk_34;
seqChannel->changes.s.freqScale = 1;
seqChannel->changes.s.freqScale = true;
}
for (i = 0; i < 4; i++) {
@ -31,7 +31,7 @@ void Audio_SequenceChannelProcessSound(SequenceChannel* seqChannel, s32 recalcul
layer->noteFreqScale = layer->freqScale * chanFreqScale;
layer->noteVelocity = layer->velocitySquare2 * seqChannel->appliedVolume;
layer->notePan = (seqChannel->pan + layer->pan * (0x80 - seqChannel->panChannelWeight)) >> 7;
layer->notePropertiesNeedInit = 0;
layer->notePropertiesNeedInit = false;
} else {
if (seqChannel->changes.s.freqScale) {
layer->noteFreqScale = layer->freqScale * chanFreqScale;
@ -53,7 +53,7 @@ void Audio_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
if (seqPlayer->fadeTimer != 0) {
seqPlayer->fadeVolume += seqPlayer->fadeVelocity;
seqPlayer->recalculateVolume = 1;
seqPlayer->recalculateVolume = true;
if (seqPlayer->fadeVolume > 1.0f) {
seqPlayer->fadeVolume = 1.0f;
@ -78,7 +78,7 @@ void Audio_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
}
}
seqPlayer->recalculateVolume = 0;
seqPlayer->recalculateVolume = false;
}
f32 Audio_GetPortamentoFreqScale(Portamento* p) {
@ -258,7 +258,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
break;
default:
adsr->delay *= gAudioContext.unk_286C;
adsr->delay *= gAudioContext.gAudioBufferParameters.unk_24;
if (adsr->delay == 0) {
adsr->delay = 1;
}
@ -313,12 +313,12 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
if (adsr->action.s.decay) {
adsr->action.s.state = ADSR_STATE_DECAY;
adsr->action.s.decay = 0;
adsr->action.s.decay = false;
}
if (adsr->action.s.release) {
adsr->action.s.state = ADSR_STATE_RELEASE;
adsr->action.s.release = 0;
adsr->action.s.release = false;
}
if (adsr->current < 0.0f) {

File diff suppressed because it is too large Load diff

View file

@ -27,8 +27,8 @@ void Audio_NoteSetVelPanReverb(Note* note, NoteSubEu* sub, Reverb* reverb) {
pan &= 0x7F;
sub->bitField0.s.stereoStrongRight = 0;
sub->bitField0.s.stereoStrongLeft = 0;
sub->bitField0.s.stereoStrongRight = false;
sub->bitField0.s.stereoStrongLeft = false;
sub->bitField0.s.stereoHeadsetEffects = sp24.stereoHeadsetEffects;
sub->bitField0.s.usesHeadsetPanEffects = sp24.usesHeadsetPanEffects;
if (stereoHeadsetEffects && gAudioContext.gSoundMode == 1) {
@ -39,7 +39,7 @@ void Audio_NoteSetVelPanReverb(Note* note, NoteSubEu* sub, Reverb* reverb) {
sub->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex];
sub->headsetPanRight = gHeadsetPanQuantization[0x3f - smallPanIndex];
sub->bitField1.s.hasTwoAdpcmParts = 1;
sub->bitField1.s.hasTwoAdpcmParts = true;
volLeft = gHeadsetPanVolume[pan];
volRight = gHeadsetPanVolume[0x7f - pan];
@ -47,7 +47,7 @@ void Audio_NoteSetVelPanReverb(Note* note, NoteSubEu* sub, Reverb* reverb) {
strongLeft = strongRight = 0;
sub->headsetPanRight = 0;
sub->headsetPanLeft = 0;
sub->bitField1.s.hasTwoAdpcmParts = 0;
sub->bitField1.s.hasTwoAdpcmParts = false;
volLeft = gStereoPanVolume[pan];
volRight = gStereoPanVolume[0x7f - pan];
@ -78,8 +78,8 @@ void Audio_NoteSetVelPanReverb(Note* note, NoteSubEu* sub, Reverb* reverb) {
}
} else if (gAudioContext.gSoundMode == 3) {
sub->bitField0.s.stereoHeadsetEffects = 0;
sub->bitField0.s.usesHeadsetPanEffects = 0;
sub->bitField0.s.stereoHeadsetEffects = false;
sub->bitField0.s.usesHeadsetPanEffects = false;
volLeft = 0.707f;
volRight = 0.707f;
} else {
@ -106,7 +106,7 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput)
f32 resamplingRate = 0.0f;
if (resamplingRateInput < 2.0f) {
noteSubEu->bitField1.s.isSyntheticWave = 0;
noteSubEu->bitField1.s.isSyntheticWave = false;
if (1.99998f < resamplingRateInput) {
resamplingRate = 1.99998f;
@ -115,7 +115,7 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput)
}
} else {
noteSubEu->bitField1.s.isSyntheticWave = 1;
noteSubEu->bitField1.s.isSyntheticWave = true;
if (3.99996f < resamplingRateInput) {
resamplingRate = 1.99998f;
} else {
@ -140,13 +140,13 @@ void Audio_NoteInit(Note* note) {
}
void Audio_NoteDisable(Note* note) {
if (note->noteSubEu.bitField0.s.needsInit == 1) {
note->noteSubEu.bitField0.s.needsInit = 0;
if (note->noteSubEu.bitField0.s.needsInit == true) {
note->noteSubEu.bitField0.s.needsInit = false;
}
note->playbackState.priority = 0;
note->noteSubEu.bitField0.s.enabled = 0;
note->noteSubEu.bitField0.s.enabled = false;
note->playbackState.unk_04 = 0;
note->noteSubEu.bitField0.s.finished = 0;
note->noteSubEu.bitField0.s.finished = false;
note->playbackState.parentLayer = NO_LAYER;
note->playbackState.prevParentLayer = NO_LAYER;
note->playbackState.adsr.action.s.state = ADSR_STATE_DISABLED;
@ -175,7 +175,7 @@ void Audio_ProcessNotes(void) {
}
if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) {
playbackState->adsr.action.s.release = 1;
playbackState->adsr.action.s.release = true;
playbackState->adsr.fadeOutVel = gAudioContext.gAudioBufferParameters.updatesPerFrameInv;
playbackState->priority = 1;
playbackState->unk_04 = 2;
@ -229,7 +229,7 @@ void Audio_ProcessNotes(void) {
}
} else {
if (playbackState->parentLayer != NO_LAYER) {
playbackState->parentLayer->bit1 = 1;
playbackState->parentLayer->bit1 = true;
}
Audio_NoteDisable(note);
Audio_AudioListRemove(&note->listItem);
@ -239,7 +239,7 @@ void Audio_ProcessNotes(void) {
}
} else if (playbackState->adsr.action.s.state == ADSR_STATE_DISABLED) {
if (playbackState->parentLayer != NO_LAYER) {
playbackState->parentLayer->bit1 = 1;
playbackState->parentLayer->bit1 = true;
}
Audio_NoteDisable(note);
Audio_AudioListRemove(&note->listItem);
@ -362,8 +362,8 @@ Drum* Audio_GetDrum(s32 bankId, s32 drumId) {
return drum;
}
UnkInstrument* Audio_GetUnkInstrument(s32 bankId, s32 unkInstrumentId) {
UnkInstrument* unkInstrument;
AudioBankSound* Audio_GetSfx(s32 bankId, s32 sfxId) {
AudioBankSound* sfx;
if (bankId == 0xFF) {
return NULL;
@ -374,29 +374,29 @@ UnkInstrument* Audio_GetUnkInstrument(s32 bankId, s32 unkInstrumentId) {
return NULL;
}
if (unkInstrumentId >= gAudioContext.gCtlEntries[bankId].numUnkInstruments) {
gAudioContext.gAudioErrorFlags = ((bankId << 8) + unkInstrumentId) + 0x4000000;
if (sfxId >= gAudioContext.gCtlEntries[bankId].numSfx) {
gAudioContext.gAudioErrorFlags = ((bankId << 8) + sfxId) + 0x4000000;
return NULL;
}
if ((u32)gAudioContext.gCtlEntries[bankId].unkInstruments < 0x80000000U) {
if ((u32)gAudioContext.gCtlEntries[bankId].soundEffects < 0x80000000U) {
return NULL;
}
unkInstrument = &gAudioContext.gCtlEntries[bankId].unkInstruments[unkInstrumentId];
sfx = &gAudioContext.gCtlEntries[bankId].soundEffects[sfxId];
if (unkInstrument == NULL) {
gAudioContext.gAudioErrorFlags = ((bankId << 8) + unkInstrumentId) + 0x5000000;
if (sfx == NULL) {
gAudioContext.gAudioErrorFlags = ((bankId << 8) + sfxId) + 0x5000000;
}
if (unkInstrument->unk_0 == 0) {
if (sfx->sample == NULL) {
return NULL;
}
return unkInstrument;
return sfx;
}
s32 func_800E7744(s32 instrument, s32 bankId, s32 instId, UnkInstrument* arg3) {
s32 func_800E7744(s32 instrument, s32 bankId, s32 instId, void* arg3) {
if (bankId == 0xFF) {
return -1;
}
@ -410,21 +410,21 @@ s32 func_800E7744(s32 instrument, s32 bankId, s32 instId, UnkInstrument* arg3) {
if (instId >= gAudioContext.gCtlEntries[bankId].numDrums) {
return -3;
}
gAudioContext.gCtlEntries[bankId].drums[instId] = (void*)arg3;
gAudioContext.gCtlEntries[bankId].drums[instId] = arg3;
break;
case 1:
if (instId >= gAudioContext.gCtlEntries[bankId].numUnkInstruments) {
if (instId >= gAudioContext.gCtlEntries[bankId].numSfx) {
return -3;
}
gAudioContext.gCtlEntries[bankId].unkInstruments[instId] = *arg3;
gAudioContext.gCtlEntries[bankId].soundEffects[instId] = *(AudioBankSound*)arg3;
break;
default:
if (instId >= gAudioContext.gCtlEntries[bankId].numInstruments) {
return -3;
}
gAudioContext.gCtlEntries[bankId].instruments[instId] = (void*)arg3;
gAudioContext.gCtlEntries[bankId].instruments[instId] = arg3;
break;
}
@ -441,7 +441,7 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
return;
}
seqLayer->bit3 = 0;
seqLayer->bit3 = false;
if (seqLayer->note == NULL) {
return;
@ -458,7 +458,7 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER &&
note->playbackState.prevParentLayer == seqLayer && target != ADSR_STATE_DECAY) {
note->playbackState.adsr.fadeOutVel = gAudioContext.gAudioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.action.s.release = 1;
note->playbackState.adsr.action.s.release = true;
}
return;
}
@ -484,7 +484,7 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
attributes->unk_6 = chan->unk_20;
attributes->unk_4 = chan->unk_0F;
if (chan->seqPlayer->muted && (chan->muteBehavior & 8)) {
note->noteSubEu.bitField0.s.finished = 1;
note->noteSubEu.bitField0.s.finished = true;
}
if (seqLayer->reverbBits.asByte == 0) {
@ -502,11 +502,11 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
note->playbackState.parentLayer = NO_LAYER;
if (target == ADSR_STATE_RELEASE) {
note->playbackState.adsr.fadeOutVel = gAudioContext.gAudioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.action.s.release = 1;
note->playbackState.adsr.action.s.release = true;
note->playbackState.unk_04 = 2;
} else {
note->playbackState.unk_04 = 1;
note->playbackState.adsr.action.s.decay = 1;
note->playbackState.adsr.action.s.decay = true;
if (seqLayer->adsr.releaseRate == 0) {
note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[seqLayer->seqChannel->adsr.releaseRate];
} else {
@ -753,8 +753,8 @@ void Audio_NoteInitForLayer(Note* note, SequenceChannelLayer* seqLayer) {
note->playbackState.prevParentLayer = NO_LAYER;
note->playbackState.parentLayer = seqLayer;
playback->priority = seqLayer->seqChannel->notePriority;
seqLayer->notePropertiesNeedInit = 1;
seqLayer->bit3 = 1;
seqLayer->notePropertiesNeedInit = true;
seqLayer->bit3 = true;
seqLayer->note = note;
seqLayer->seqChannel->noteUnused = note;
seqLayer->seqChannel->layerUnused = seqLayer;
@ -768,9 +768,9 @@ void Audio_NoteInitForLayer(Note* note, SequenceChannelLayer* seqLayer) {
sub->sound.audioBankSound = seqLayer->sound;
if (instId >= 0x80 && instId < 0xC0) {
sub->bitField1.s.bit2 = 1;
sub->bitField1.s.bit2 = true;
} else {
sub->bitField1.s.bit2 = 0;
sub->bitField1.s.bit2 = false;
}
if (sub->bitField1.s.bit2) {
@ -792,7 +792,7 @@ void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceChannelLayer* seqLaye
note->playbackState.priority = seqLayer->seqChannel->notePriority;
note->playbackState.adsr.fadeOutVel = gAudioContext.gAudioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.action.s.release = 1;
note->playbackState.adsr.action.s.release = true;
}
Note* Audio_AllocNoteFromDisabled(NotePool* pool, SequenceChannelLayer* seqLayer) {
@ -906,7 +906,7 @@ Note* Audio_AllocNote(SequenceChannelLayer* seqLayer) {
return ret;
null_return:
seqLayer->bit3 = 1;
seqLayer->bit3 = true;
return NULL;
}
@ -929,7 +929,7 @@ void Audio_NoteInitAll(void) {
note->vibratoState.active = 0;
note->portamento.cur = 0;
note->portamento.speed = 0;
note->playbackState.stereoHeadsetEffects = 0;
note->playbackState.stereoHeadsetEffects = false;
note->unk_BC = 0;
note->synthesisState.synthesisBuffers = Audio_AllocDmaMemory(&gAudioContext.gNotesAndBuffersPool, 0x1E0);
}

View file

@ -110,14 +110,14 @@ void Audio_SequenceChannelInit(SequenceChannel* seqChannel) {
return;
}
seqChannel->enabled = 0;
seqChannel->finished = 0;
seqChannel->stopScript = 0;
seqChannel->stopSomething2 = 0;
seqChannel->hasInstrument = 0;
seqChannel->stereoHeadsetEffects = 0;
seqChannel->enabled = false;
seqChannel->finished = false;
seqChannel->stopScript = false;
seqChannel->stopSomething2 = false;
seqChannel->hasInstrument = false;
seqChannel->stereoHeadsetEffects = false;
seqChannel->transposition = 0;
seqChannel->largeNotes = 0;
seqChannel->largeNotes = false;
seqChannel->bookOffset = 0;
seqChannel->reverbBits.asByte = 0;
seqChannel->changes.asByte = 0xff;
@ -154,7 +154,7 @@ void Audio_SequenceChannelInit(SequenceChannel* seqChannel) {
seqChannel->soundScriptIO[i] = -1;
}
seqChannel->unused = 0;
seqChannel->unused = false;
Audio_InitNoteLists(&seqChannel->notePool);
}
@ -177,14 +177,14 @@ s32 Audio_SeqChannelSetLayer(SequenceChannel* seqChannel, s32 layerIdx) {
layer->seqChannel = seqChannel;
layer->adsr = seqChannel->adsr;
layer->adsr.releaseRate = 0;
layer->enabled = 1;
layer->finished = 0;
layer->stopSomething = 0;
layer->continuousNotes = 0;
layer->bit3 = 0;
layer->ignoreDrumPan = 0;
layer->bit1 = 0;
layer->notePropertiesNeedInit = 0;
layer->enabled = true;
layer->finished = false;
layer->stopSomething = false;
layer->continuousNotes = false;
layer->bit3 = false;
layer->ignoreDrumPan = false;
layer->bit1 = false;
layer->notePropertiesNeedInit = false;
layer->reverbBits.asByte = 0;
layer->portamento.mode = 0;
layer->scriptState.depth = 0;
@ -210,8 +210,8 @@ void Audio_SeqChannelLayerDisable(SequenceChannelLayer* layer) {
} else {
Audio_SeqChanLayerNoteDecay(layer);
}
layer->enabled = 0;
layer->finished = 1;
layer->enabled = false;
layer->finished = true;
}
}
@ -232,8 +232,8 @@ void Audio_SequenceChannelDisable(SequenceChannel* seqChannel) {
}
Audio_NotePoolClear(&seqChannel->notePool);
seqChannel->enabled = 0;
seqChannel->finished = 1;
seqChannel->enabled = false;
seqChannel->finished = true;
}
void Audio_SequencePlayerInitChannels(SequencePlayer* seqPlayer, u16 channelBits) {
@ -267,8 +267,8 @@ void Audio_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIdx, void*
SequenceChannel* seqChannel = seqPlayer->channels[channelIdx];
s32 i;
seqChannel->enabled = 1;
seqChannel->finished = 0;
seqChannel->enabled = true;
seqChannel->finished = false;
seqChannel->scriptState.depth = 0;
seqChannel->scriptState.pc = script;
seqChannel->delay = 0;
@ -280,7 +280,7 @@ void Audio_SequenceChannelEnable(SequencePlayer* seqPlayer, u8 channelIdx, void*
}
void Audio_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer) {
seqPlayer->finished = 1;
seqPlayer->finished = true;
Audio_SequencePlayerDisable(seqPlayer);
}
@ -290,8 +290,8 @@ void Audio_SequencePlayerDisable(SequencePlayer* seqPlayer) {
if (!seqPlayer->enabled) {
return;
}
seqPlayer->enabled = 0;
seqPlayer->finished = 1;
seqPlayer->enabled = false;
seqPlayer->finished = true;
if (Audio_IsSeqLoadComplete(seqPlayer->seqId)) {
Audio_SetSeqLoadStatus(seqPlayer->seqId, 3);
@ -381,7 +381,7 @@ void Audio_SeqChannelLayerProcessScript(SequenceChannelLayer* layer) {
layer->delay--;
if (!layer->stopSomething && layer->delay <= layer->duration) {
Audio_SeqChanLayerNoteDecay(layer);
layer->stopSomething = 1;
layer->stopSomething = true;
}
return;
}
@ -418,13 +418,13 @@ void func_800E9ED8(SequenceChannelLayer* layer) {
PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_2) {
layer->portamento.mode = 0;
}
layer->notePropertiesNeedInit = 1;
layer->notePropertiesNeedInit = true;
}
s32 func_800E9F64(SequenceChannelLayer* layer, s32 arg1) {
if (!layer->stopSomething && layer->sound != NULL && layer->sound->sample->bits4 == 2 &&
layer->sound->sample->bits2 != 0) {
layer->stopSomething = 1;
layer->stopSomething = true;
return -1;
}
@ -503,11 +503,11 @@ s32 func_800EA0C0(SequenceChannelLayer* layer) {
case 0xC4: // layer_continuousnoteson
case 0xC5: // layer_continuousnotesoff
if (cmd == 0xC4) {
layer->continuousNotes = 1;
layer->continuousNotes = true;
} else {
layer->continuousNotes = 0;
layer->continuousNotes = false;
}
layer->bit1 = 0;
layer->bit1 = false;
Audio_SeqChanLayerNoteDecay(layer);
break;
@ -578,7 +578,7 @@ s32 func_800EA0C0(SequenceChannelLayer* layer) {
break;
case 0xCC:
layer->ignoreDrumPan = 1;
layer->ignoreDrumPan = true;
break;
case 0xCD:
@ -617,11 +617,11 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
AudioBankSound* sound;
Instrument* instrument;
Drum* drum;
AudioBankSound* unkInstrument;
s32 pad;
SequenceChannel* seqChannel;
SequencePlayer* seqPlayer;
u8 cmd;
u16 unkInstrumentId;
u16 sfxId;
s32 cmd2;
s32 vel;
f32 time;
@ -647,7 +647,7 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
layer->semitone = cmd;
drum = Audio_GetDrum(seqChannel->bankId, cmd);
if (drum == NULL) {
layer->stopSomething = 1;
layer->stopSomething = true;
layer->delay2 = layer->delay;
return -1;
}
@ -663,10 +663,10 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
case 1:
layer->semitone = cmd;
unkInstrumentId = (layer->transposition << 6) + cmd;
sound = (AudioBankSound*)Audio_GetUnkInstrument(seqChannel->bankId, unkInstrumentId);
sfxId = (layer->transposition << 6) + cmd;
sound = Audio_GetSfx(seqChannel->bankId, sfxId);
if (sound == NULL) {
layer->stopSomething = 1;
layer->stopSomething = true;
layer->delay2 = layer->delay + 1;
return -1;
}
@ -679,7 +679,7 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
cmd2 = cmd;
layer->semitone = cmd;
if (cmd >= 0x80) {
layer->stopSomething = 1;
layer->stopSomething = true;
return -1;
}
if (layer->instOrWave == 0xFF) {
@ -701,7 +701,7 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
layer->sound = NULL;
tuning = 1.0f;
if (instOrWave >= 0xC0) {
layer->sound = &gAudioContext.largeSounds[instOrWave - 0xC0].sound;
layer->sound = &gAudioContext.gSynthesisReverbs[instOrWave - 0xC0].sound;
}
}
@ -729,12 +729,12 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
portamento->extent = (freqScale2 / freqScale) - 1.0f;
if (PORTAMENTO_IS_SPECIAL(*portamento)) {
speed = seqPlayer->tempo * 0x8000 / gAudioContext.unk_2898;
speed = seqPlayer->tempo * 0x8000 / gAudioContext.gTempoInternalToExternal;
if (layer->delay != 0) {
speed = speed * 0x100 / (layer->delay * layer->portamentoTime);
}
} else {
speed = 0x20000 / (layer->portamentoTime * gAudioContext.gAudioBufferParameters.unk_08);
speed = 0x20000 / (layer->portamentoTime * gAudioContext.gAudioBufferParameters.updatesPerFrame);
}
if (speed >= 0x7FFF) {
@ -761,7 +761,7 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
layer->sound = NULL;
layer->freqScale = gNoteFrequencies[cmd2];
if (instOrWave >= 0xC0) {
layer->sound = &gAudioContext.largeSounds[instOrWave - 0xC0].sound;
layer->sound = &gAudioContext.gSynthesisReverbs[instOrWave - 0xC0].sound;
}
}
break;
@ -788,7 +788,7 @@ s32 func_800EA440(SequenceChannelLayer* layer, s32 arg1) {
// set when this is reached...)
if (PORTAMENTO_IS_SPECIAL(*portamento)) {
s32 speed2;
speed2 = seqPlayer->tempo * 0x8000 / gAudioContext.unk_2898;
speed2 = seqPlayer->tempo * 0x8000 / gAudioContext.gTempoInternalToExternal;
speed2 = speed2 * 0x100 / (layer->delay * layer->portamentoTime);
if (speed2 >= 0x7FFF) {
speed2 = 0x7FFF;
@ -817,12 +817,12 @@ s32 func_800EAAE0(SequenceChannelLayer* layer, s32 arg1) {
if (arg1 == 0xC0) {
layer->delay = Audio_M64ReadCompressedU16(state);
layer->stopSomething = 1;
layer->bit1 = 0;
layer->stopSomething = true;
layer->bit1 = false;
return -1;
}
layer->stopSomething = 0;
layer->stopSomething = false;
if (seqChannel->largeNotes == 1) {
switch (arg1 & 0xC0) {
case 0:
@ -902,11 +902,11 @@ s32 func_800EAAE0(SequenceChannelLayer* layer, s32 arg1) {
}
if ((seqPlayer->muted && (seqChannel->muteBehavior & (0x40 | 0x10)) != 0) || seqChannel->stopSomething2) {
layer->stopSomething = 1;
layer->stopSomething = true;
return -1;
}
if (seqPlayer->unk_DC != 0) {
layer->stopSomething = 1;
layer->stopSomething = true;
return -1;
}
return arg1;
@ -947,10 +947,10 @@ void Audio_SetInstrument(SequenceChannel* seqChannel, u8 instId) {
seqChannel->instrument = (Instrument*)2;
} else if ((seqChannel->instOrWave =
Audio_GetInstrument(seqChannel, instId, &seqChannel->instrument, &seqChannel->adsr)) == 0) {
seqChannel->hasInstrument = 0;
seqChannel->hasInstrument = false;
return;
}
seqChannel->hasInstrument = 1;
seqChannel->hasInstrument = true;
}
void Audio_SequenceChannelSetVolume(SequenceChannel* seqChannel, u8 volume) {
@ -970,8 +970,8 @@ void Audio_ProcessSequences(s32 arg0) {
u32 i;
gAudioContext.gNoteSubEuOffset =
(gAudioContext.gAudioBufferParameters.unk_08 - arg0 - 1) * gAudioContext.gMaxSimultaneousNotes;
for (i = 0; i < (u32)gAudioContext.gAudioBufferParameters.unk_10; i++) {
(gAudioContext.gAudioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioContext.gMaxSimultaneousNotes;
for (i = 0; i < (u32)gAudioContext.gAudioBufferParameters.numSequencePlayers; i++) {
seqPlayer = &gAudioContext.gSequencePlayers[i];
if (seqPlayer->enabled == 1) {
Audio_SequencePlayerProcessSequence(seqPlayer);
@ -993,7 +993,7 @@ void Audio_ResetSequencePlayer(SequencePlayer* seqPlayer) {
s32 i;
Audio_SequencePlayerDisable(seqPlayer);
seqPlayer->unk_0b2 = 0;
seqPlayer->unk_0b2 = false;
seqPlayer->delay = 0;
seqPlayer->state = 1;
seqPlayer->fadeTimer = 0;
@ -1029,7 +1029,7 @@ void func_800EC734(s32 seqPlayerIdx) {
} else {
seqChannel = seqPlayer->channels[i];
seqChannel->seqPlayer = seqPlayer;
seqChannel->enabled = 0;
seqChannel->enabled = false;
for (j = 0; j < 4; j++) {
seqChannel->layers[j] = NULL;
}
@ -1045,11 +1045,11 @@ void Audio_InitSequencePlayer(SequencePlayer* seqPlayer) {
seqPlayer->channels[i] = &gAudioContext.gSequenceChannelNone;
}
seqPlayer->enabled = 0;
seqPlayer->muted = 0;
seqPlayer->bankDmaInProgress = 0;
seqPlayer->seqDmaInProgress = 0;
seqPlayer->unk_0b1 = 0;
seqPlayer->enabled = false;
seqPlayer->muted = false;
seqPlayer->bankDmaInProgress = false;
seqPlayer->seqDmaInProgress = false;
seqPlayer->unk_0b1 = false;
for (j = 0; j < 8; j++) {
seqPlayer->unk_158[j] = -1;
@ -1067,7 +1067,7 @@ void Audio_InitSequencePlayers(void) {
Audio_InitLayerFreelist();
for (i = 0; i < 64; i++) {
gAudioContext.gSequenceLayers[i].seqChannel = NULL;
gAudioContext.gSequenceLayers[i].enabled = 0;
gAudioContext.gSequenceLayers[i].enabled = false;
}
for (i = 0; i < 4; i++) {