Match AudioSynth_ProcessNote! (#279)
Some checks are pending
Build / Build repo (push) Waiting to run
Check Format / Check format (push) Waiting to run

* team faces

* fix audio table data in jp version

* audio docs

* Match! AudioSynth_ProcessNote

* .
This commit is contained in:
Alejandro Asenjo Nitti 2024-11-10 04:20:04 -03:00 committed by GitHub
parent f9ec3bb431
commit 976fb57a84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 1439 additions and 995 deletions

View File

@ -20,21 +20,21 @@ f7475fb11e7e6830f82883412638e8390791ab87:
- include/sf64event.h
- include/sf64player.h
d064229a32cc05ab85e2381ce07744eb3ffaf530:
name: Star Fox 64 (JP) (V1.0)
path: assets/yaml/jp/rev0
config:
gbi: F3DEX
sort: OFFSET
output:
binary: starship.otr
code: src/assets
headers: include/assets
modding: src/assets
enums:
- include/sf64object.h
- include/sf64level.h
- include/sf64mesg.h
- include/sf64audio_external.h
- include/sf64event.h
- include/sf64player.h
# d064229a32cc05ab85e2381ce07744eb3ffaf530:
# name: Star Fox 64 (JP) (V1.0)
# path: assets/yaml/jp/rev0
# config:
# gbi: F3DEX
# sort: OFFSET
# output:
# binary: starship.otr
# code: src/assets
# headers: include/assets
# modding: src/assets
# enums:
# - include/sf64object.h
# - include/sf64level.h
# - include/sf64mesg.h
# - include/sf64audio_external.h
# - include/sf64event.h
# - include/sf64player.h

View File

@ -9,6 +9,10 @@
#define TIME_IN_SECONDS(x) (x * 30);
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
#define RAND_FLOAT(max) (Rand_ZeroOne()*(max))
#define RAND_INT(max) ((s32)(Rand_ZeroOne()*(max)))
#define RAND_FLOAT_CENTERED(width) ((Rand_ZeroOne()-0.5f)*(width))

View File

@ -1,7 +1,7 @@
#ifndef PREVENT_CONTEXT_REORDERING_H
#define PREVENT_CONTEXT_REORDERING_H
// extern int Dummyhalf;
extern int Dummyhalf;
// struct Dummy0 {int x;};
// struct Dummy1 {int x;};
// struct Dummy2 {int x;};
@ -17,8 +17,8 @@
// struct Dummy12 {int x;};
// struct Dummy13 {int x;};
// struct Dummy14 {int x;};
struct Dummy15 {int x;};
struct Dummy16 {int x;};
// struct Dummy15 {int x;};
// struct Dummy16 {int x;};
struct Dummy17 {int x;};
struct Dummy18 {int x;};
struct Dummy19 {int x;};

View File

@ -1021,14 +1021,14 @@ typedef struct {
// audio_synthesis
void func_80008780(f32*, s32, f32*);
Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen);
Acmd* AudioSynth_Update(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen);
// audio_effects
void func_800135A8(SequencePlayer* seqplayer);
void func_80013A18(Note* note);
void func_80013A84(Note* note);
void func_80013B6C(AdsrState* adsr, EnvelopePoint* envelope, s16* arg2);
f32 func_80013B90(AdsrState* adsr);
void Audio_SequencePlayerProcessSound(SequencePlayer* seqplayer);
void Audio_NoteVibratoUpdate(Note* note);
void Audio_NoteVibratoInit(Note* note);
void Audio_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* arg2);
f32 Audio_AdsrUpdate(AdsrState* adsr);
// audio_heap
void AudioHeap_DiscardFont(s32 fontId);
@ -1058,29 +1058,29 @@ void AudioLoad_DiscardSeqFonts(s32 seqId);
s32 AudioLoad_SlowLoadSample(s32 fontId, u8 instId, s8* status);
// audio_playback
TunedSample* func_80011D10(Instrument* instrument, s32 arg1);
TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 semitone);
Instrument* Audio_GetInstrument(s32, s32);
Drum* Audio_GetDrum(s32, s32);
void func_80011F4C(Note* note);
void func_80011FA8(void);
void func_8001266C(SequenceLayer* layer);
void func_800127B0(Note* note, SequenceLayer* layer);
void func_80012864(NotePool* pool);
void func_800128B4(void);
void func_80012964(NotePool* pool);
void func_80012AC4(NotePool* pool, s32);
void func_80012C40(Note* note);
Note* func_8001301C(SequenceLayer* layer);
void func_800132E8(void);
void Audio_NoteDisable(Note* note);
void Audio_ProcessNotes(void);
void Audio_SeqLayerNoteDecay(SequenceLayer* layer);
void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer);
void Audio_InitNoteLists(NotePool* pool);
void Audio_InitNoteFreeList(void);
void Audio_NotePoolClear(NotePool* pool);
void Audio_NotePoolFill(NotePool* pool, s32);
void Audio_AudioListRemove(Note* note);
Note* Audio_AllocNote(SequenceLayer* layer);
void Audio_NoteInitAll(void);
// audio_seqplayer
void func_8001415C(SequenceChannel* channel);
void func_800144E4(SequencePlayer* seqPlayer);
void func_800145BC(AudioListItem* list, AudioListItem* item);
void* func_800145FC(AudioListItem* list);
void func_8001678C(s32 arg0);
void func_80016804(s32 arg0);
void func_800168BC(void);
void AudioSeq_SequenceChannelDisable(SequenceChannel* channel);
void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer);
void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item);
void* AudioSeq_AudioListPopBack(AudioListItem* list);
void AudioSeq_ProcessSequences(s32 arg0);
void AudioSeq_ResetSequencePlayer(s32 arg0);
void AudioSeq_InitSequencePlayers(void);
// audio_thread
void AudioThread_ScheduleProcessCmds(void);

View File

@ -8,6 +8,16 @@
#define HITBOX_SHADOW 300000.0f
#define HITBOX_WHOOSH 400000.0f
#define TEAM_FACE (14)
typedef enum ActorCSTeamFace {
/* 0 */ FACE_NONE,
/* 1 */ FACE_FOX,
/* 2 */ FACE_FALCO,
/* 3 */ FACE_SLIPPY,
/* 4 */ FACE_PEPPY
} ActorCSTeamFace;
typedef struct {
/* 0x0 */ f32 offset;
/* 0x4 */ f32 size;

View File

@ -1603,8 +1603,8 @@ func_800C01D4 = 0x800C01D4;
func_800C02E4 = 0x800C02E4;
D_800C0760 = 0x800C0760;
D_800C07B0 = 0x800C07B0;
D_800C0BE0 = 0x800C0BE0;
D_800C0E00 = 0x800C0E00;
gSoundFontTableInit = 0x800C0BE0;
gSeqFontTableInit = 0x800C0E00;
D_800C1720 = 0x800C1720;
D_800C1730 = 0x800C1730;
D_800C1770 = 0x800C1770;

View File

@ -233,15 +233,15 @@ func_800098DC = 0x800098DC;
func_80009984 = 0x80009984;
func_80009A2C = 0x80009A2C;
func_80009AAC = 0x80009AAC;
func_80009B64 = 0x80009B64;
AudioSynth_Update = 0x80009B64;
func_80009D78 = 0x80009D78;
func_8000A128 = 0x8000A128;
func_8000A25C = 0x8000A25C;
func_8000A700 = 0x8000A700;
func_8000B3F0 = 0x8000B3F0;
AudioSynth_ProcessNote = 0x8000A700;
AudioSynth_LoadWaveSamples = 0x8000B3F0;
func_8000B480 = 0x8000B480;
func_8000B51C = 0x8000B51C;
func_8000B98C = 0x8000B98C;
AudioSynth_ApplyHaasEffect = 0x8000B98C;
@ -332,72 +332,72 @@ AudioLoad_GetSamplesForFont = 0x80011758;
func_80011890 = 0x80011890;
func_80011C58 = 0x80011C58;
func_80011D10 = 0x80011D10;
Audio_InitNoteSub = 0x80011890;
Audio_NoteSetResamplingRate = 0x80011C58;
Audio_GetInstrumentTunedSample = 0x80011D10;
Audio_GetInstrument = 0x80011D4C;
Audio_GetDrum = 0x80011DFC;
func_80011EB8 = 0x80011EB8;
func_80011F4C = 0x80011F4C;
func_80011FA8 = 0x80011FA8;
func_80012438 = 0x80012438;
func_8001266C = 0x8001266C;
func_8001268C = 0x8001268C;
func_800126AC = 0x800126AC;
func_800127B0 = 0x800127B0;
func_80012854 = 0x80012854;
func_80012864 = 0x80012864;
func_800128B4 = 0x800128B4;
func_80012964 = 0x80012964;
func_80012AC4 = 0x80012AC4;
func_80012C00 = 0x80012C00;
func_80012C40 = 0x80012C40;
func_80012C6C = 0x80012C6C;
func_80012CEC = 0x80012CEC;
Audio_NoteInit = 0x80011EB8;
Audio_NoteDisable = 0x80011F4C;
Audio_ProcessNotes = 0x80011FA8;
Audio_SeqLayerDecayRelease = 0x80012438;
Audio_SeqLayerNoteDecay = 0x8001266C;
Audio_SeqLayerNoteRelease = 0x8001268C;
Audio_BuildSyntheticWave = 0x800126AC;
Audio_InitSyntheticWave = 0x800127B0;
Audio_InitNoteList = 0x80012854;
Audio_InitNoteLists = 0x80012864;
Audio_InitNoteFreeList = 0x800128B4;
Audio_NotePoolClear = 0x80012964;
Audio_NotePoolFill = 0x80012AC4;
Audio_AudioListPushFront = 0x80012C00;
Audio_AudioListRemove = 0x80012C40;
Audio_FindNodeWithPrioLessThan = 0x80012C6C;
Audio_NoteInitForLayer = 0x80012CEC;
func_80012E28 = 0x80012E28;
func_80012E5C = 0x80012E5C;
func_80012E88 = 0x80012E88;
func_80012ED4 = 0x80012ED4;
func_80012F24 = 0x80012F24;
func_8001301C = 0x8001301C;
func_800132E8 = 0x800132E8;
Audio_NoteReleaseAndTakeOwnership = 0x80012E5C;
Audio_AllocNoteFromDisabled = 0x80012E88;
Audio_AllocNoteFromDecaying = 0x80012ED4;
Audio_AllocNoteFromActive = 0x80012F24;
Audio_AllocNote = 0x8001301C;
Audio_NoteInitAll = 0x800132E8;
func_80013400 = 0x80013400;
func_800135A8 = 0x800135A8;
func_80013708 = 0x80013708;
Audio_SequencePlayerProcessSound = 0x800135A8;
Audio_GetPortamentoFreqScale = 0x80013708;
func_800137DC = 0x800137DC;
func_80013820 = 0x80013820;
func_80013A18 = 0x80013A18;
func_80013A84 = 0x80013A84;
func_80013B6C = 0x80013B6C;
func_80013B90 = 0x80013B90;
Audio_GetVibratoFreqScale = 0x80013820;
Audio_NoteVibratoUpdate = 0x80013A18;
Audio_NoteVibratoInit = 0x80013A84;
Audio_AdsrInit = 0x80013B6C;
Audio_AdsrUpdate = 0x80013B90;
func_80013EA0 = 0x80013EA0;
func_80013FC4 = 0x80013FC4;
func_800140D0 = 0x800140D0;
func_8001410C = 0x8001410C;
func_8001415C = 0x8001415C;
func_800141C8 = 0x800141C8;
func_80014244 = 0x80014244;
func_80014370 = 0x80014370;
func_80014440 = 0x80014440;
func_800144E4 = 0x800144E4;
func_800145BC = 0x800145BC;
func_800145FC = 0x800145FC;
func_8001463C = 0x8001463C;
func_800146C0 = 0x800146C0;
func_800146D4 = 0x800146D4;
func_80014704 = 0x80014704;
func_80014748 = 0x80014748;
func_800152C0 = 0x800152C0;
func_80015330 = 0x80015330;
func_800153C4 = 0x800153C4;
func_800153E8 = 0x800153E8;
func_80015FD4 = 0x80015FD4;
func_8001678C = 0x8001678C;
func_80016804 = 0x80016804;
func_800168BC = 0x800168BC;
AudioSeq_InitSequenceChannel = 0x80013EA0;
AudioSeq_SeqChannelSetLayer = 0x80013FC4;
AudioSeq_SeqLayerDisable = 0x800140D0;
AudioSeq_SeqLayerFree = 0x8001410C;
AudioSeq_SequenceChannelDisable = 0x8001415C;
AudioSeq_RequestFreeSeqChannel = 0x800141C8;
AudioSeq_SequencePlayerSetupChannels = 0x80014244;
AudioSeq_SequencePlayerDisableChannels = 0x80014370;
AudioSeq_SequenceChannelEnable = 0x80014440;
AudioSeq_SequencePlayerDisable = 0x800144E4;
AudioSeq_AudioListPushBack = 0x800145BC;
AudioSeq_AudioListPopBack = 0x800145FC;
AudioSeq_InitLayerFreelist = 0x8001463C;
AudioSeq_ScriptReadU8 = 0x800146C0;
AudioSeq_ScriptReadS16 = 0x800146D4;
AudioSeq_ScriptReadCompressedU16 = 0x80014704;
AudioSeq_SeqLayerProcessScript = 0x80014748;
AudioSeq_GetInstrument = 0x800152C0;
AudioSeq_SetInstrument = 0x80015330;
AudioSeq_SequenceChannelSetVolume = 0x800153C4;
AudioSeq_SequenceChannelProcessScript = 0x800153E8;
AudioSeq_SequencePlayerProcessSequence = 0x80015FD4;
AudioSeq_ProcessSequences = 0x8001678C;
AudioSeq_ResetSequencePlayer = 0x80016804;
AudioSeq_InitSequencePlayers = 0x800168BC;

View File

@ -42,7 +42,7 @@ void func_80013400(SequenceChannel* channel, s32 updateVolume) {
channel->changes.asByte = 0;
}
void func_800135A8(SequencePlayer* seqplayer) {
void Audio_SequencePlayerProcessSound(SequencePlayer* seqplayer) {
s32 i;
if (seqplayer->fadeTimer != 0) {
@ -56,14 +56,14 @@ void func_800135A8(SequencePlayer* seqplayer) {
}
seqplayer->fadeTimer--;
if ((seqplayer->fadeTimer == 0) && (seqplayer->state == 2)) {
func_800144E4(seqplayer);
AudioSeq_SequencePlayerDisable(seqplayer);
return;
}
}
if (seqplayer->recalculateVolume) {
seqplayer->appliedFadeVolume = seqplayer->fadeVolume * seqplayer->fadeVolumeMod;
}
for (i = 0; i < 16; i++) {
for (i = 0; i < SEQ_NUM_CHANNELS; i++) {
if ((IS_SEQUENCE_CHANNEL_VALID(seqplayer->channels[i]) == 1) && (seqplayer->channels[i]->enabled == 1)) {
func_80013400(seqplayer->channels[i], seqplayer->recalculateVolume);
}
@ -71,7 +71,7 @@ void func_800135A8(SequencePlayer* seqplayer) {
seqplayer->recalculateVolume = false;
}
f32 func_80013708(Portamento* portamento) {
f32 Audio_GetPortamentoFreqScale(Portamento* portamento) {
u32 temp;
f32 temp2;
@ -92,7 +92,7 @@ s16 func_800137DC(VibratoState* vibrato) {
return vibrato->curve[index] >> 8;
}
f32 func_80013820(VibratoState* vibrato) {
f32 Audio_GetVibratoFreqScale(VibratoState* vibrato) {
s32 ret;
f32 temp;
f32 temp2;
@ -136,16 +136,16 @@ f32 func_80013820(VibratoState* vibrato) {
return temp2;
}
void func_80013A18(Note* note) {
void Audio_NoteVibratoUpdate(Note* note) {
if (note->playbackState.portamento.mode != 0) {
note->playbackState.portamentoFreqMod = func_80013708(&note->playbackState.portamento);
note->playbackState.portamentoFreqMod = Audio_GetPortamentoFreqScale(&note->playbackState.portamento);
}
if ((note->playbackState.vibratoState.active != 0) && (note->playbackState.parentLayer != NO_LAYER)) {
note->playbackState.vibratoFreqMod = func_80013820(&note->playbackState.vibratoState);
note->playbackState.vibratoFreqMod = Audio_GetVibratoFreqScale(&note->playbackState.vibratoState);
}
}
void func_80013A84(Note* note) {
void Audio_NoteVibratoInit(Note* note) {
NotePlaybackState* noteState = &note->playbackState;
VibratoState* vibrato = &noteState->vibratoState;
@ -173,7 +173,7 @@ void func_80013A84(Note* note) {
noteState->portamento = noteState->parentLayer->portamento;
}
void func_80013B6C(AdsrState* adsr, EnvelopePoint* envelope, s16* arg2) {
void Audio_AdsrInit(AdsrState* adsr, EnvelopePoint* envelope, s16* arg2) {
adsr->action.asByte = 0;
adsr->state = 0;
adsr->delay = 0;
@ -182,7 +182,7 @@ void func_80013B6C(AdsrState* adsr, EnvelopePoint* envelope, s16* arg2) {
adsr->current = 0.0f;
}
f32 func_80013B90(AdsrState* adsr) {
f32 Audio_AdsrUpdate(AdsrState* adsr) {
u8 action = adsr->action.asByte;
u8 state = adsr->state;

View File

@ -99,9 +99,9 @@ void AudioHeap_DiscardFont(s32 fontId) {
note->playbackState.parentLayer->enabled = false;
note->playbackState.parentLayer->finished = true;
}
func_80011F4C(note);
func_80012C40(note);
func_800145BC(&gNoteFreeLists.disabled, &note->listItem);
Audio_NoteDisable(note);
Audio_AudioListRemove(note);
AudioSeq_AudioListPushBack(&gNoteFreeLists.disabled, &note->listItem);
}
}
}
@ -111,7 +111,7 @@ void AudioHeap_DiscardSequence(s32 seqId) {
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
if (gSeqPlayers[i].enabled && gSeqPlayers[i].seqId == seqId) {
func_800144E4(&gSeqPlayers[i]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[i]);
}
}
}
@ -571,7 +571,7 @@ s32 AudioHeap_ResetStep(void) {
switch (gAudioResetStep) {
case 5:
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
func_800144E4(&gSeqPlayers[i]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[i]);
}
gResetFadeoutFramesLeft = 4 / sp24;
gAudioResetStep--;
@ -696,8 +696,8 @@ void AudioHeap_Init(void) {
AudioHeap_InitSampleCaches(spec->persistentSampleCacheSize, spec->temporarySampleCacheSize);
AudioHeap_ResetLoadStatus();
gNotes = AudioHeap_AllocZeroed(&gMiscPool, gNumNotes * sizeof(Note));
func_800132E8();
func_800128B4();
Audio_NoteInitAll();
Audio_InitNoteFreeList();
gNoteSubsEu = AudioHeap_AllocZeroed(&gMiscPool, gAudioBufferParams.ticksPerUpdate * gNumNotes * sizeof(NoteSubEu));
for (i = 0; i != 2; i++) {
gAbiCmdBuffs[i] = AudioHeap_AllocZeroed(&gMiscPool, gMaxAudioCmds * 8);

View File

@ -383,7 +383,7 @@ void AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
seqId = AudioLoad_GetLoadTableIndex(SEQUENCE_TABLE, seqId);
func_800144E4(&gSeqPlayers[playerIdx]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[playerIdx]);
index = *((u16*) gSeqFontTable + seqId);
numFonts = gSeqFontTable[index++];
@ -396,7 +396,7 @@ void AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
seqData = AudioLoad_SyncLoadSeq(seqId);
func_80016804(playerIdx);
AudioSeq_ResetSequencePlayer(playerIdx);
gSeqPlayers[playerIdx].seqId = seqId;
gSeqPlayers[playerIdx].defaultFont = fontId;
@ -978,7 +978,7 @@ void AudioLoad_Init(void) {
}
AudioHeap_InitPool(&gPermanentPool.pool, ramAddr, gPermanentPoolSize);
func_800168BC();
AudioSeq_InitSequencePlayers();
}
static const char devstr38[] = "Entry--- %d %d\n";

View File

@ -33,13 +33,13 @@ static const char devstr25[] = "Intterupt UseStop %d (Kill %d)\n";
static const char devstr26[] = "Intterupt RelWait %d (Kill %d)\n";
static const char devstr27[] = "Drop Voice (Prio %x)\n";
void func_80011C58(Note* note, f32);
void func_8001268C(SequenceLayer* layer);
void func_80012C00(AudioListItem* item1, AudioListItem* item2);
void func_80012C40(Note* note);
void func_80012CEC(Note* note, SequenceLayer* layer);
void Audio_NoteSetResamplingRate(Note* note, f32);
void Audio_SeqLayerNoteRelease(SequenceLayer* layer);
void Audio_AudioListPushFront(AudioListItem* list, AudioListItem* item);
void Audio_AudioListRemove(Note* note);
void Audio_NoteInitForLayer(Note* note, SequenceLayer* layer);
void func_80011890(Note* note, NoteAttributes* noteAttr) {
void Audio_InitNoteSub(Note* note, NoteAttributes* noteAttr) {
NoteSubEu* noteSub;
f32 panVolumeLeft;
f32 pamVolumeRight;
@ -52,7 +52,7 @@ void func_80011890(Note* note, NoteAttributes* noteAttr) {
u8 reverb;
Stereo stereo;
func_80011C58(note, noteAttr->freqMod);
Audio_NoteSetResamplingRate(note, noteAttr->freqMod);
noteSub = &note->noteSubEu;
velocity = noteAttr->velocity;
pan = noteAttr->pan;
@ -130,34 +130,30 @@ void func_80011890(Note* note, NoteAttributes* noteAttr) {
}
}
void func_80011C58(Note* note, f32 arg1) {
void Audio_NoteSetResamplingRate(Note* note, f32 resamplingRateInput) {
NoteSubEu* noteSub = &note->noteSubEu;
f32 var_fv0;
f32 resamplingRate;
if (arg1 < 2.0f) {
noteSub->bitField1.hasTwoParts = 0;
if (arg1 > 1.99998f) {
var_fv0 = 1.99998f;
if (resamplingRateInput < 2.0f) {
noteSub->bitField1.hasTwoParts = false;
resamplingRate = CLAMP_MAX(resamplingRateInput, 1.99998f);
} else {
var_fv0 = arg1;
}
noteSub->bitField1.hasTwoParts = true;
if (resamplingRateInput > 3.99996f) {
resamplingRate = 1.99998f;
} else {
noteSub->bitField1.hasTwoParts = 1;
if (arg1 > 3.99996f) {
var_fv0 = 1.99998f;
} else {
var_fv0 = arg1 * 0.5f;
resamplingRate = resamplingRateInput * 0.5f;
}
}
note->noteSubEu.resampleRate = (s32) (var_fv0 * 32768.0f);
note->noteSubEu.resampleRate = (s32) (resamplingRate * 32768.0f);
}
TunedSample* func_80011D10(Instrument* instrument, s32 arg1) {
TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 semitone) {
TunedSample* sample;
if (arg1 < instrument->normalRangeLo) {
if (semitone < instrument->normalRangeLo) {
sample = &instrument->lowPitchTunedSample;
} else if (arg1 <= instrument->normalRangeHi) {
} else if (semitone <= instrument->normalRangeHi) {
sample = &instrument->normalPitchTunedSample;
} else {
sample = &instrument->highPitchTunedSample;
@ -205,33 +201,33 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
return drum;
}
void func_80011EB8(Note* note) {
void Audio_NoteInit(Note* note) {
if (note->playbackState.parentLayer->adsr.decayIndex == 0) {
func_80013B6C(&note->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope,
Audio_AdsrInit(&note->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope,
&note->playbackState.adsrVolModUnused);
} else {
func_80013B6C(&note->playbackState.adsr, note->playbackState.parentLayer->adsr.envelope,
Audio_AdsrInit(&note->playbackState.adsr, note->playbackState.parentLayer->adsr.envelope,
&note->playbackState.adsrVolModUnused);
}
note->playbackState.adsr.state = 1;
note->playbackState.adsr.state = ADSR_STATE_INITIAL;
note->noteSubEu = gDefaultNoteSub;
}
void func_80011F4C(Note* note) {
if (note->noteSubEu.bitField0.needsInit == 1) {
note->noteSubEu.bitField0.needsInit = 0;
void Audio_NoteDisable(Note* note) {
if (note->noteSubEu.bitField0.needsInit == true) {
note->noteSubEu.bitField0.needsInit = false;
}
note->playbackState.priority = 0;
note->noteSubEu.bitField0.enabled = false;
note->playbackState.unk_04 = 0;
note->noteSubEu.bitField0.enabled = 0;
note->playbackState.parentLayer = NO_LAYER;
note->playbackState.prevParentLayer = NO_LAYER;
note->noteSubEu.bitField0.finished = 0;
note->playbackState.adsr.state = 0;
note->playbackState.adsr.state = ADSR_STATE_DISABLED;
note->playbackState.adsr.current = 0.0f;
}
void func_80011FA8(void) {
void Audio_ProcessNotes(void) {
s32 pad2;
s32 pad;
Note* note;
@ -241,7 +237,7 @@ void func_80011FA8(void) {
s32 i;
NoteAttributes sp70;
u8 bookOffset;
f32 temp_fs0;
f32 scale;
for (i = 0; i < gNumNotes; i++) {
note = &gNotes[i];
@ -257,31 +253,31 @@ void func_80011FA8(void) {
playbackState->adsr.fadeOutVel = gAudioBufferParams.ticksPerUpdateInv;
playbackState->priority = 1;
playbackState->unk_04 = 2;
goto block_21;
goto out;
} else {
if ((playbackState->parentLayer->enabled) || (playbackState->unk_04 != 0) ||
(playbackState->priority <= 0)) {
if (playbackState->parentLayer->channel->seqPlayer == NULL) {
func_8001415C(playbackState->parentLayer->channel);
AudioSeq_SequenceChannelDisable(playbackState->parentLayer->channel);
playbackState->priority = 1;
playbackState->unk_04 = 1;
continue;
}
if (!(playbackState->parentLayer->channel->seqPlayer->muted &&
(playbackState->parentLayer->channel->muteBehavior & 0x40))) {
goto block_21;
(playbackState->parentLayer->channel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES))) {
goto out;
}
}
func_8001268C(playbackState->parentLayer);
func_80012C40(note);
func_80012C00(&note->listItem.pool->decaying, &note->listItem);
Audio_SeqLayerNoteRelease(playbackState->parentLayer);
Audio_AudioListRemove(note);
Audio_AudioListPushFront(&note->listItem.pool->decaying, &note->listItem);
playbackState->priority = 1;
playbackState->unk_04 = 2;
}
} else if ((playbackState->unk_04 == 0) && (playbackState->priority > 0)) {
continue;
}
block_21:
out:
if (playbackState->priority != 0) {
if (1) {}
@ -289,36 +285,36 @@ void func_80011FA8(void) {
if ((playbackState->unk_04 > 0) || noteSub->bitField0.finished) {
if ((playbackState->adsr.state == 0) || noteSub->bitField0.finished) {
if (playbackState->wantedParentLayer != NO_LAYER) {
func_80011F4C(note);
Audio_NoteDisable(note);
if (playbackState->wantedParentLayer->channel != NULL) {
func_80012CEC(note, playbackState->wantedParentLayer);
func_80013A84(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->active, &note->listItem);
Audio_NoteInitForLayer(note, playbackState->wantedParentLayer);
Audio_NoteVibratoInit(note);
Audio_AudioListRemove(note);
AudioSeq_AudioListPushBack(&note->listItem.pool->active, &note->listItem);
playbackState->wantedParentLayer = NO_LAYER;
} else {
func_80011F4C(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->disabled, &note->listItem);
Audio_NoteDisable(note);
Audio_AudioListRemove(note);
AudioSeq_AudioListPushBack(&note->listItem.pool->disabled, &note->listItem);
playbackState->wantedParentLayer = NO_LAYER;
goto next;
}
} else {
func_80011F4C(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->disabled, &note->listItem);
Audio_NoteDisable(note);
Audio_AudioListRemove(note);
AudioSeq_AudioListPushBack(&note->listItem.pool->disabled, &note->listItem);
goto next;
}
}
} else if (playbackState->adsr.state == 0) {
func_80011F4C(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->disabled, &note->listItem);
Audio_NoteDisable(note);
Audio_AudioListRemove(note);
AudioSeq_AudioListPushBack(&note->listItem.pool->disabled, &note->listItem);
goto next;
}
temp_fs0 = func_80013B90(&playbackState->adsr);
func_80013A18(note);
scale = Audio_AdsrUpdate(&playbackState->adsr);
Audio_NoteVibratoUpdate(note);
attr = &playbackState->attributes;
if ((playbackState->unk_04 == 1) || (playbackState->unk_04 == 2)) {
sp70.freqMod = attr->freqMod;
@ -345,15 +341,15 @@ void func_80011FA8(void) {
}
sp70.freqMod *= playbackState->vibratoFreqMod * playbackState->portamentoFreqMod;
sp70.freqMod *= gAudioBufferParams.resampleRate;
sp70.velocity *= temp_fs0;
func_80011890(note, &sp70);
sp70.velocity *= scale;
Audio_InitNoteSub(note, &sp70);
noteSub->bitField1.bookOffset = bookOffset;
next:;
}
}
}
void func_80012438(SequenceLayer* layer, s32 arg1) {
void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 arg1) {
Note* note;
NoteAttributes* noteAttr;
@ -413,21 +409,21 @@ void func_80012438(SequenceLayer* layer, s32 arg1) {
}
}
if (arg1 == 6) {
func_80012C40(note);
func_80012C00(&note->listItem.pool->decaying, &note->listItem);
Audio_AudioListRemove(note);
Audio_AudioListPushFront(&note->listItem.pool->decaying, &note->listItem);
}
}
}
void func_8001266C(SequenceLayer* layer) {
func_80012438(layer, 6);
void Audio_SeqLayerNoteDecay(SequenceLayer* layer) {
Audio_SeqLayerDecayRelease(layer, ADSR_STATE_DECAY);
}
void func_8001268C(SequenceLayer* layer) {
func_80012438(layer, 7);
void Audio_SeqLayerNoteRelease(SequenceLayer* layer) {
Audio_SeqLayerDecayRelease(layer, ADSR_STATE_RELEASE);
}
s32 func_800126AC(Note* note, SequenceLayer* layer, s32 waveId) {
s32 Audio_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveId) {
f32 freqMod;
u8 harmonicIndex = 0;
@ -458,7 +454,7 @@ s32 func_800126AC(Note* note, SequenceLayer* layer, s32 waveId) {
return harmonicIndex;
}
void func_800127B0(Note* note, SequenceLayer* layer) {
void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer) {
s32 harmonicIndex;
s32 waveId;
@ -468,39 +464,39 @@ void func_800127B0(Note* note, SequenceLayer* layer) {
}
harmonicIndex = note->playbackState.harmonicIndex;
note->synthesisState.samplePosInt =
(note->synthesisState.samplePosInt * sSamplesPerWavePeriod[func_800126AC(note, layer, waveId)]) /
(note->synthesisState.samplePosInt * sSamplesPerWavePeriod[Audio_BuildSyntheticWave(note, layer, waveId)]) /
sSamplesPerWavePeriod[harmonicIndex];
}
void func_80012854(AudioListItem* item) {
void Audio_InitNoteList(AudioListItem* item) {
item->prev = item;
item->next = item;
item->u.value = NULL;
}
void func_80012864(NotePool* pool) {
func_80012854(&pool->disabled);
func_80012854(&pool->decaying);
func_80012854(&pool->releasing);
func_80012854(&pool->active);
void Audio_InitNoteLists(NotePool* pool) {
Audio_InitNoteList(&pool->disabled);
Audio_InitNoteList(&pool->decaying);
Audio_InitNoteList(&pool->releasing);
Audio_InitNoteList(&pool->active);
pool->disabled.pool = pool;
pool->decaying.pool = pool;
pool->releasing.pool = pool;
pool->active.pool = pool;
}
void func_800128B4(void) {
void Audio_InitNoteFreeList(void) {
s32 i;
func_80012864(&gNoteFreeLists);
Audio_InitNoteLists(&gNoteFreeLists);
for (i = 0; i < gNumNotes; i++) {
gNotes[i].listItem.u.value = &gNotes[i];
gNotes[i].listItem.prev = NULL;
func_800145BC(&gNoteFreeLists.disabled, &gNotes[i].listItem);
AudioSeq_AudioListPushBack(&gNoteFreeLists.disabled, &gNotes[i].listItem);
}
}
void func_80012964(NotePool* pool) {
void Audio_NotePoolClear(NotePool* pool) {
s32 poolType;
AudioListItem* poolItem;
AudioListItem* nextPoolItem;
@ -531,23 +527,22 @@ void func_80012964(NotePool* pool) {
if ((nextPoolItem == poolItem) || (nextPoolItem == NULL)) {
break;
}
func_80012C40((Note*) nextPoolItem);
func_800145BC(freeList, nextPoolItem);
Audio_AudioListRemove((Note*) nextPoolItem);
AudioSeq_AudioListPushBack(freeList, nextPoolItem);
}
}
}
void func_80012AC4(NotePool* pool, s32 arg1) {
s32 var_s0;
void Audio_NotePoolFill(NotePool* pool, s32 count) {
s32 j;
s32 poolType;
AudioListItem* note;
AudioListItem* freeList;
AudioListItem* poolList;
func_80012964(pool);
poolType = 0;
var_s0 = 0;
while (var_s0 < arg1) {
Audio_NotePoolClear(pool);
for (poolType = 0, j = 0; j < count; poolType++) {
if (poolType == 4) {
return;
}
@ -569,30 +564,31 @@ void func_80012AC4(NotePool* pool, s32 arg1) {
poolList = &pool->active;
break;
}
while (var_s0 < arg1) {
note = func_800145FC(freeList);
while (j < count) {
note = AudioSeq_AudioListPopBack(freeList);
if (note == NULL) {
break;
}
func_800145BC(poolList, note);
var_s0++;
AudioSeq_AudioListPushBack(poolList, note);
j++;
}
poolType++;
}
}
void func_80012C00(AudioListItem* item1, AudioListItem* item2) {
if (item2->prev == NULL) {
item2->prev = item1;
item2->next = item1->next;
item1->next->prev = item2;
item1->next = item2;
item1->u.count++;
item2->pool = item1->pool;
void Audio_AudioListPushFront(AudioListItem* list, AudioListItem* item) {
// add 'item' to the front of the list given by 'list', if it's not in any list
if (item->prev == NULL) {
item->prev = list;
item->next = list->next;
list->next->prev = item;
list->next = item;
list->u.count++;
item->pool = list->pool;
}
}
void func_80012C40(Note* note) {
void Audio_AudioListRemove(Note* note) {
// remove 'item' from the list it's in, if any
if (note->listItem.prev != NULL) {
note->listItem.prev->next = note->listItem.next;
note->listItem.next->prev = note->listItem.prev;
@ -600,7 +596,7 @@ void func_80012C40(Note* note) {
}
}
Note* func_80012C6C(AudioListItem* item, s32 priority) {
Note* Audio_FindNodeWithPrioLessThan(AudioListItem* item, s32 priority) {
AudioListItem* priorityItem;
AudioListItem* nextItem = item->next;
@ -625,7 +621,7 @@ Note* func_80012C6C(AudioListItem* item, s32 priority) {
return (Note*) priorityItem->u.value;
}
void func_80012CEC(Note* note, SequenceLayer* layer) {
void Audio_NoteInitForLayer(Note* note, SequenceLayer* layer) {
s32 pad[4];
s32 var_a2;
NoteSubEu* noteSub;
@ -639,7 +635,7 @@ void func_80012CEC(Note* note, SequenceLayer* layer) {
layer->channel->noteUnused = note;
layer->channel->layerUnused = layer;
layer->noteVelocity = 0.0f;
func_80011EB8(note);
Audio_NoteInit(note);
var_a2 = layer->instOrWave;
noteSub = &note->noteSubEu;
if (var_a2 == 0xFF) {
@ -652,7 +648,7 @@ void func_80012CEC(Note* note, SequenceLayer* layer) {
noteSub->bitField1.isSyntheticWave = false;
}
if (noteSub->bitField1.isSyntheticWave) {
func_800126AC(note, layer, var_a2);
Audio_BuildSyntheticWave(note, layer, var_a2);
}
note->playbackState.fontId = layer->channel->fontId;
noteSub->bitField0.stereoHeadsetEffects = layer->channel->stereoHeadsetEffects;
@ -660,122 +656,126 @@ void func_80012CEC(Note* note, SequenceLayer* layer) {
}
void func_80012E28(Note* note, SequenceLayer* layer) {
func_8001268C(note->playbackState.parentLayer);
Audio_SeqLayerNoteRelease(note->playbackState.parentLayer);
note->playbackState.wantedParentLayer = layer;
}
void func_80012E5C(Note* note, SequenceLayer* layer) {
void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer) {
note->playbackState.wantedParentLayer = layer;
note->playbackState.priority = layer->channel->notePriority;
note->playbackState.adsr.fadeOutVel = gAudioBufferParams.ticksPerUpdateInv;
note->playbackState.adsr.action.asByte |= 0x10;
}
Note* func_80012E88(NotePool* pool, SequenceLayer* layer) {
Note* note = func_800145FC(&pool->disabled);
Note* Audio_AllocNoteFromDisabled(NotePool* pool, SequenceLayer* layer) {
Note* note = AudioSeq_AudioListPopBack(&pool->disabled);
if (note != NULL) {
func_80012CEC(note, layer);
func_80012C00(&pool->active, &note->listItem);
Audio_NoteInitForLayer(note, layer);
Audio_AudioListPushFront(&pool->active, &note->listItem);
}
return note;
}
Note* func_80012ED4(NotePool* pool, SequenceLayer* layer) {
Note* note = func_800145FC(&pool->decaying);
Note* Audio_AllocNoteFromDecaying(NotePool* pool, SequenceLayer* layer) {
Note* note = AudioSeq_AudioListPopBack(&pool->decaying);
if (note != NULL) {
func_80012E5C(note, layer);
func_800145BC(&pool->releasing, &note->listItem);
Audio_NoteReleaseAndTakeOwnership(note, layer);
AudioSeq_AudioListPushBack(&pool->releasing, &note->listItem);
}
return note;
}
Note* func_80012F24(NotePool* pool, SequenceLayer* layer) {
Note* sp34;
Note* sp30;
s32 sp2C;
s32 sp28;
Note* Audio_AllocNoteFromActive(NotePool* pool, SequenceLayer* layer) {
Note* rNote;
Note* aNote;
s32 rPriority;
s32 aPriority;
sp2C = sp28 = 0x10;
sp34 = func_80012C6C(&pool->releasing, layer->channel->notePriority);
if (sp34 != NULL) {
sp2C = sp34->playbackState.priority;
rPriority = aPriority = 0x10;
rNote = Audio_FindNodeWithPrioLessThan(&pool->releasing, layer->channel->notePriority);
if (rNote != NULL) {
rPriority = rNote->playbackState.priority;
}
sp30 = func_80012C6C(&pool->active, layer->channel->notePriority);
if (sp30 != NULL) {
sp28 = sp30->playbackState.priority;
aNote = Audio_FindNodeWithPrioLessThan(&pool->active, layer->channel->notePriority);
if (aNote != NULL) {
aPriority = aNote->playbackState.priority;
}
if ((sp34 == NULL) && (sp30 == NULL)) {
if (rNote == NULL && aNote == NULL) {
return NULL;
}
if (sp28 < sp2C) {
func_80012C40(sp30);
func_80012E28(sp30, layer);
func_800145BC(&pool->releasing, &sp30->listItem);
sp30->playbackState.priority = layer->channel->notePriority;
return sp30;
} else {
sp34->playbackState.wantedParentLayer = layer;
sp34->playbackState.priority = layer->channel->notePriority;
return sp34;
if (aPriority < rPriority) {
Audio_AudioListRemove(aNote);
func_80012E28(aNote, layer);
AudioSeq_AudioListPushBack(&pool->releasing, &aNote->listItem);
aNote->playbackState.priority = layer->channel->notePriority;
return aNote;
}
rNote->playbackState.wantedParentLayer = layer;
rNote->playbackState.priority = layer->channel->notePriority;
return rNote;
}
Note* func_8001301C(SequenceLayer* layer) {
Note* sp24;
Note* Audio_AllocNote(SequenceLayer* layer) {
Note* note;
if (layer->channel->noteAllocPolicy & 1) {
sp24 = layer->note;
if ((sp24 != NULL) && (layer == sp24->playbackState.prevParentLayer) &&
(sp24->playbackState.wantedParentLayer == NO_LAYER)) {
note = layer->note;
if ((note != NULL) && (layer == note->playbackState.prevParentLayer) &&
(note->playbackState.wantedParentLayer == NO_LAYER)) {
func_80012E5C(sp24, layer);
func_80012C40(sp24);
func_800145BC(&sp24->listItem.pool->releasing, &sp24->listItem);
return sp24;
Audio_NoteReleaseAndTakeOwnership(note, layer);
Audio_AudioListRemove(note);
AudioSeq_AudioListPushBack(&note->listItem.pool->releasing, &note->listItem);
return note;
}
}
if (layer->channel->noteAllocPolicy & 2) {
if (((sp24 = func_80012E88(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012ED4(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012F24(&layer->channel->notePool, layer)) != NULL)) {
return sp24;
if (((note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) != NULL)) {
return note;
}
} else if (layer->channel->noteAllocPolicy & 4) {
if (((sp24 = func_80012E88(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012E88(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((sp24 = func_80012ED4(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012ED4(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((sp24 = func_80012F24(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012F24(&layer->channel->seqPlayer->notePool, layer)) != NULL)) {
return sp24;
if (((note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer)) != NULL)) {
return note;
}
} else if (layer->channel->noteAllocPolicy & 8) {
if (((sp24 = func_80012E88(&gNoteFreeLists, layer)) != NULL) ||
((sp24 = func_80012ED4(&gNoteFreeLists, layer)) != NULL) ||
((sp24 = func_80012F24(&gNoteFreeLists, layer)) != NULL)) {
return sp24;
if (((note = Audio_AllocNoteFromDisabled(&gNoteFreeLists, layer)) != NULL) ||
((note = Audio_AllocNoteFromDecaying(&gNoteFreeLists, layer)) != NULL) ||
((note = Audio_AllocNoteFromActive(&gNoteFreeLists, layer)) != NULL)) {
return note;
}
} else {
if (((sp24 = func_80012E88(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012E88(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((sp24 = func_80012E88(&gNoteFreeLists, layer)) != NULL) ||
((sp24 = func_80012ED4(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012ED4(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((sp24 = func_80012ED4(&gNoteFreeLists, layer)) != NULL) ||
((sp24 = func_80012F24(&layer->channel->notePool, layer)) != NULL) ||
((sp24 = func_80012F24(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((sp24 = func_80012F24(&gNoteFreeLists, layer)) != NULL)) {
return sp24;
if (((note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDisabled(&gNoteFreeLists, layer)) != NULL) ||
((note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromDecaying(&gNoteFreeLists, layer)) != NULL) ||
((note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer)) != NULL) ||
((note = Audio_AllocNoteFromActive(&gNoteFreeLists, layer)) != NULL)) {
return note;
}
}
layer->unk_3 = 0;
return NULL;
}
void func_800132E8(void) {
void Audio_NoteInitAll(void) {
s32 i;
Note* note;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,19 @@
#include "sys.h"
#include "sf64audio_provisional.h"
#define DMEM_LEFT_CH 0x990
#define DMEM_RIGHT_CH 0xB10
#define DMEM_HAAS_TEMP 0x650
#define DMEM_TEMP 0x450
#define DMEM_UNCOMPRESSED_NOTE 0x5F0
#define SAMPLE_SIZE sizeof(s16)
typedef enum {
/* 0 */ HAAS_EFFECT_DELAY_NONE,
/* 1 */ HAAS_EFFECT_DELAY_LEFT, // Delay left channel so that right channel is heard first
/* 2 */ HAAS_EFFECT_DELAY_RIGHT // Delay right channel so that left channel is heard first
} HaasEffectDelaySide;
s32 D_80145D40; // unused
// all of these are part of the DFT-related function
@ -29,18 +42,18 @@ static const char devstr9[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
void func_80009A2C(s32 updateIndex, s32 noteIndex);
void func_80009AAC(s32 updateIndex);
Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf, s32 aiBufLen,
Acmd* aList, s32 updateIndex);
Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf,
s32 aiBufLen, Acmd* aList, s32 updateIndex);
Acmd* func_8000A25C(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 updateIndex);
Acmd* func_800098DC(Acmd* aList, u16 dmem, u16 startPos, s32 size, s32 reverbIndex);
Acmd* func_80009984(Acmd* aList, u16 dmem, u16 startPos, s32 size, s32 reverbIndex);
Acmd* func_80009D78(Acmd* aList, s32 aiBufLen, s16 reverbIndex, s16 updateIndex);
Acmd* func_8000A128(Acmd* aList, s16 reverbIndex, s16 updateIndex);
Acmd* func_8000B3F0(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 numSamplesToLoad);
Acmd* AudioSynth_LoadWaveSamples(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 numSamplesToLoad);
Acmd* func_8000B480(Acmd* aList, NoteSynthesisState* synthState, s32 size, u16 pitch, u16 inpDmem, u32 resampleFlags);
Acmd* func_8000B51C(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 aiBufLen, u16 dmemSrc,
s32 delaySide, s32 flags);
Acmd* func_8000B98C(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 size, s32 flags,
Acmd* AudioSynth_ApplyHaasEffect(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 size, s32 flags,
s32 delaySide);
void func_800080C0(s32 sampleCount, s32 itemIndex, s32 reverbIndex) {
@ -631,7 +644,7 @@ void func_80009AAC(s32 updateIndex) {
}
}
Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen) {
Acmd* AudioSynth_Update(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen) {
Acmd* aCmdPtr;
s32* aiBufPtr;
s32 chunkLen;
@ -640,7 +653,7 @@ Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen) {
aCmdPtr = aList;
for (i = gAudioBufferParams.ticksPerUpdate; i > 0; i--) {
func_8001678C(i - 1);
AudioSeq_ProcessSequences(i - 1);
func_80009AAC(gAudioBufferParams.ticksPerUpdate - i);
}
@ -787,7 +800,7 @@ Acmd* func_8000A25C(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 updateIndex) {
if (i != gNoteSubsEu[updateIndex * gNumNotes + sp84[j]].bitField1.reverbIndex) {
break;
}
aList = func_8000A700(sp84[j], &gNoteSubsEu[updateIndex * gNumNotes + sp84[j]],
aList = AudioSynth_ProcessNote(sp84[j], &gNoteSubsEu[updateIndex * gNumNotes + sp84[j]],
&gNotes[sp84[j]].synthesisState, aiBuf, aiBufLen, aList, updateIndex);
j++;
}
@ -797,8 +810,8 @@ Acmd* func_8000A25C(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 updateIndex) {
}
while (j < var_s2) {
aList = func_8000A700(sp84[j], &gNoteSubsEu[updateIndex * gNumNotes + sp84[j]], &gNotes[sp84[j]].synthesisState,
aiBuf, aiBufLen, aList, updateIndex);
aList = AudioSynth_ProcessNote(sp84[j], &gNoteSubsEu[updateIndex * gNumNotes + sp84[j]],
&gNotes[sp84[j]].synthesisState, aiBuf, aiBufLen, aList, updateIndex);
j++;
}
@ -810,81 +823,83 @@ Acmd* func_8000A25C(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 updateIndex) {
return aList;
}
// https://decomp.me/scratch/RgX4r
#ifdef NON_MATCHING
Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf, s32 aiBufLen,
Acmd* aList, s32 updateIndex) {
Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf,
s32 aiBufLen, Acmd* aList, s32 updateIndex) {
s32 pad11C;
s32 pad118;
s32 pad114;
Sample* bookSample; // sp110
AdpcmLoop* loopInfo; // sp10C
void* currentBook; // sp108
Sample* bookSample;
AdpcmLoop* loopInfo;
void* currentBook;
s32 pad104;
s32 pad100;
s32 noteFinished; // spFC
u32 restart; // spF8
s32 flags; // spF4
u16 resampleRateFixedPoint; // spF2
s32 nSamplesToLoad; // spEC
s32 sampleFinished;
u32 loopToPoint;
s32 flags;
u16 resampleRateFixedPoint;
s32 numSamplesToLoad;
s32 padE8;
s32 padE4;
s32 padE0;
s32 skipBytes; // spDC
s32 skipBytes;
s32 padD8;
s32 padD4;
s32 padD0;
u32 sampleAddr; // spCC
u32 sampleAddr;
s32 padC8;
s32 samplesLenAdjusted; // spC4
s32 nAdpcmSamplesProcessed; // spC0
u32 endPos; // spBC
s32 nSamplesToProcess; // spB8
s32 numSamplesToLoadAdj;
s32 numSamplesProcessed;
u32 endPos;
s32 nSamplesToProcess;
s32 padB4;
s32 padB0;
s32 padAC;
s32 padA8;
s32 padA4;
s32 nTrailingSamplesToIgnore; // spA0
s32 padA8;
s32 numTrailingSamplesToIgnore;
s32 pad9C;
s32 pad98;
s32 pad94;
s32 frameSize; // sp90
s32 frameSize;
s32 pad8C;
s32 skipInitialSamples; // sp88
s32 sampleDmaStart; // sp84
s32 skipInitialSamples;
s32 sampleDmaStart;
s32 pad80;
s32 nParts; // sp7C
s32 curPart; // sp78
s32 nSamplesInThisIteration;
s32 sampleDataStartPad;
s32 resampledTempLen; // sp6C
u16 noteSamplesDmemAddrBeforeResampling; // sp6A
s32 samplesRemaining;
s32 numParts;
s32 curPart;
s32 numSamplesInThisIteration;
s32 sampleDataChunkAlignPad;
s32 resampledTempLen;
u16 noteSamplesDmemAddrBeforeResampling;
s32 pasdasd;
s32 frameIndex;
s32 sampleDataOffset;
Note* note; // sp58
u16 sp56; // sp56
s32 nSamplesInFirstFrame;
Note* note;
u16 sp56;
s32 numSamplesInFirstFrame;
s32 delaySide;
s32 nSamplesToDecode;
s32 padasdsa;
s32 nFramesToDecode;
s32 nFirstFrameSamplesToIgnore;
s32 s5;
s32 dmemUncompressedAddrOffset1;
u32 sampleslenFixedPoint;
u8* sampleData;
u8* samplesToLoadAddr;
s32 temp;
s32 temp2;
unsigned int new_var2;
u32 nEntries;
s32 aligned;
s32 align2;
u16 addr;
s16 addr;
u8* new_var;
s32 samplesRemaining;
s32 numSamplesToDecode;
currentBook = NULL;
note = &gNotes[noteIndex];
flags = 0;
if (noteSub->bitField0.needsInit == 1) {
if (new_var2 = noteSub->bitField0.needsInit == 1) { // FAKE
flags = 1;
synthState->restart = 0;
synthState->samplePosInt = 0;
@ -896,221 +911,253 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
synthState->numParts = 0;
note->noteSubEu.bitField0.finished = 0;
}
resampleRateFixedPoint = noteSub->resampleRate;
nParts = noteSub->bitField1.hasTwoParts + 1;
sampleslenFixedPoint = (resampleRateFixedPoint * aiBufLen * 2) + synthState->samplePosFrac;
nSamplesToLoad = (sampleslenFixedPoint) >> 0x10;
numParts = noteSub->bitField1.hasTwoParts + 1;
sampleslenFixedPoint = ((resampleRateFixedPoint * aiBufLen) * 2) + synthState->samplePosFrac;
numSamplesToLoad = sampleslenFixedPoint >> 0x10;
synthState->samplePosFrac = sampleslenFixedPoint & 0xFFFF;
if ((synthState->numParts == 1) && (nParts == 2)) {
nSamplesToLoad += 2;
if ((synthState->numParts == 1) && (numParts == 2)) {
numSamplesToLoad += 2;
sp56 = 2;
} else if ((synthState->numParts == 2) && (nParts == 1)) {
nSamplesToLoad -= 4;
} else if ((synthState->numParts == 2) && (numParts == 1)) {
numSamplesToLoad -= 4;
sp56 = 4;
} else {
sp56 = 0;
}
synthState->numParts = nParts;
synthState->numParts = numParts;
if (noteSub->bitField1.isSyntheticWave) {
aList = func_8000B3F0(aList, noteSub, synthState, nSamplesToLoad);
noteSamplesDmemAddrBeforeResampling = (synthState->samplePosInt * 2) + 0x5F0;
synthState->samplePosInt += nSamplesToLoad;
aList = AudioSynth_LoadWaveSamples(aList, noteSub, synthState, numSamplesToLoad);
noteSamplesDmemAddrBeforeResampling = (synthState->samplePosInt * ((char) 2)) + 0x5F0;
synthState->samplePosInt += numSamplesToLoad;
} else {
bookSample = *(Sample**) noteSub->waveSampleAddr;
bookSample = *((Sample**) noteSub->waveSampleAddr);
loopInfo = bookSample->loop;
endPos = loopInfo->end;
sampleAddr = bookSample->sampleAddr;
resampledTempLen = 0;
for (curPart = 0; curPart < nParts; curPart++) {
nAdpcmSamplesProcessed = 0;
s5 = 0;
if (nParts == 1) {
samplesLenAdjusted = nSamplesToLoad;
} else if (nSamplesToLoad & 1) {
samplesLenAdjusted = (nSamplesToLoad & ~1) + (curPart * 2);
for (curPart = 0; curPart < numParts; curPart++) {
numSamplesProcessed = 0;
dmemUncompressedAddrOffset1 = 0;
if (numParts == 1) {
numSamplesToLoadAdj = numSamplesToLoad;
} else if (numSamplesToLoad & 1) {
numSamplesToLoadAdj = (numSamplesToLoad & (~1)) + (curPart * 2);
} else {
samplesLenAdjusted = nSamplesToLoad;
numSamplesToLoadAdj = numSamplesToLoad;
}
if ((bookSample->codec == 0) && (currentBook != bookSample->book->book)) {
switch (noteSub->bitField1.bookOffset) {
case 1:
currentBook = &gD_800DD200[1];
break;
case 2:
currentBook = &gD_800DD200[2];
break;
default:
case 3:
currentBook = bookSample->book->book;
break;
}
nEntries = 16 * bookSample->book->order * bookSample->book->numPredictors;
nEntries = (16 * bookSample->book->order) * bookSample->book->numPredictors;
aLoadADPCM(aList++, nEntries, OS_K0_TO_PHYSICAL(currentBook));
}
while (nAdpcmSamplesProcessed != samplesLenAdjusted) {
restart = 0;
noteFinished = 0;
while (numSamplesProcessed != numSamplesToLoadAdj) {
sampleFinished = 0;
loopToPoint = 0;
samplesRemaining = endPos - synthState->samplePosInt;
nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed;
nSamplesToProcess = numSamplesToLoadAdj - numSamplesProcessed;
nFirstFrameSamplesToIgnore = synthState->samplePosInt & 0xF;
if ((nFirstFrameSamplesToIgnore == 0) && !synthState->restart) {
if ((nFirstFrameSamplesToIgnore == 0) && (!synthState->restart)) {
nFirstFrameSamplesToIgnore = 0x10;
}
nSamplesInFirstFrame = 0x10 - nFirstFrameSamplesToIgnore;
numSamplesInFirstFrame = 0x10 - nFirstFrameSamplesToIgnore;
if (nSamplesToProcess < samplesRemaining) {
nFramesToDecode = (nSamplesToProcess - nSamplesInFirstFrame + 0xF) / 16;
nSamplesToDecode = nFramesToDecode * 0x10;
// if(1) {}
nTrailingSamplesToIgnore = (nSamplesInFirstFrame + nSamplesToDecode) - nSamplesToProcess;
nFramesToDecode = ((nSamplesToProcess - numSamplesInFirstFrame) + 0xF) / 16;
numSamplesToDecode = nFramesToDecode * 0x10;
numTrailingSamplesToIgnore = (numSamplesInFirstFrame + numSamplesToDecode) - nSamplesToProcess;
} else {
nSamplesToDecode = samplesRemaining - nSamplesInFirstFrame;
nTrailingSamplesToIgnore = 0;
if (nSamplesToDecode <= 0) {
nSamplesToDecode = 0;
nSamplesInFirstFrame = samplesRemaining;
numSamplesToDecode = samplesRemaining - numSamplesInFirstFrame;
numTrailingSamplesToIgnore = 0;
if (numSamplesToDecode <= 0) {
numSamplesToDecode = 0;
numSamplesInFirstFrame = samplesRemaining;
}
nFramesToDecode = (nSamplesToDecode + 0xF) / 16;
nFramesToDecode = (numSamplesToDecode + 0xF) / 16;
if (loopInfo->count != 0) {
restart = 1;
loopToPoint = 1;
} else {
noteFinished = 1;
sampleFinished = 1;
}
}
switch (bookSample->codec) {
case 0:
frameSize = 9;
skipInitialSamples = 0x10;
sampleDmaStart = 0;
break;
case 1:
frameSize = 0x10;
skipInitialSamples = 0x10;
sampleDmaStart = 0;
break;
case 2:
temp =
func_800097A8(bookSample, samplesLenAdjusted, flags, &synthState->synthesisBuffers->unk_40);
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(temp), 0x5F0, (samplesLenAdjusted + 0x10) * 2);
s5 = samplesLenAdjusted;
nAdpcmSamplesProcessed = samplesLenAdjusted;
temp = func_800097A8(bookSample, numSamplesToLoadAdj, flags,
&synthState->synthesisBuffers->unk_40);
if (0) {}
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(temp), 0x5F0, (numSamplesToLoadAdj + 0x10) * 2);
flags = 0;
skipBytes = 0;
numSamplesProcessed = numSamplesToLoadAdj;
dmemUncompressedAddrOffset1 = numSamplesToLoadAdj;
goto skip;
}
aligned = ALIGN16(nFramesToDecode * frameSize + 0x10);
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
addr = 0x990 - aligned;
if (nFramesToDecode != 0) {
if (1) {}
frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16;
sampleDataOffset = frameIndex * frameSize;
if (bookSample->medium == 0) {
sampleData = sampleDmaStart + sampleDataOffset + sampleAddr;
samplesToLoadAddr = (u8*) (sampleDmaStart + sampleDataOffset + sampleAddr);
} else {
sampleData = AudioLoad_DmaSampleData(sampleDmaStart + sampleDataOffset + sampleAddr, aligned,
flags, &synthState->sampleDmaIndex, bookSample->medium);
samplesToLoadAddr =
AudioLoad_DmaSampleData(sampleDmaStart + sampleDataOffset + sampleAddr, aligned, flags,
&synthState->sampleDmaIndex, bookSample->medium);
}
// if (1){}
sampleDataStartPad = (u32) sampleData & 0xF;
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(sampleData - sampleDataStartPad), addr, aligned);
sampleDataChunkAlignPad = ((u32) samplesToLoadAddr) % 16;
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(samplesToLoadAddr - sampleDataChunkAlignPad), addr, aligned);
} else {
nSamplesToDecode = 0;
sampleDataStartPad = 0;
numSamplesToDecode = 0;
sampleDataChunkAlignPad = 0;
}
if (synthState->restart) {
aSetLoop(aList++, OS_K0_TO_PHYSICAL(bookSample->loop->predictorState));
flags = 2;
synthState->restart = 0;
}
nSamplesInThisIteration = nSamplesToDecode + nSamplesInFirstFrame - nTrailingSamplesToIgnore;
if (nAdpcmSamplesProcessed == 0) {
numSamplesInThisIteration = (numSamplesToDecode + numSamplesInFirstFrame) - numTrailingSamplesToIgnore;
if (numSamplesProcessed == 0) {
switch (bookSample->codec) {
case 0:
aSetBuffer(aList++, 0, addr + sampleDataStartPad, 0x5F0, nSamplesToDecode * 2);
aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, 0x5F0, numSamplesToDecode * 2);
aADPCMdec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break;
case 1:
aSetBuffer(aList++, 0, addr + sampleDataStartPad, 0x5F0, nSamplesToDecode * 2);
aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, 0x5F0, numSamplesToDecode * 2);
aS8Dec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break;
}
skipBytes = nFirstFrameSamplesToIgnore * 2;
} else {
// if (1) {}
align2 = ALIGN16(s5 + 0x10);
align2 = ALIGN16(dmemUncompressedAddrOffset1 + 0x10);
switch (bookSample->codec) {
case 0:
aSetBuffer(aList++, 0, addr + sampleDataStartPad, align2 + 0x5F0, nSamplesToDecode * 2);
aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, align2 + 0x5F0,
numSamplesToDecode * 2);
aADPCMdec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break;
case 1:
aSetBuffer(aList++, 0, addr + sampleDataStartPad, align2 + 0x5F0, nSamplesToDecode * 2);
aSetBuffer(aList++, 0, addr + sampleDataChunkAlignPad, align2 + 0x5F0,
numSamplesToDecode * 2);
aS8Dec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break;
}
aDMEMMove(aList++, (align2 + (nFirstFrameSamplesToIgnore * 2) + 0x5F0), s5 + 0x5F0,
nSamplesInThisIteration * 2);
aDMEMMove(aList++, 0x5F0 + align2 + (nFirstFrameSamplesToIgnore * 2),
0x5F0 + dmemUncompressedAddrOffset1, numSamplesInThisIteration * 2);
}
nAdpcmSamplesProcessed += nSamplesInThisIteration;
numSamplesProcessed += numSamplesInThisIteration;
switch (flags) {
case 1:
skipBytes = 0x20;
s5 = (nSamplesToDecode + 0x10) * 2;
dmemUncompressedAddrOffset1 = (numSamplesToDecode + 0x10) * 2;
break;
case 2:
// if(1) {}
s5 = nSamplesInThisIteration * 2 + s5;
dmemUncompressedAddrOffset1 = (numSamplesInThisIteration * 2) + dmemUncompressedAddrOffset1;
break;
default:
if (s5 != 0) {
s5 = nSamplesInThisIteration * 2 + s5;
if (dmemUncompressedAddrOffset1 != 0) {
dmemUncompressedAddrOffset1 = (numSamplesInThisIteration * 2) + dmemUncompressedAddrOffset1;
} else {
// if (1) { }
s5 = (nFirstFrameSamplesToIgnore + nSamplesInThisIteration) * 2;
dmemUncompressedAddrOffset1 = (nFirstFrameSamplesToIgnore + numSamplesInThisIteration) * 2;
}
break;
}
skip:
flags = 0;
// goto dummy_label_147574; dummy_label_147574: ;
if (noteFinished) {
aClearBuffer(aList++, s5 + 0x5F0, (samplesLenAdjusted - nAdpcmSamplesProcessed) * 2);
if (sampleFinished) {
aClearBuffer(aList++, dmemUncompressedAddrOffset1 + 0x5F0,
(numSamplesToLoadAdj - numSamplesProcessed) * 2);
noteSub->bitField0.finished = 1;
note->noteSubEu.bitField0.finished = 1;
func_80009A2C(updateIndex, noteIndex);
break;
}
if (restart) {
if (loopToPoint != 0) {
synthState->restart = 1;
synthState->samplePosInt = loopInfo->start;
} else {
synthState->samplePosInt += nSamplesToProcess;
}
}
switch (nParts) {
switch (numParts) {
case 1:
noteSamplesDmemAddrBeforeResampling = skipBytes + 0x5F0;
break;
case 2:
switch (curPart) {
case 0:
aInterl(aList++, skipBytes + 0x5F0, 0x470, ALIGN8(samplesLenAdjusted / 2));
resampledTempLen = samplesLenAdjusted;
aInterl(aList++, skipBytes + 0x5F0, 0x470, ALIGN8(numSamplesToLoadAdj / 2));
resampledTempLen = numSamplesToLoadAdj;
noteSamplesDmemAddrBeforeResampling = 0x470;
if (noteSub->bitField0.finished) {
aClearBuffer(aList++, resampledTempLen + noteSamplesDmemAddrBeforeResampling,
samplesLenAdjusted + 0x10);
numSamplesToLoadAdj + 0x10);
}
break;
case 1:
aInterl(aList++, skipBytes + 0x5F0, resampledTempLen + 0x470,
ALIGN8(samplesLenAdjusted / 2));
ALIGN8(numSamplesToLoadAdj / 2));
break;
}
break;
}
@ -1125,12 +1172,15 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
flags = 1;
noteSub->bitField0.needsInit = 0;
}
flags = sp56 | flags;
aList = func_8000B480(aList, synthState, aiBufLen * 2, resampleRateFixedPoint, noteSamplesDmemAddrBeforeResampling,
flags);
if (flags & 1) {
flags = 1;
}
if (noteSub->bitField1.bookOffset == 3) {
aUnkCmd19(aList++, 0, aiBufLen * 2, 0x450, 0x450);
}
@ -1142,6 +1192,7 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
}
aHiLoGain(aList++, temp2, (aiBufLen + 0x10) * 2, 0x450, 0);
}
if ((noteSub->leftDelaySize != 0) || (synthState->prevHaasEffectLeftDelaySize != 0)) {
delaySide = 1;
} else if ((noteSub->rightDelaySize != 0) || (synthState->prevHaasEffectRightDelaySize != 0)) {
@ -1151,29 +1202,37 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
}
aList = func_8000B51C(aList, noteSub, synthState, aiBufLen, 0x450, delaySide, flags);
// if(restart) {}
if (noteSub->bitField0.usesHeadsetPanEffects) {
if (!(flags & 1)) {
flags = 0;
}
aList = func_8000B98C(aList, noteSub, synthState, aiBufLen * 2, flags, delaySide);
aList = AudioSynth_ApplyHaasEffect(aList, noteSub, synthState, aiBufLen * 2, flags, delaySide);
}
return aList;
}
#else
#pragma GLOBAL_ASM("asm/us/rev1/nonmatchings/audio/audio_synthesis/func_8000A700.s")
#endif
Acmd* func_8000B3F0(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 numSamplesToLoad) {
s32 temp_v1;
Acmd* AudioSynth_LoadWaveSamples(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState,
s32 numSamplesToLoad) {
s32 numSamplesAvail;
s32 numDuplicates;
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(noteSub->waveSampleAddr), 0x5F0, 0x80);
synthState->samplePosInt &= 0x3F;
temp_v1 = 0x40 - synthState->samplePosInt;
if (temp_v1 < numSamplesToLoad) {
if ((((numSamplesToLoad - temp_v1) + 0x3F) / 64) != 0) {
aDuplicate(aList++, ((numSamplesToLoad - temp_v1) + 0x3F) / 64, 0x5F0, 0x670);
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(noteSub->waveSampleAddr), DMEM_UNCOMPRESSED_NOTE,
WAVE_SAMPLE_COUNT * SAMPLE_SIZE);
// Offset in the WAVE_SAMPLE_COUNT samples of gWaveSamples to start processing the wave for continuity
synthState->samplePosInt = (u32) synthState->samplePosInt % WAVE_SAMPLE_COUNT;
// Number of samples in the initial WAVE_SAMPLE_COUNT samples available to be used to process
numSamplesAvail = WAVE_SAMPLE_COUNT - synthState->samplePosInt;
if (numSamplesToLoad > numSamplesAvail) {
// Duplicate (copy) the WAVE_SAMPLE_COUNT samples as many times as needed to reach numSamplesToLoad.
// (numSamplesToLoad - numSamplesAvail) is the number of samples missing.
// Divide by WAVE_SAMPLE_COUNT, rounding up, to get the amount of duplicates
numDuplicates = ((numSamplesToLoad - numSamplesAvail + WAVE_SAMPLE_COUNT - 1) / WAVE_SAMPLE_COUNT);
if (numDuplicates != 0) {
aDuplicate(aList++, numDuplicates, DMEM_UNCOMPRESSED_NOTE,
DMEM_UNCOMPRESSED_NOTE + (WAVE_SAMPLE_COUNT * SAMPLE_SIZE));
}
}
return aList;
@ -1263,60 +1322,67 @@ Acmd* func_8000B51C(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthSt
return aList;
}
Acmd* func_8000B98C(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 size, s32 flags,
/**
* The Haas Effect gives directionality to sound by applying a small (< 35ms) delay to either the left or right channel.
* The delay is small enough that the sound is still perceived as one sound, but the channel that is not delayed will
* reach our ear first and give a sense of directionality. The sound is directed towards the opposite side of the delay.
*/
Acmd* AudioSynth_ApplyHaasEffect(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 size, s32 flags,
s32 delaySide) {
u16 var_t0;
u8 var_a1;
u8 var_v1;
u16 temp;
u16 dmemDest;
u8 haasEffectDelaySize;
u8 prevHaasEffectDelaySize;
u16 pitch;
switch (delaySide) {
case 1:
var_t0 = 0x990;
var_a1 = noteSub->leftDelaySize;
case HAAS_EFFECT_DELAY_LEFT:
dmemDest = DMEM_LEFT_CH;
haasEffectDelaySize = noteSub->leftDelaySize;
prevHaasEffectDelaySize = synthState->prevHaasEffectLeftDelaySize;
synthState->prevHaasEffectRightDelaySize = 0;
var_v1 = synthState->prevHaasEffectLeftDelaySize;
synthState->prevHaasEffectLeftDelaySize = var_a1;
synthState->prevHaasEffectLeftDelaySize = haasEffectDelaySize;
break;
case 2:
var_t0 = 0xB10;
var_a1 = noteSub->rightDelaySize;
case HAAS_EFFECT_DELAY_RIGHT:
dmemDest = DMEM_RIGHT_CH;
haasEffectDelaySize = noteSub->rightDelaySize;
prevHaasEffectDelaySize = synthState->prevHaasEffectRightDelaySize;
synthState->prevHaasEffectRightDelaySize = haasEffectDelaySize;
synthState->prevHaasEffectLeftDelaySize = 0;
var_v1 = synthState->prevHaasEffectRightDelaySize;
synthState->prevHaasEffectRightDelaySize = var_a1;
break;
default:
default: // HAAS_EFFECT_DELAY_NONE
return aList;
}
if (flags != 1) {
if (var_a1 != var_v1) {
temp = (((size << 0xF) / 2) - 1) / ((size + var_a1 - var_v1 - 2) / 2);
aSetBuffer(aList++, 0, 0x650, 0x450, size + var_a1 - var_v1);
aResampleZoh(aList++, temp, 0);
if (flags != A_INIT) {
if (haasEffectDelaySize != prevHaasEffectDelaySize) {
pitch = (((size << 0xF) / 2) - 1) / ((size + haasEffectDelaySize - prevHaasEffectDelaySize - 2) / 2);
aSetBuffer(aList++, 0, DMEM_HAAS_TEMP, DMEM_TEMP, size + haasEffectDelaySize - prevHaasEffectDelaySize);
aResampleZoh(aList++, pitch, 0);
} else {
aDMEMMove(aList++, 0x650, 0x450, size);
aDMEMMove(aList++, DMEM_HAAS_TEMP, DMEM_TEMP, size);
}
if (var_v1 != 0) {
if (prevHaasEffectDelaySize != 0) {
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers->panSamplesBuffer), 0x650,
ALIGN16(var_v1));
aDMEMMove(aList++, 0x450, var_v1 + 0x650, size + var_a1 - var_v1);
ALIGN16(prevHaasEffectDelaySize));
aDMEMMove(aList++, DMEM_TEMP, prevHaasEffectDelaySize + DMEM_HAAS_TEMP,
size + haasEffectDelaySize - prevHaasEffectDelaySize);
} else {
aDMEMMove(aList++, 0x450, 0x650, size + var_a1);
aDMEMMove(aList++, DMEM_TEMP, DMEM_HAAS_TEMP, size + haasEffectDelaySize);
}
} else {
aDMEMMove(aList++, 0x650, 0x450, size);
aClearBuffer(aList++, 0x650, var_a1);
aDMEMMove(aList++, 0x450, var_a1 + 0x650, size);
}
if (var_a1) {
aSaveBuffer(aList++, size + 0x650, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers->panSamplesBuffer),
ALIGN16(var_a1));
aDMEMMove(aList++, DMEM_HAAS_TEMP, DMEM_TEMP, size);
aClearBuffer(aList++, DMEM_HAAS_TEMP, haasEffectDelaySize);
aDMEMMove(aList++, DMEM_TEMP, haasEffectDelaySize + DMEM_HAAS_TEMP, size);
}
aAddMixer(aList++, ALIGN64(size), 0x650, var_t0, 0x7FFF);
if (haasEffectDelaySize) {
aSaveBuffer(aList++, size + DMEM_HAAS_TEMP, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers->panSamplesBuffer),
ALIGN16(haasEffectDelaySize));
}
aAddMixer(aList++, ALIGN64(size), DMEM_HAAS_TEMP, dmemDest, 0x7FFF);
return aList;
}

View File

@ -114,7 +114,7 @@ SPTask* AudioThread_CreateTask(void) {
while (MQ_GET_MESG(gThreadCmdProcQueue, &msg)) {
AudioThread_ProcessCmds(msg);
}
gCurAbiCmdBuffer = func_80009B64(gCurAbiCmdBuffer, &abiCmdCount, aiBuffer, gAiBuffLengths[aiBuffIndex]);
gCurAbiCmdBuffer = AudioSynth_Update(gCurAbiCmdBuffer, &abiCmdCount, aiBuffer, gAiBuffLengths[aiBuffIndex]);
gAudioRandom = osGetCount() * (gAudioRandom + gAudioTaskCountQ);
gAudioRandom = gAiBuffers[aiBuffIndex][gAudioTaskCountQ & 0xFF] + gAudioRandom;
@ -174,7 +174,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
case AUDIOCMD_OP_GLOBAL_DISABLE_SEQPLAYER:
if (gSeqPlayers[cmd->arg0].enabled) {
if (cmd->asInt == 0) {
func_800144E4(&gSeqPlayers[cmd->arg0]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[cmd->arg0]);
} else {
AudioThread_SetFadeOutTimer(cmd->arg0, cmd->asInt);
}

View File

@ -1872,7 +1872,7 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) {
Player* player;
f32 radius = shot->scale * 60.0f;
scenery = gScenery;
scenery = &gScenery[0];
for (i = 0; i < ARRAY_COUNT(gScenery); i++, scenery++) {
if ((scenery->obj.status == OBJ_ACTIVE) && (scenery->obj.id == OBJ_SCENERY_CO_DOORS)) {
dx = scenery->obj.pos.x - shot->obj.pos.x;
@ -1884,7 +1884,8 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) {
scenery->dmgPart = 0;
}
}
sprite = gSprites;
sprite = &gSprites[0];
for (i = 0; i < ARRAY_COUNT(gSprites); i++, sprite++) {
if ((sprite->obj.status == OBJ_ACTIVE) &&
((sprite->obj.id == OBJ_SPRITE_FO_POLE) || (sprite->obj.id == OBJ_SPRITE_TI_CACTUS) ||
@ -1897,6 +1898,7 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) {
}
}
}
actor = &gActors[0];
for (i = 0; i < ARRAY_COUNT(gActors); i++, actor++) {
if ((actor->obj.status == OBJ_ACTIVE) && (actor->timer_0C2 == 0) &&
@ -1910,9 +1912,11 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) {
if ((gLevelMode == LEVELMODE_ON_RAILS) && (dz < 0.0f)) {
dz *= 0.6f;
}
actor->hitPos.x = shot->obj.pos.x;
actor->hitPos.y = shot->obj.pos.y;
actor->hitPos.z = shot->obj.pos.z;
if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < radius) {
if ((actor->obj.id == OBJ_ACTOR_CO_RADAR) || (actor->obj.id == OBJ_ACTOR_ME_LASER_CANNON_1) ||
(actor->obj.id == OBJ_ACTOR_MISSILE_SEEK_TEAM) || (actor->obj.id == OBJ_ACTOR_ME_HOPBOT) ||
@ -1953,6 +1957,7 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) {
}
}
}
if (gCurrentLevel == LEVEL_MACBETH) {
Macbeth_801AD144(shot);
} else if (gCurrentLevel == LEVEL_VENOM_1) {
@ -1960,7 +1965,8 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) {
} else {
PlayerShot_CheckBossHitbox(shot);
}
effect = gEffects;
effect = &gEffects[0];
for (i = 0; i < ARRAY_COUNT(gEffects); i++, effect++) {
if (effect->obj.status == OBJ_ACTIVE) {
dx = effect->obj.pos.x - shot->obj.pos.x;
@ -1987,6 +1993,7 @@ void PlayerShot_ApplyExplosionDamage(PlayerShot* shot, s32 damage) {
}
}
}
if (gVersusMode) {
player = gPlayer;
for (i = 0; i < gCamCount; i++, player++) {
@ -2023,14 +2030,17 @@ void PlayerShot_UpdateBomb(PlayerShot* shot) {
PlayerShot_ExplodeBomb(shot);
break;
}
if ((shot->obj.pos.y < gGroundHeight) && (gGroundType != 4)) {
PlayerShot_ExplodeBomb(shot);
break;
}
if ((gPlayer[shot->sourceId].form == FORM_LANDMASTER) || (gPlayer[shot->sourceId].form == FORM_ON_FOOT)) {
shot->vel.y -= 1.0f;
Math_SmoothStepToF(&shot->obj.rot.x, -90.0f, 0.05f, 1.0f, 0.0f);
}
if (shot->timer < 25) {
if (gVersusMode) {
if (gControllerPress[shot->sourceId].button & gBombButton[shot->sourceId]) {
@ -2044,16 +2054,19 @@ void PlayerShot_UpdateBomb(PlayerShot* shot) {
}
}
}
if (!((gCurrentLevel == LEVEL_VENOM_ANDROSS) && (gBosses[0].obj.status == OBJ_ACTIVE) &&
(gBosses[0].state == 17))) {
PlayerShot_CollisionCheck(shot);
}
PlayerShot_SetBombLight(shot);
break;
case 1:
gGroundClipMode = 2;
shot->obj.rot.y += 1.0f;
Math_SmoothStepToF(&shot->scale, shot->unk_48, 0.05f, 1.5f, 0.001f);
if ((shot->timer > 0) && (shot->timer < 30)) {
if (!gVersusMode &&
((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN))) {
@ -2069,6 +2082,7 @@ void PlayerShot_UpdateBomb(PlayerShot* shot) {
}
PlayerShot_SetBombLight(shot);
}
if (shot->timer == 0) {
shot->unk_58 -= 8;
if (shot->unk_58 < 0) {
@ -2120,7 +2134,8 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) {
sLockOnPos.y += actor->info.targetOffset;
}
}
for (i = 0, player = gPlayer; i < gCamCount; i++, player++) {
for (i = 0, player = &gPlayer[0]; i < gCamCount; i++, player++) {
if (((player->state == PLAYERSTATE_ACTIVE) || (player->state == PLAYERSTATE_U_TURN)) &&
(gVsLockOnTimers[i][shot->sourceId] != 0)) {
var_a3 = 1;
@ -2134,6 +2149,7 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) {
sLockOnPos.z = player->trueZpos;
}
}
if (var_a3 != 0) {
sp6C = shot->obj.pos.x - sLockOnPos.x;
sp68 = shot->obj.pos.y - sLockOnPos.y;
@ -2159,12 +2175,14 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) {
shot->unk_60 = 1;
}
}
Math_SmoothStepToF(&shot->unk_50, 360.0f, 1.0f, 3.0f, 0.f);
if (shot->unk_60 != 0) {
Math_SmoothStepToF(&shot->unk_54, 169.0f, 1.0f, 13.0f, 0.f);
} else {
Math_SmoothStepToF(&shot->unk_54, 91.0f, 1.0f, 7.7999997f, 0.f);
}
if (!((gPlayer[shot->sourceId].form == FORM_LANDMASTER) && (shot->unk_60 != 0))) {
Vec3f sp44;
Vec3f sp38;
@ -2180,6 +2198,7 @@ void PlayerShot_UpdateLockOnShot(PlayerShot* shot) {
shot->vel.y = sp38.y;
shot->vel.z = sp38.z;
}
PlayerShot_CollisionCheck(shot);
gLight3x = shot->obj.pos.x;
gLight3y = shot->obj.pos.y;
@ -2198,6 +2217,7 @@ void PlayerShot_UpdateShot(PlayerShot* shot, s32 index) {
shot->obj.pos.x += shot->vel.x;
shot->obj.pos.y += shot->vel.y;
shot->obj.pos.z += shot->vel.z;
switch (shot->obj.id) {
case PLAYERSHOT_SINGLE_LASER:
PlayerShot_UpdateBeam(shot, index);

View File

@ -588,7 +588,7 @@ void ActorTeamArwing_Draw(ActorTeamArwing* this) {
gActorTeamArwing.laserGunsYpos = gActorTeamArwing.laserGunsXpos = gActorTeamArwing.wingsXrot =
gActorTeamArwing.wingsYrot = gActorTeamArwing.cockpitGlassXrot = gActorTeamArwing.wingsZrot = 0.0f;
gActorTeamArwing.unk_28 = this->fwork[17];
gActorTeamArwing.drawFace = this->iwork[14];
gActorTeamArwing.drawFace = this->iwork[TEAM_FACE];
gActorTeamArwing.teamFaceXrot = this->fwork[20];
gActorTeamArwing.teamFaceYrot = this->fwork[19];

View File

@ -5584,7 +5584,7 @@ void Aquas_AqCoralReef2_Setup(ActorCutscene* this, s32 posIdx) {
this->obj.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos = sAqCoralReef2Pos[posIdx];
this->obj.pos.z -= gPathProgress;
this->animFrame = 46;
this->animFrame = ACTOR_CS_AQ_CORAL_REEF_2;
Object_SetInfo(&this->info, this->obj.id);
}
@ -5599,7 +5599,7 @@ void Aquas_AqRock_Setup(ActorCutscene* this, s32 posIdx) {
this->obj.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos = sAqRockPos[posIdx];
this->obj.pos.z -= gPathProgress;
this->animFrame = 47;
this->animFrame = ACTOR_CS_AQ_ROCK;
Object_SetInfo(&this->info, this->obj.id);
}

View File

@ -2972,9 +2972,9 @@ void Corneria_LevelStart(Player* player) {
Corneria_CsTeamSetup(slippy, 1);
Corneria_CsTeamSetup(peppy, 2);
falco->iwork[14] = 2;
slippy->iwork[14] = 3;
peppy->iwork[14] = 4;
falco->iwork[TEAM_FACE] = FACE_FALCO;
slippy->iwork[TEAM_FACE] = FACE_SLIPPY;
peppy->iwork[TEAM_FACE] = FACE_PEPPY;
player->cam.eye.x = gCsCamEyeX = player->pos.x - 400.0f;
gPlayer[0].cam.eye.y = gCsCamEyeY = player->pos.y + 600.0f;

View File

@ -1791,7 +1791,7 @@ void Meteo_LevelStart_SetupTeam(ActorCutscene* this, s32 teamIdx) {
Object_SetInfo(&this->info, this->obj.id);
this->info.cullDistance = 200.0f;
if (this->animFrame == 0) {
if (this->animFrame == ACTOR_CS_TEAM_ARWING) {
this->iwork[11] = 1;
AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, this->sfxSource, 4);
return;

View File

@ -114,7 +114,7 @@ void SectorX_SxSlippy_Update(SxSlippy* this) {
gPlayer[0].state = PLAYERSTATE_STANDBY;
this->timer_0BC = 200;
this->iwork[14] = 3;
this->iwork[TEAM_FACE] = FACE_SLIPPY;
this->fwork[0] = 0.0f;
this->fwork[1] = 0.0f;
@ -1343,13 +1343,13 @@ void SectorX_SxSpyborg_PostLimbDraw(s32 limbIndex, Vec3f* rot, void* thisx) {
}
}
Vec3f D_i2_801956B0[5] = { { 0.0f, 2300.0f, -5000.0f },
Vec3f sSxCsCommanderPos[5] = { { 0.0f, 2300.0f, -5000.0f },
{ -600.0f, 2200.0f, -5000.0f },
{ -300.0f, 2270.0f, -5000.0f },
{ 300.0f, 2270.0f, -5000.0f },
{ 600.0f, 2200.0f, -5000.0f } };
Vec3f D_i2_801956EC[3] = {
Vec3f sLevelStartTeamSetupPos[3] = {
{ 150.0f, 250.0f, 50.0f },
{ -150.0f, -50.0f, 50.0f },
{ 150.0f, -50.0f, 50.0f },
@ -1362,7 +1362,7 @@ f32 D_i2_80195740[4] = { -150.0f, 150.0f, 0.0f, 0.0f };
f32 D_i2_80195750[4] = { 20.0f, 0.0f, -70.0f, 0.0f };
f32 D_i2_80195760[4] = { -250.0f, -200.0f, -400.0f, -8000.0f };
f32 D_i2_80195770[3] = { 120.0f, 180.0f, -150.0f };
s16 D_i2_8019577C[3] = { 2, 3, 4 };
s16 sSxTeamFaces[3] = { FACE_FALCO, FACE_SLIPPY, FACE_PEPPY };
void SectorX_SxSpyborg_Draw(SxSpyborg* this) {
f32 fwork;
@ -1435,32 +1435,32 @@ void SectorX_SxSpyborg_Draw(SxSpyborg* this) {
}
}
void SectorX_80193800(ActorCutscene* this, s32 index) {
void SectorX_CsCommander_Setup(ActorCutscene* this, s32 index) {
Actor_Initialize(this);
this->obj.status = OBJ_ACTIVE;
this->obj.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos.x = D_i2_801956B0[index].x;
this->obj.pos.y = D_i2_801956B0[index].y;
this->obj.pos.z = D_i2_801956B0[index].z;
this->obj.pos.x = sSxCsCommanderPos[index].x;
this->obj.pos.y = sSxCsCommanderPos[index].y;
this->obj.pos.z = sSxCsCommanderPos[index].z;
this->vel.z = 30.0f;
this->vel.y = -16.0f;
this->animFrame = 20;
this->animFrame = ACTOR_CS_COMMANDER;
this->obj.rot.x = 15.0f;
Object_SetInfo(&this->info, this->obj.id);
AUDIO_PLAY_SFX(NA_SE_EN_ENGINE_01, this->sfxSource, 4);
}
void SectorX_801938D8(ActorCutscene* this, s32 index) {
void SectorX_LevelStart_SetupTeam(ActorCutscene* this, s32 teamIdx) {
Actor_Initialize(this);
this->obj.status = OBJ_ACTIVE;
this->obj.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos.x = gPlayer[0].cam.eye.x + D_i2_801956EC[index].x;
this->obj.pos.y = gPlayer[0].cam.eye.y + D_i2_801956EC[index].y;
this->obj.pos.z = gPlayer[0].cam.eye.z + D_i2_801956EC[index].z;
this->obj.pos.x = gPlayer[0].cam.eye.x + sLevelStartTeamSetupPos[teamIdx].x;
this->obj.pos.y = gPlayer[0].cam.eye.y + sLevelStartTeamSetupPos[teamIdx].y;
this->obj.pos.z = gPlayer[0].cam.eye.z + sLevelStartTeamSetupPos[teamIdx].z;
this->state = 1;
this->iwork[11] = 1;
@ -1469,7 +1469,7 @@ void SectorX_801938D8(ActorCutscene* this, s32 index) {
this->obj.rot.y = 180.0f;
this->obj.rot.x = 10.0f;
if (index == 2) {
if (teamIdx == 2) {
this->obj.rot.z = -20.0f;
}
@ -1492,7 +1492,7 @@ void SectorX_LevelStart(Player* player) {
case 0:
gCsFrameCount = 0;
for (i = 0; i < 5; i++) {
SectorX_80193800(&gActors[5 + i], i);
SectorX_CsCommander_Setup(&gActors[5 + i], i);
}
player->csState = 1;
player->cam.eye.x = gCsCamEyeX = 100.0f;
@ -1582,17 +1582,17 @@ void SectorX_LevelStart(Player* player) {
switch (gCsFrameCount) {
case 195:
if (gTeamShields[TEAM_ID_FALCO] > 0) {
SectorX_801938D8(&gActors[0], 0);
SectorX_LevelStart_SetupTeam(&gActors[0], 0);
}
break;
case 213:
if (gTeamShields[TEAM_ID_SLIPPY] > 0) {
SectorX_801938D8(&gActors[1], 1);
SectorX_LevelStart_SetupTeam(&gActors[1], 1);
}
break;
case 229:
if (gTeamShields[TEAM_ID_PEPPY] > 0) {
SectorX_801938D8(&gActors[2], 2);
SectorX_LevelStart_SetupTeam(&gActors[2], 2);
}
break;
}
@ -1664,7 +1664,7 @@ void SectorX_LevelStart(Player* player) {
player->trueZpos = player->pos.z + player->camDist;
}
void SectorX_801944D4(ActorCutscene* this, s32 index) {
void SectorX_LevelComplete_SetupTeam(ActorCutscene* this, s32 teamIdx) {
Vec3f srcA;
Vec3f destA;
Vec3f srcB;
@ -1672,12 +1672,14 @@ void SectorX_801944D4(ActorCutscene* this, s32 index) {
Player* player = &gPlayer[0];
Matrix_RotateY(gCalcMatrix, player->rot.y * M_DTOR, MTXF_NEW);
srcA.x = D_i2_80195710[index];
srcA.y = D_i2_80195720[index];
srcA.z = D_i2_80195730[index];
srcB.x = D_i2_80195740[index];
srcB.y = D_i2_80195750[index];
srcB.z = D_i2_80195760[index];
srcA.x = D_i2_80195710[teamIdx];
srcA.y = D_i2_80195720[teamIdx];
srcA.z = D_i2_80195730[teamIdx];
srcB.x = D_i2_80195740[teamIdx];
srcB.y = D_i2_80195750[teamIdx];
srcB.z = D_i2_80195760[teamIdx];
Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcA, &destA);
Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcB, &destB);
@ -1698,16 +1700,16 @@ void SectorX_801944D4(ActorCutscene* this, s32 index) {
Object_SetInfo(&this->info, this->obj.id);
if (index == 3) {
if (teamIdx == 3) {
this->animFrame = ACTOR_CS_GREAT_FOX;
this->state = 20;
this->obj.rot.x = -player->rot.x - 10.0f;
this->obj.rot.y = (player->rot.y + 180.0f) - 10.0f;
this->fwork[9] = 10.0f;
} else {
this->obj.rot.z = D_i2_80195770[index];
this->obj.rot.z = D_i2_80195770[teamIdx];
this->iwork[11] = 1;
this->iwork[14] = D_i2_8019577C[index];
this->iwork[TEAM_FACE] = sSxTeamFaces[teamIdx];
AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, this->sfxSource, 4);
}
}
@ -1815,13 +1817,13 @@ void SectorX_LevelComplete(Player* player) {
case 100:
if (gTeamShields[TEAM_ID_FALCO] > 0) {
SectorX_801944D4(&gActors[1], 0);
SectorX_LevelComplete_SetupTeam(&gActors[1], 0);
}
if (gTeamShields[TEAM_ID_SLIPPY] > 0) {
SectorX_801944D4(&gActors[2], 1);
SectorX_LevelComplete_SetupTeam(&gActors[2], 1);
}
if (gTeamShields[TEAM_ID_PEPPY] > 0) {
SectorX_801944D4(&gActors[3], 2);
SectorX_LevelComplete_SetupTeam(&gActors[3], 2);
}
break;
@ -1838,8 +1840,8 @@ void SectorX_LevelComplete(Player* player) {
break;
case 920:
gActors[1].iwork[14] = gActors[2].iwork[14] = gActors[3].iwork[14] = 0;
SectorX_801944D4(&gActors[0], 3);
gActors[1].iwork[TEAM_FACE] = gActors[2].iwork[TEAM_FACE] = gActors[3].iwork[TEAM_FACE] = FACE_NONE;
SectorX_LevelComplete_SetupTeam(&gActors[0], 3);
AUDIO_PLAY_SFX(NA_SE_GREATFOX_ENGINE, gActors[0].sfxSource, 0);
break;

View File

@ -2635,7 +2635,7 @@ void Area6_8018EC38(ActorCutscene* this, s32 teamIdx) {
// Peppy is omitted, probably because it's outside of the camera view.
if (teamIdx + 1 != 3) {
this->iwork[14] = teamIdx + 2;
this->iwork[TEAM_FACE] = teamIdx + 2;
}
Object_SetInfo(&this->info, this->obj.id);

View File

@ -6555,7 +6555,7 @@ void Aquas_801BDF14(void) {
actor->obj.pos.y = D_i3_801C0504[i].y;
actor->obj.pos.z = D_i3_801C0504[i].z;
actor->rot_0F4.y = D_i3_801C075C[i];
actor->animFrame = 41;
actor->animFrame = ACTOR_CS_AQ_FISHGROUP;
actor->iwork[0] = RAND_INT(20.0f);
actor->iwork[2] = i;
actor->timer_0BC = 231;

View File

@ -884,9 +884,9 @@ void Fortuna_LevelComplete(Player* player) {
D_ctx_80177A48[1] = 0.0f;
D_ctx_80177A48[2] = -400.0f;
D_ctx_80177A48[3] = 0.0f;
falco->iwork[14] = 2;
slippy->iwork[14] = 3;
peppy->iwork[14] = 4;
falco->iwork[TEAM_FACE] = FACE_FALCO;
slippy->iwork[TEAM_FACE] = FACE_SLIPPY;
peppy->iwork[TEAM_FACE] = FACE_PEPPY;
}
if (gCsFrameCount == 200) {

View File

@ -329,7 +329,7 @@ void Andross_80188468(void) {
actor->obj.pos.y = 300.0f;
actor->obj.pos.z = -11959.0f;
actor->iwork[11] = 1;
actor->iwork[14] = 1;
actor->iwork[TEAM_FACE] = FACE_FOX;
actor->obj.id = OBJ_ACTOR_TEAM_ARWING;
Object_SetInfo(&actor->info, actor->obj.id);
AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, actor->sfxSource, 4);
@ -3787,7 +3787,7 @@ void Andross_801939A0(s32 actorIdx) {
actor->fwork[1] = 6.5f;
if (actorIdx == 10) {
actor->iwork[14] = 1;
actor->iwork[TEAM_FACE] = FACE_FOX;
}
if (actorIdx == 1) {
actor->state = 1;

View File

@ -57,104 +57,281 @@ AudioTable D_800C07B0 = {
(((numInst) &0xFF) << 8) | ((numDrums) &0xFF) \
}
// AudioTable gSoundFontTableInit
s32 D_800C0BE0[] = {
0x00210000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00002F00, 0x020000FF, 0x7F000000, 0x00002F00,
0x00000820, 0x020101FF, 0x7F000000, 0x00003720, 0x000006E0, 0x020002FF, 0x7F000000, 0x00003E00, 0x000015E0,
0x020002FF, 0x7F000000, 0x000053E0, 0x00000C20, 0x020002FF, 0x7F000000, 0x00006000, 0x00000FE0, 0x020002FF,
0x7F000000, 0x00006FE0, 0x00001360, 0x020002FF, 0x7F000000, 0x00008340, 0x00001120, 0x020002FF, 0x7F000000,
0x00009460, 0x00000EA0, 0x020002FF, 0x7F000000, 0x0000A300, 0x00000CE0, 0x020002FF, 0x7F000000, 0x0000AFE0,
0x00001BA0, 0x020002FF, 0x7F000000, 0x0000CB80, 0x00000AC0, 0x020002FF, 0x7F000000, 0x0000D640, 0x00000AC0,
0x020002FF, 0x7F000000, 0x0000E100, 0x00000EE0, 0x020002FF, 0x7F000000, 0x0000EFE0, 0x00000C00, 0x020002FF,
0x7F000000, 0x0000FBE0, 0x000010A0, 0x020002FF, 0x7F000000, 0x00010C80, 0x00000F80, 0x020002FF, 0x7F000000,
0x00011C00, 0x000010C0, 0x020002FF, 0x7F000000, 0x00012CC0, 0x00001380, 0x020002FF, 0x7F000000, 0x00014040,
0x00002B20, 0x020002FF, 0x7F000000, 0x00016B60, 0x000009A0, 0x020002FF, 0x7F000000, 0x00017500, 0x00001220,
0x020303FF, 0x10400000, 0x00018720, 0x00000180, 0x020303FF, 0x03000000, 0x000188A0, 0x000011C0, 0x020303FF,
0x10400000, 0x00019A60, 0x00000940, 0x020303FF, 0x0A400000, 0x0001A3A0, 0x000009E0, 0x020303FF, 0x0A400000,
0x0001AD80, 0x00000920, 0x020303FF, 0x0A400000, 0x0001B6A0, 0x000009E0, 0x020303FF, 0x0A400000, 0x0001C080,
0x000009E0, 0x020303FF, 0x0A400000, 0x0001CA60, 0x00000A10, 0x020303FF, 0x0A400000, 0x0001D470, 0x000009E0,
0x020303FF, 0x0A400000, 0x0001DE50, 0x00000A00, 0x020303FF, 0x0A400000, 0x0001E850, 0x000008D0, 0x020303FF,
0x0A400000,
};
/*
AudioTable gSoundFontTableInit = {
{ 33, 0, 0 },
{
SOUNDFONT_ENTRY(0x00000, 0x2F00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_SFX, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x02F00, 0x0FE0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_MAP, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x03EE0, 0x0640, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x04520, 0x1560, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x05A80, 0x0C00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x06680, 0x0DE0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x07460, 0x1200, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x08660, 0x1040, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x096A0, 0x0E40, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x0A4E0, 0x0C20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x0B100, 0x1920, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x0CA20, 0x0A20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x0D440, 0x0A00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x0DE40, 0x0D60, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x0EBA0, 0x0C20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x0F7C0, 0x0F00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x106C0, 0x0F20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x115E0, 0x0E20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x12400, 0x10A0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x134A0, 0x2580, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x15A20, 0x09E0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x16400, 0x1220, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64),
SOUNDFONT_ENTRY(0x17620, 0x0180, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 3, 0),
SOUNDFONT_ENTRY(0x177A0, 0x11C0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64),
SOUNDFONT_ENTRY(0x18960, 0x0940, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x192A0, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x19C80, 0x0920, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1A5A0, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1AF80, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1B960, 0x0A10, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1C370, 0x09E0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1CD50, 0x0A00, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1D750, 0x08D0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
},
SOUNDFONT_ENTRY(0x0, 0x2f00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_SFX, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x2f00, 0x820, MEDIUM_CART, CACHEPOLICY_1, SAMPLES_MAP, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x3720, 0x6e0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x3e00, 0x15e0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x53e0, 0xc20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x6000, 0xfe0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x6fe0, 0x1360, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x8340, 0x1120, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x9460, 0xea0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0xa300, 0xce0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0xafe0, 0x1ba0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0xcb80, 0xac0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0xd640, 0xac0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0xe100, 0xee0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0xefe0, 0xc00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0xfbe0, 0x10a0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x10c80, 0xf80, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x11c00, 0x10c0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x12cc0, 0x1380, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x14040, 0x2b20, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x16b60, 0x9a0, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x17500, 0x1220, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64),
SOUNDFONT_ENTRY(0x18720, 0x180, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 3, 0),
SOUNDFONT_ENTRY(0x188a0, 0x11c0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 16, 64),
SOUNDFONT_ENTRY(0x19a60, 0x940, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1a3a0, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1ad80, 0x920, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1b6a0, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1c080, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1ca60, 0xa10, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1d470, 0x9e0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1de50, 0xa00, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
SOUNDFONT_ENTRY(0x1e850, 0x8d0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
}
};
*/
#define AS_BYTES(x) (((x) >> 8) & 0xFF), ((x) &0xFF)
// u8 gSeqFontTableInit[283]
s32 D_800C0E00[] = {
0x00840086, 0x009B009D, 0x009F00A1, 0x00A300A5, 0x00A700A9, 0x00AB00AD, 0x00AF00B1, 0x00B300B5, 0x00B700B9,
0x00BB00BD, 0x00BF00C1, 0x00C300C5, 0x00C700C9, 0x00CB00CD, 0x00CF00D1, 0x00D300D5, 0x00D700D9, 0x00DB00DD,
0x00DF00E1, 0x00E300E5, 0x00E700E9, 0x00EB00ED, 0x00EF00F1, 0x00F300F5, 0x00F700F9, 0x00FB00FD, 0x00FF0101,
0x01030105, 0x01070109, 0x010B010D, 0x010F0111, 0x01130115, 0x01170119, 0x01001414, 0x13121110, 0x0F0E0D0C,
0x0B0A0908, 0x07060504, 0x03010201, 0x18011D01, 0x19011A01, 0x1C011901, 0x19011D01, 0x18011D01, 0x1C011901,
0x1E011801, 0x19011C01, 0x1C011F01, 0x1F011C01, 0x1C011F01, 0x1F011F01, 0x1C011F01, 0x1F011F01, 0x1F011F01,
0x1F012001, 0x15011501, 0x16011501, 0x15011501, 0x15011501, 0x17011901, 0x15011501, 0x1D011901, 0x1F011501,
0x15011501, 0x15011501, 0x15011501, 0x15011501, 0x1B011901, 0x15011901, 0x19011901, 0x15011F00, 0x00000000,
u8 gSeqFontTableInit[288] = {
AS_BYTES(132),
AS_BYTES(134),
AS_BYTES(155),
AS_BYTES(157),
AS_BYTES(159),
AS_BYTES(161),
AS_BYTES(163),
AS_BYTES(165),
AS_BYTES(167),
AS_BYTES(169),
AS_BYTES(171),
AS_BYTES(173),
AS_BYTES(175),
AS_BYTES(177),
AS_BYTES(179),
AS_BYTES(181),
AS_BYTES(183),
AS_BYTES(185),
AS_BYTES(187),
AS_BYTES(189),
AS_BYTES(191),
AS_BYTES(193),
AS_BYTES(195),
AS_BYTES(197),
AS_BYTES(199),
AS_BYTES(201),
AS_BYTES(203),
AS_BYTES(205),
AS_BYTES(207),
AS_BYTES(209),
AS_BYTES(211),
AS_BYTES(213),
AS_BYTES(215),
AS_BYTES(217),
AS_BYTES(219),
AS_BYTES(221),
AS_BYTES(223),
AS_BYTES(225),
AS_BYTES(227),
AS_BYTES(229),
AS_BYTES(231),
AS_BYTES(233),
AS_BYTES(235),
AS_BYTES(237),
AS_BYTES(239),
AS_BYTES(241),
AS_BYTES(243),
AS_BYTES(245),
AS_BYTES(247),
AS_BYTES(249),
AS_BYTES(251),
AS_BYTES(253),
AS_BYTES(255),
1,
1,
1,
3,
1,
5,
1,
7,
1,
9,
1,
11,
1,
13,
1,
15,
1,
17,
1,
19,
1,
21,
1,
23,
1,
25,
1,
0,
20,
20,
19,
18,
17,
16,
15,
14,
13,
12,
11,
10,
9,
8,
7,
6,
5,
4,
3,
1,
2,
1,
24,
1,
29,
1,
25,
1,
26,
1,
28,
1,
25,
1,
25,
1,
29,
1,
24,
1,
29,
1,
28,
1,
25,
1,
30,
1,
24,
1,
25,
1,
28,
1,
28,
1,
31,
1,
31,
1,
28,
1,
28,
1,
31,
1,
31,
1,
31,
1,
28,
1,
31,
1,
31,
1,
31,
1,
31,
1,
31,
1,
31,
1,
32,
1,
21,
1,
21,
1,
22,
1,
21,
1,
21,
1,
21,
1,
21,
1,
21,
1,
23,
1,
25,
1,
21,
1,
21,
1,
29,
1,
25,
1,
31,
1,
21,
1,
21,
1,
21,
1,
21,
1,
21,
1,
21,
1,
21,
1,
21,
1,
21,
1,
27,
1,
25,
1,
21,
1,
25,
1,
25,
1,
25,
1,
21,
1,
31,
0,
0,
0,
0,
0,
};
// clang-format off
/*
u8 gSeqFontTableInit[283] = {
// Offset into this table for sequence sound font list
AS_BYTES(132), AS_BYTES(134), AS_BYTES(155), AS_BYTES(157), AS_BYTES(159), AS_BYTES(161), AS_BYTES(163),
AS_BYTES(165), AS_BYTES(167), AS_BYTES(169), AS_BYTES(171), AS_BYTES(173), AS_BYTES(175), AS_BYTES(177),
AS_BYTES(179), AS_BYTES(181), AS_BYTES(183), AS_BYTES(185), AS_BYTES(187), AS_BYTES(189), AS_BYTES(191),
AS_BYTES(193), AS_BYTES(195), AS_BYTES(197), AS_BYTES(199), AS_BYTES(201), AS_BYTES(203), AS_BYTES(205),
AS_BYTES(207), AS_BYTES(209), AS_BYTES(211), AS_BYTES(213), AS_BYTES(215), AS_BYTES(217), AS_BYTES(219),
AS_BYTES(221), AS_BYTES(223), AS_BYTES(225), AS_BYTES(227), AS_BYTES(229), AS_BYTES(231), AS_BYTES(233),
AS_BYTES(235), AS_BYTES(237), AS_BYTES(239), AS_BYTES(241), AS_BYTES(243), AS_BYTES(245), AS_BYTES(247),
AS_BYTES(249), AS_BYTES(251), AS_BYTES(253), AS_BYTES(255), AS_BYTES(257), AS_BYTES(259), AS_BYTES(261),
AS_BYTES(263), AS_BYTES(265), AS_BYTES(267), AS_BYTES(269), AS_BYTES(271), AS_BYTES(273), AS_BYTES(275),
AS_BYTES(277), AS_BYTES(279), AS_BYTES(281),
// sound font for SFX sequence
1, 0,
// sound fonts voice sequence
20, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 2,
// sound fonts for BGM sequences. Each sequence has a single sound font.
1, 24, 1, 29, 1, 25, 1, 26, 1, 28, 1, 25, 1, 25, 1, 29, 1, 24, 1, 29, 1, 28, 1, 25, 1, 30, 1, 24, 1, 25, 1, 28,
1, 28, 1, 31, 1, 31, 1, 28, 1, 28, 1, 31, 1, 31, 1, 31, 1, 28, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 31, 1, 32,
1, 21, 1, 21, 1, 22, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 23, 1, 25, 1, 21, 1, 21, 1, 29, 1, 25, 1, 31, 1, 21,
1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 21, 1, 27, 1, 25, 1, 21, 1, 25, 1, 25, 1, 25, 1, 21, 1, 31
};
*/
// clang-format on