Removed legacy audio mode and fixed ganon sound bug (#657)
This commit is contained in:
committed by
GitHub
parent
eab3b5bd7f
commit
3aa93b9855
@@ -288,7 +288,8 @@ void Audio_ProcessNotes(void) {
|
||||
|
||||
f32 resampRate = gAudioContext.audioBufferParameters.resampleRate;
|
||||
|
||||
if (!gUseLegacySD && !noteSubEu2->bitField1.isSyntheticWave && noteSubEu2->sound.soundFontSound != NULL &&
|
||||
// CUSTOM SAMPLE CHECK
|
||||
if (!noteSubEu2->bitField1.isSyntheticWave && noteSubEu2->sound.soundFontSound != NULL &&
|
||||
noteSubEu2->sound.soundFontSound->sample != NULL &&
|
||||
noteSubEu2->sound.soundFontSound->sample->sampleRateMagicValue == 'RIFF') {
|
||||
resampRate = CALC_RESAMPLE_FREQ(noteSubEu2->sound.soundFontSound->sample->sampleRate);
|
||||
@@ -330,24 +331,12 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
||||
}
|
||||
|
||||
int instCnt = 0;
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
|
||||
if (gUseLegacySD) {
|
||||
instCnt = gAudioContext.soundFonts[fontId].numInstruments;
|
||||
inst = gAudioContext.soundFonts[fontId].instruments[instId];
|
||||
if (instId >= sf->numInstruments)
|
||||
return NULL;
|
||||
|
||||
if (instId >= gAudioContext.soundFonts[fontId].numInstruments)
|
||||
if (instId >= instCnt) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
|
||||
if (instId >= sf->numInstruments)
|
||||
return NULL;
|
||||
|
||||
inst = sf->instruments[instId];
|
||||
}
|
||||
inst = sf->instruments[instId];
|
||||
|
||||
if (inst == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
||||
@@ -369,18 +358,10 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (gUseLegacySD) {
|
||||
if (drumId >= gAudioContext.soundFonts[fontId].numDrums) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
drum = gAudioContext.soundFonts[fontId].drums[drumId];
|
||||
} else {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
drum = sf->drums[drumId];
|
||||
}
|
||||
|
||||
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
drum = sf->drums[drumId];
|
||||
|
||||
if (drum == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
|
||||
}
|
||||
@@ -400,17 +381,8 @@ SoundFontSound* Audio_GetSfx(s32 fontId, s32 sfxId) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (gUseLegacySD) {
|
||||
if (sfxId >= gAudioContext.soundFonts[fontId].numSfx) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sfx = &gAudioContext.soundFonts[fontId].soundEffects[sfxId];
|
||||
} else {
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
sfx = &sf->soundEffects[sfxId];
|
||||
}
|
||||
SoundFont* sf = ResourceMgr_LoadAudioSoundFont(fontMap[fontId]);
|
||||
sfx = &sf->soundEffects[sfxId];
|
||||
|
||||
if (sfx == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
|
||||
|
||||
Reference in New Issue
Block a user