mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-02-03 00:33:55 +03:00
fix reverbs: co-authored-by: @m4xw
This commit is contained in:
parent
e61aeddb64
commit
b35697e28d
@ -53,7 +53,7 @@ typedef void (*AudioCustomUpdateFunction)(void);
|
|||||||
#define SAMPLES_PER_FRAME ADPCMFSIZE
|
#define SAMPLES_PER_FRAME ADPCMFSIZE
|
||||||
|
|
||||||
// The length of one left/right channel is 13 frames
|
// The length of one left/right channel is 13 frames
|
||||||
#define DMEM_1CH_SIZE (13 * SAMPLES_PER_FRAME * SAMPLE_SIZE)
|
#define DMEM_1CH_SIZE (12 * SAMPLES_PER_FRAME * SAMPLE_SIZE)
|
||||||
// Both left and right channels
|
// Both left and right channels
|
||||||
#define DMEM_2CH_SIZE (2 * DMEM_1CH_SIZE)
|
#define DMEM_2CH_SIZE (2 * DMEM_1CH_SIZE)
|
||||||
|
|
||||||
@ -610,7 +610,7 @@ typedef struct {
|
|||||||
/* 0x06 */ u16 panVolLeft;
|
/* 0x06 */ u16 panVolLeft;
|
||||||
/* 0x08 */ u16 panVolRight;
|
/* 0x08 */ u16 panVolRight;
|
||||||
/* 0x0A */ u16 resampleRate;
|
/* 0x0A */ u16 resampleRate;
|
||||||
/* 0x0C */ s16* waveSampleAddr;
|
/* 0x0C */ Sample** waveSampleAddr;
|
||||||
} NoteSubEu; // size = 0x10
|
} NoteSubEu; // size = 0x10
|
||||||
|
|
||||||
typedef struct Note {
|
typedef struct Note {
|
||||||
@ -623,7 +623,7 @@ typedef struct Note {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ u8 downsampleRate;
|
/* 0x00 */ u8 downsampleRate;
|
||||||
/* 0x02 */ u8 windowSize;
|
/* 0x01 */ u8 windowSize;
|
||||||
/* 0x02 */ u16 decayRatio; // determines how much reverb persists
|
/* 0x02 */ u16 decayRatio; // determines how much reverb persists
|
||||||
/* 0x04 */ u16 leakRtL;
|
/* 0x04 */ u16 leakRtL;
|
||||||
/* 0x06 */ u16 leakLtR;
|
/* 0x06 */ u16 leakLtR;
|
||||||
|
@ -628,8 +628,6 @@ void AudioHeap_Init(void) {
|
|||||||
s32 i;
|
s32 i;
|
||||||
s32 j;
|
s32 j;
|
||||||
AudioSpec* spec = &gAudioSpecs[gAudioSpecId];
|
AudioSpec* spec = &gAudioSpecs[gAudioSpecId];
|
||||||
ReverbSettings* settings;
|
|
||||||
SynthesisReverb* reverb;
|
|
||||||
s16* ramAddr;
|
s16* ramAddr;
|
||||||
u32 persistentSize;
|
u32 persistentSize;
|
||||||
u32 temporarySize;
|
u32 temporarySize;
|
||||||
@ -715,12 +713,10 @@ void AudioHeap_Init(void) {
|
|||||||
gSynthReverbs[i].useReverb = 0;
|
gSynthReverbs[i].useReverb = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LTODO: Reverbs are causing distortion.
|
|
||||||
/*
|
|
||||||
gNumSynthReverbs = spec->numReverbs;
|
gNumSynthReverbs = spec->numReverbs;
|
||||||
for (i = 0; i < gNumSynthReverbs; i++) {
|
for (i = 0; i < gNumSynthReverbs; i++) {
|
||||||
settings = &spec->reverbSettings[i];
|
ReverbSettings* settings = &spec->reverbSettings[i];
|
||||||
reverb = &gSynthReverbs[i];
|
SynthesisReverb* reverb = &gSynthReverbs[i];
|
||||||
reverb->downsampleRate = settings->downsampleRate;
|
reverb->downsampleRate = settings->downsampleRate;
|
||||||
reverb->windowSize = settings->windowSize * 64;
|
reverb->windowSize = settings->windowSize * 64;
|
||||||
reverb->decayRatio = settings->decayRatio;
|
reverb->decayRatio = settings->decayRatio;
|
||||||
@ -736,6 +732,7 @@ void AudioHeap_Init(void) {
|
|||||||
|
|
||||||
reverb->bufSizePerChan = reverb->windowSize;
|
reverb->bufSizePerChan = reverb->windowSize;
|
||||||
reverb->framesToIgnore = 2;
|
reverb->framesToIgnore = 2;
|
||||||
|
|
||||||
if (reverb->downsampleRate != 1) {
|
if (reverb->downsampleRate != 1) {
|
||||||
reverb->resampleFlags = 1;
|
reverb->resampleFlags = 1;
|
||||||
reverb->unk_0A = (0x8000 / reverb->downsampleRate);
|
reverb->unk_0A = (0x8000 / reverb->downsampleRate);
|
||||||
@ -753,7 +750,7 @@ void AudioHeap_Init(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
AudioLoad_InitSampleDmaBuffers(gNumNotes);
|
AudioLoad_InitSampleDmaBuffers(gNumNotes);
|
||||||
gPreloadSampleStackTop = 0;
|
gPreloadSampleStackTop = 0;
|
||||||
D_8014C1B4 = 0x1000;
|
D_8014C1B4 = 0x1000;
|
||||||
@ -933,7 +930,8 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) {
|
|||||||
sampleBankId1 = gSoundFontList[fondId].sampleBankId1;
|
sampleBankId1 = gSoundFontList[fondId].sampleBankId1;
|
||||||
sampleBankId2 = gSoundFontList[fondId].sampleBankId2;
|
sampleBankId2 = gSoundFontList[fondId].sampleBankId2;
|
||||||
if (((sampleBankId1 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId1)) ||
|
if (((sampleBankId1 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId1)) ||
|
||||||
((sampleBankId2 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId2)) || (entry->sampleBankId == SAMPLES_SFX)) {
|
((sampleBankId2 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId2)) ||
|
||||||
|
(entry->sampleBankId == SAMPLES_SFX)) {
|
||||||
if (((void*) AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, fondId) != NULL) &&
|
if (((void*) AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, fondId) != NULL) &&
|
||||||
(gFontLoadStatus[fondId] > 1) != 0) {
|
(gFontLoadStatus[fondId] > 1) != 0) {
|
||||||
for (instId = 0; instId < gSoundFontList[fondId].numInstruments; instId++) {
|
for (instId = 0; instId < gSoundFontList[fondId].numInstruments; instId++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user