1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-11 09:20:17 +00:00

Misc Cleanup (#1585)

* misc cleanup

* more fake matches

* revert for sym
This commit is contained in:
engineer124 2023-11-22 20:19:31 +11:00 committed by GitHub
parent 2aaa286cf8
commit f2c06ce441
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 134 additions and 161 deletions

View file

@ -269,7 +269,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
adsr->delay = 1;
}
adsr->target = adsr->envelope[adsr->envIndex].arg / 32767.0f;
adsr->target = adsr->target * adsr->target;
adsr->target = SQ(adsr->target);
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
adsr->action.s.state = ADSR_STATE_FADE;
adsr->envIndex++;

View file

@ -1356,8 +1356,8 @@ void AudioHeap_ChangeStorage(StorageChange* change, Sample* sample) {
u32 startAddr = change->oldAddr;
u32 endAddr = change->oldAddr + change->size;
if (startAddr <= (u32)sample->sampleAddr && (u32)sample->sampleAddr < endAddr) {
sample->sampleAddr = sample->sampleAddr - startAddr + change->newAddr;
if (((u32)sample->sampleAddr >= startAddr) && ((u32)sample->sampleAddr < endAddr)) {
sample->sampleAddr += -startAddr + change->newAddr;
sample->medium = change->newMedium;
}
}

View file

@ -789,7 +789,7 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) {
* Also relocate offsets into pointers within this loaded soundFont
*
* @param fontId index of font being processed
* @param fontData ram address of raw soundfont binary loaded into cache
* @param fontDataStartAddr ram address of raw soundfont binary loaded into cache
* @param sampleBankReloc information on the sampleBank containing raw audio samples
*/
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) {
@ -811,7 +811,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// The first u32 in fontData is an offset to a list of offsets to the drums
soundListOffset = fontData[0];
if (1) {}
// If the soundFont has drums
if ((soundListOffset != 0) && (numDrums != 0)) {
@ -824,20 +823,24 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
soundOffset = (u32)((Drum**)fontData[0])[i];
// Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
if (soundOffset != 0) {
soundOffset = RELOC_TO_RAM(soundOffset);
((Drum**)fontData[0])[i] = drum = (Drum*)soundOffset;
// The drum may be in the list multiple times and already relocated
if (!drum->isRelocated) {
AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc);
soundOffset = (u32)drum->envelope;
drum->envelope = (EnvelopePoint*)RELOC_TO_RAM(soundOffset);
drum->isRelocated = true;
}
if (soundOffset == 0) {
continue;
}
soundOffset = RELOC_TO_RAM(soundOffset);
((Drum**)fontData[0])[i] = drum = (Drum*)soundOffset;
// The drum may be in the list multiple times and already relocated
if (drum->isRelocated) {
continue;
}
AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc);
soundOffset = (u32)drum->envelope;
drum->envelope = (EnvelopePoint*)RELOC_TO_RAM(soundOffset);
drum->isRelocated = true;
}
}
@ -845,7 +848,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// The second u32 in fontData is an offset to the first sound effect entry
soundListOffset = fontData[1];
if (1) {}
// If the soundFont has sound effects
if ((soundListOffset != 0) && (numSfx != 0)) {
@ -859,9 +861,11 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
soundEffect = (SoundEffect*)soundOffset;
// Check for NULL (note: the pointer is guaranteed to be in fontData and can never be NULL)
if ((soundEffect != NULL) && ((u32)soundEffect->tunedSample.sample != 0)) {
AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc);
if ((soundEffect == NULL) || ((u32)soundEffect->tunedSample.sample == 0)) {
continue;
}
AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc);
}
}