mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-17 13:24:45 +00:00
[Audio 6/?] Build Soundfonts and the Soundfont Table (#2056)
* [Audio 6/?] Build Soundfonts and the Soundfont Table * Improve lots of error messages * First suggested changes * Make audio build debugging more friendly Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Some fixes from MM review * Make soundfont_table.h generation depend on the samplebank xmls since they are read, report from which soundfont the invalid pointer indirect warning originates from --------- Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
This commit is contained in:
parent
17debe8620
commit
aa97586659
40 changed files with 2775 additions and 87 deletions
|
@ -1002,9 +1002,9 @@ void AudioHeap_Init(void) {
|
|||
reverb->sample.medium = MEDIUM_RAM;
|
||||
reverb->sample.size = reverb->windowSize * SAMPLE_SIZE;
|
||||
reverb->sample.sampleAddr = (u8*)reverb->leftRingBuf;
|
||||
reverb->loop.start = 0;
|
||||
reverb->loop.count = 1;
|
||||
reverb->loop.end = reverb->windowSize;
|
||||
reverb->loop.header.start = 0;
|
||||
reverb->loop.header.count = 1;
|
||||
reverb->loop.header.end = reverb->windowSize;
|
||||
|
||||
if (reverb->downsampleRate != 1) {
|
||||
reverb->unk_0E = 0x8000 / reverb->downsampleRate;
|
||||
|
|
|
@ -1214,7 +1214,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
|
|||
|
||||
// Set audio tables pointers
|
||||
gAudioCtx.sequenceTable = (AudioTable*)gSequenceTable;
|
||||
gAudioCtx.soundFontTable = (AudioTable*)gSoundFontTable;
|
||||
gAudioCtx.soundFontTable = &gSoundFontTable;
|
||||
gAudioCtx.sampleBankTable = &gSampleBankTable;
|
||||
gAudioCtx.sequenceFontTable = gSequenceFontTable;
|
||||
|
||||
|
|
|
@ -946,7 +946,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
|||
|
||||
if (layer->delay == 0) {
|
||||
if (layer->tunedSample != NULL) {
|
||||
time = layer->tunedSample->sample->loop->end;
|
||||
time = layer->tunedSample->sample->loop->header.end;
|
||||
} else {
|
||||
time = 0.0f;
|
||||
}
|
||||
|
|
|
@ -796,7 +796,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
} else {
|
||||
sample = noteSubEu->tunedSample->sample;
|
||||
loopInfo = sample->loop;
|
||||
loopEndPos = loopInfo->end;
|
||||
loopEndPos = loopInfo->header.end;
|
||||
sampleAddr = (u32)sample->sampleAddr;
|
||||
resampledTempLen = 0;
|
||||
|
||||
|
@ -829,7 +829,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
if (1) {}
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
nEntries = SAMPLES_PER_FRAME * sample->book->order * sample->book->numPredictors;
|
||||
nEntries = SAMPLES_PER_FRAME * sample->book->header.order * sample->book->header.numPredictors;
|
||||
aLoadADPCM(cmd++, nEntries, gAudioCtx.curLoadedBook);
|
||||
}
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
nSamplesInFirstFrame = nSamplesUntilLoopEnd;
|
||||
}
|
||||
nFramesToDecode = (nSamplesToDecode + SAMPLES_PER_FRAME - 1) / SAMPLES_PER_FRAME;
|
||||
if (loopInfo->count != 0) {
|
||||
if (loopInfo->header.count != 0) {
|
||||
// Loop around and restart
|
||||
restart = true;
|
||||
} else {
|
||||
|
@ -1019,7 +1019,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
} else {
|
||||
if (restart) {
|
||||
synthState->restart = true;
|
||||
synthState->samplePosInt = loopInfo->start;
|
||||
synthState->samplePosInt = loopInfo->header.start;
|
||||
} else {
|
||||
synthState->samplePosInt += nSamplesToProcess;
|
||||
}
|
||||
|
|
|
@ -795,7 +795,7 @@ s32 func_800E6590(s32 seqPlayerIndex, s32 channelIndex, s32 layerIndex) {
|
|||
if (tunedSample == NULL) {
|
||||
return 0;
|
||||
}
|
||||
loopEnd = tunedSample->sample->loop->end;
|
||||
loopEnd = tunedSample->sample->loop->header.end;
|
||||
samplePos = note->synthesisState.samplePosInt;
|
||||
return loopEnd - samplePos;
|
||||
}
|
||||
|
|
50
src/audio/tables/soundfont_table.c
Normal file
50
src/audio/tables/soundfont_table.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include "attributes.h"
|
||||
#include "z64audio.h"
|
||||
|
||||
// Symbol definition
|
||||
|
||||
extern AudioTable gSoundFontTable;
|
||||
#pragma weak gSoundFontTable = sSoundFontTableHeader
|
||||
|
||||
// Externs for table
|
||||
|
||||
#define DEFINE_SOUNDFONT(name, medium, cachePolicy, sampleBankNormal, sampleBankDD, nInstruments, nDrums, nSfx) \
|
||||
extern u8 name##_Start[]; \
|
||||
extern u8 name##_Size[];
|
||||
|
||||
#include "assets/audio/soundfont_table.h"
|
||||
|
||||
#undef DEFINE_SOUNDFONT
|
||||
|
||||
// Table header
|
||||
|
||||
NO_REORDER AudioTableHeader sSoundFontTableHeader = {
|
||||
// The table contains the number of soundfonts, count them with the preprocessor
|
||||
#define DEFINE_SOUNDFONT(name, medium, cachePolicy, sampleBankNormal, sampleBankDD, nInstruments, nDrums, nSfx) 1 +
|
||||
|
||||
#include "assets/audio/soundfont_table.h"
|
||||
0,
|
||||
|
||||
#undef DEFINE_SOUNDFONT
|
||||
|
||||
0,
|
||||
0x00000000,
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
};
|
||||
|
||||
// Table body
|
||||
|
||||
NO_REORDER AudioTableEntry sSoundFontTableEntries[] = {
|
||||
#define DEFINE_SOUNDFONT(name, medium, cachePolicy, sampleBankNormal, sampleBankDD, nInstruments, nDrums, nSfx) \
|
||||
{ (u32)name##_Start, \
|
||||
(u32)name##_Size, \
|
||||
(medium), \
|
||||
(cachePolicy), \
|
||||
((sampleBankNormal) << 8) | (sampleBankDD), \
|
||||
((nInstruments) << 8) | (nDrums), \
|
||||
(nSfx) },
|
||||
|
||||
#include "assets/audio/soundfont_table.h"
|
||||
|
||||
#undef DEFINE_SOUNDFONT
|
||||
};
|
|
@ -4,7 +4,7 @@
|
|||
#define GFXPOOL_HEAD_MAGIC 0x1234
|
||||
#define GFXPOOL_TAIL_MAGIC 0x5678
|
||||
|
||||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
|
||||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
|
||||
/**
|
||||
* The time at which the previous `Graph_Update` ended.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128"
|
||||
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128"
|
||||
|
||||
#include "global.h"
|
||||
#include "terminal.h"
|
||||
|
|
|
@ -12,8 +12,6 @@ typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec
|
|||
|
||||
#define SAC_ENABLE (1 << 0)
|
||||
|
||||
#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64"
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* Draws a red triangle with vertices vA, vB, and vC.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
#include "global.h"
|
||||
#include "quake.h"
|
||||
#include "terminal.h"
|
||||
|
@ -5,8 +6,6 @@
|
|||
|
||||
#include "z64frame_advance.h"
|
||||
|
||||
#pragma increment_block_number "gc-eu:252 gc-eu-mq:252 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0"
|
||||
|
||||
TransitionTile gTransitionTile;
|
||||
s32 gTransitionTileState;
|
||||
VisMono gPlayVisMono;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "cic6105.h"
|
||||
#endif
|
||||
|
||||
#pragma increment_block_number "gc-eu:171 gc-eu-mq:171 gc-jp:173 gc-jp-ce:173 gc-jp-mq:173 gc-us:173 gc-us-mq:173"
|
||||
#pragma increment_block_number "gc-eu:164 gc-eu-mq:164 gc-jp:166 gc-jp-ce:166 gc-jp-mq:166 gc-us:166 gc-us-mq:166"
|
||||
|
||||
#define FLAGS ACTOR_FLAG_4
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue