mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-23 00:28:51 -05:00
Fixed resample and corrupt audio bug. Minor documentation updates.
This commit is contained in:
parent
b66174c3ec
commit
83aee6d7e1
@ -18,7 +18,9 @@
|
|||||||
|
|
||||||
#define AIBUF_LEN 0x580
|
#define AIBUF_LEN 0x580
|
||||||
|
|
||||||
#define CALC_RESAMPLE_FREQ(sampleRate) (sampleRate / (s32)gAudioContext.audioBufferParameters.frequency)
|
#define CALC_RESAMPLE_FREQ(sampleRate) ((float)sampleRate / (s32)gAudioContext.audioBufferParameters.frequency)
|
||||||
|
|
||||||
|
extern bool gUseLegacySD;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* 0 */ ADSR_STATE_DISABLED,
|
/* 0 */ ADSR_STATE_DISABLED,
|
||||||
|
@ -639,7 +639,7 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
|
|||||||
// OTRTODO: Grab loop data from wav
|
// OTRTODO: Grab loop data from wav
|
||||||
sampleC->loop = (AdpcmLoop*)malloc(sizeof(AdpcmLoop));
|
sampleC->loop = (AdpcmLoop*)malloc(sizeof(AdpcmLoop));
|
||||||
sampleC->loop->start = 0;
|
sampleC->loop->start = 0;
|
||||||
sampleC->loop->end = sampleC->size / 2;
|
sampleC->loop->end = sampleC->size / 2; // OTRTODO: This calculation is probably incorrect... Sometimes it goes past the sample, sometimes it stops too early...
|
||||||
sampleC->loop->count = 0;
|
sampleC->loop->count = 0;
|
||||||
sampleC->sampleRateMagicValue = 'RIFF';
|
sampleC->sampleRateMagicValue = 'RIFF';
|
||||||
sampleC->sampleRate = sampleRate;
|
sampleC->sampleRate = sampleRate;
|
||||||
|
@ -1421,6 +1421,10 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||||||
uintptr_t bankStart = ResourceMgr_LoadFileRaw(_AudiobankSegmentRomStart);
|
uintptr_t bankStart = ResourceMgr_LoadFileRaw(_AudiobankSegmentRomStart);
|
||||||
uintptr_t tableStart = ResourceMgr_LoadFileRaw(_AudiotableSegmentRomStart);
|
uintptr_t tableStart = ResourceMgr_LoadFileRaw(_AudiotableSegmentRomStart);
|
||||||
|
|
||||||
|
// If we have the old audioseq files present (and this is a 32-bit build), use the legacy audio system
|
||||||
|
if (seqStart != NULL && bankStart != NULL && tableStart != NULL)
|
||||||
|
gUseLegacySD = true;
|
||||||
|
|
||||||
fontStart = bankStart;
|
fontStart = bankStart;
|
||||||
|
|
||||||
AudioLoad_InitTable(gAudioContext.sequenceTable, seqStart, 0);
|
AudioLoad_InitTable(gAudioContext.sequenceTable, seqStart, 0);
|
||||||
|
@ -2093,9 +2093,14 @@ void func_80075B44(GlobalContext* globalCtx) {
|
|||||||
case 7:
|
case 7:
|
||||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3,
|
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3,
|
||||||
CHANNEL_IO_PORT_1, 0);
|
CHANNEL_IO_PORT_1, 0);
|
||||||
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) {
|
if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0)
|
||||||
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5,
|
{
|
||||||
CHANNEL_IO_PORT_1, 1);
|
// OTRTODO: This is where corrupt audio happens. Commenting this out seems to not introduce any side effects?
|
||||||
|
// Further investigation is needed...
|
||||||
|
|
||||||
|
if (gUseLegacySD)
|
||||||
|
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5,
|
||||||
|
CHANNEL_IO_PORT_1, 1);
|
||||||
}
|
}
|
||||||
globalCtx->envCtx.unk_E0++;
|
globalCtx->envCtx.unk_E0++;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user