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/sf64event.h
- include/sf64player.h - include/sf64player.h
d064229a32cc05ab85e2381ce07744eb3ffaf530: # d064229a32cc05ab85e2381ce07744eb3ffaf530:
name: Star Fox 64 (JP) (V1.0) # name: Star Fox 64 (JP) (V1.0)
path: assets/yaml/jp/rev0 # path: assets/yaml/jp/rev0
config: # config:
gbi: F3DEX # gbi: F3DEX
sort: OFFSET # sort: OFFSET
output: # output:
binary: starship.otr # binary: starship.otr
code: src/assets # code: src/assets
headers: include/assets # headers: include/assets
modding: src/assets # modding: src/assets
enums: # enums:
- include/sf64object.h # - include/sf64object.h
- include/sf64level.h # - include/sf64level.h
- include/sf64mesg.h # - include/sf64mesg.h
- include/sf64audio_external.h # - include/sf64audio_external.h
- include/sf64event.h # - include/sf64event.h
- include/sf64player.h # - include/sf64player.h

View File

@ -9,6 +9,10 @@
#define TIME_IN_SECONDS(x) (x * 30); #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_FLOAT(max) (Rand_ZeroOne()*(max))
#define RAND_INT(max) ((s32)(Rand_ZeroOne()*(max))) #define RAND_INT(max) ((s32)(Rand_ZeroOne()*(max)))
#define RAND_FLOAT_CENTERED(width) ((Rand_ZeroOne()-0.5f)*(width)) #define RAND_FLOAT_CENTERED(width) ((Rand_ZeroOne()-0.5f)*(width))

View File

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

View File

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

View File

@ -8,6 +8,16 @@
#define HITBOX_SHADOW 300000.0f #define HITBOX_SHADOW 300000.0f
#define HITBOX_WHOOSH 400000.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 { typedef struct {
/* 0x0 */ f32 offset; /* 0x0 */ f32 offset;
/* 0x4 */ f32 size; /* 0x4 */ f32 size;

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,19 @@
#include "sys.h" #include "sys.h"
#include "sf64audio_provisional.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 s32 D_80145D40; // unused
// all of these are part of the DFT-related function // 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_80009A2C(s32 updateIndex, s32 noteIndex);
void func_80009AAC(s32 updateIndex); void func_80009AAC(s32 updateIndex);
Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf, s32 aiBufLen, Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf,
Acmd* aList, s32 updateIndex); s32 aiBufLen, Acmd* aList, s32 updateIndex);
Acmd* func_8000A25C(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_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_80009984(Acmd* aList, u16 dmem, u16 startPos, s32 size, s32 reverbIndex);
Acmd* func_80009D78(Acmd* aList, s32 aiBufLen, s16 reverbIndex, s16 updateIndex); Acmd* func_80009D78(Acmd* aList, s32 aiBufLen, s16 reverbIndex, s16 updateIndex);
Acmd* func_8000A128(Acmd* aList, 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_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, Acmd* func_8000B51C(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState, s32 aiBufLen, u16 dmemSrc,
s32 delaySide, s32 flags); 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); s32 delaySide);
void func_800080C0(s32 sampleCount, s32 itemIndex, s32 reverbIndex) { 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; Acmd* aCmdPtr;
s32* aiBufPtr; s32* aiBufPtr;
s32 chunkLen; s32 chunkLen;
@ -640,7 +653,7 @@ Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen) {
aCmdPtr = aList; aCmdPtr = aList;
for (i = gAudioBufferParams.ticksPerUpdate; i > 0; i--) { for (i = gAudioBufferParams.ticksPerUpdate; i > 0; i--) {
func_8001678C(i - 1); AudioSeq_ProcessSequences(i - 1);
func_80009AAC(gAudioBufferParams.ticksPerUpdate - i); 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) { if (i != gNoteSubsEu[updateIndex * gNumNotes + sp84[j]].bitField1.reverbIndex) {
break; 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); &gNotes[sp84[j]].synthesisState, aiBuf, aiBufLen, aList, updateIndex);
j++; j++;
} }
@ -797,8 +810,8 @@ Acmd* func_8000A25C(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 updateIndex) {
} }
while (j < var_s2) { while (j < var_s2) {
aList = func_8000A700(sp84[j], &gNoteSubsEu[updateIndex * gNumNotes + sp84[j]], &gNotes[sp84[j]].synthesisState, aList = AudioSynth_ProcessNote(sp84[j], &gNoteSubsEu[updateIndex * gNumNotes + sp84[j]],
aiBuf, aiBufLen, aList, updateIndex); &gNotes[sp84[j]].synthesisState, aiBuf, aiBufLen, aList, updateIndex);
j++; j++;
} }
@ -810,81 +823,83 @@ Acmd* func_8000A25C(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 updateIndex) {
return aList; return aList;
} }
// https://decomp.me/scratch/RgX4r Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf,
#ifdef NON_MATCHING s32 aiBufLen, Acmd* aList, s32 updateIndex) {
Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synthState, s16* aiBuf, s32 aiBufLen,
Acmd* aList, s32 updateIndex) {
s32 pad11C; s32 pad11C;
s32 pad118; s32 pad118;
s32 pad114; s32 pad114;
Sample* bookSample; // sp110 Sample* bookSample;
AdpcmLoop* loopInfo; // sp10C AdpcmLoop* loopInfo;
void* currentBook; // sp108 void* currentBook;
s32 pad104; s32 pad104;
s32 pad100; s32 pad100;
s32 noteFinished; // spFC s32 sampleFinished;
u32 restart; // spF8 u32 loopToPoint;
s32 flags; // spF4 s32 flags;
u16 resampleRateFixedPoint; // spF2 u16 resampleRateFixedPoint;
s32 nSamplesToLoad; // spEC s32 numSamplesToLoad;
s32 padE8; s32 padE8;
s32 padE4; s32 padE4;
s32 padE0; s32 padE0;
s32 skipBytes; // spDC s32 skipBytes;
s32 padD8; s32 padD8;
s32 padD4; s32 padD4;
s32 padD0; s32 padD0;
u32 sampleAddr; // spCC u32 sampleAddr;
s32 padC8; s32 padC8;
s32 samplesLenAdjusted; // spC4 s32 numSamplesToLoadAdj;
s32 nAdpcmSamplesProcessed; // spC0 s32 numSamplesProcessed;
u32 endPos; // spBC u32 endPos;
s32 nSamplesToProcess; // spB8 s32 nSamplesToProcess;
s32 padB4; s32 padB4;
s32 padB0; s32 padB0;
s32 padAC; s32 padAC;
s32 padA8;
s32 padA4; s32 padA4;
s32 nTrailingSamplesToIgnore; // spA0 s32 padA8;
s32 numTrailingSamplesToIgnore;
s32 pad9C; s32 pad9C;
s32 pad98; s32 pad98;
s32 pad94; s32 pad94;
s32 frameSize; // sp90 s32 frameSize;
s32 pad8C; s32 pad8C;
s32 skipInitialSamples; // sp88 s32 skipInitialSamples;
s32 sampleDmaStart; // sp84 s32 sampleDmaStart;
s32 pad80; s32 pad80;
s32 nParts; // sp7C s32 numParts;
s32 curPart; // sp78 s32 curPart;
s32 nSamplesInThisIteration; s32 numSamplesInThisIteration;
s32 sampleDataStartPad; s32 sampleDataChunkAlignPad;
s32 resampledTempLen; // sp6C s32 resampledTempLen;
u16 noteSamplesDmemAddrBeforeResampling; // sp6A u16 noteSamplesDmemAddrBeforeResampling;
s32 samplesRemaining; s32 pasdasd;
s32 frameIndex; s32 frameIndex;
s32 sampleDataOffset; s32 sampleDataOffset;
Note* note; // sp58 Note* note;
u16 sp56; // sp56 u16 sp56;
s32 numSamplesInFirstFrame;
s32 nSamplesInFirstFrame;
s32 delaySide; s32 delaySide;
s32 nSamplesToDecode; s32 padasdsa;
s32 nFramesToDecode; s32 nFramesToDecode;
s32 nFirstFrameSamplesToIgnore; s32 nFirstFrameSamplesToIgnore;
s32 s5; s32 dmemUncompressedAddrOffset1;
u32 sampleslenFixedPoint; u32 sampleslenFixedPoint;
u8* sampleData; u8* samplesToLoadAddr;
s32 temp; s32 temp;
s32 temp2; s32 temp2;
unsigned int new_var2;
u32 nEntries; u32 nEntries;
s32 aligned; s32 aligned;
s32 align2; s32 align2;
u16 addr; s16 addr;
u8* new_var;
s32 samplesRemaining;
s32 numSamplesToDecode;
currentBook = NULL; currentBook = NULL;
note = &gNotes[noteIndex]; note = &gNotes[noteIndex];
flags = 0; flags = 0;
if (noteSub->bitField0.needsInit == 1) {
if (new_var2 = noteSub->bitField0.needsInit == 1) { // FAKE
flags = 1; flags = 1;
synthState->restart = 0; synthState->restart = 0;
synthState->samplePosInt = 0; synthState->samplePosInt = 0;
@ -896,221 +911,253 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
synthState->numParts = 0; synthState->numParts = 0;
note->noteSubEu.bitField0.finished = 0; note->noteSubEu.bitField0.finished = 0;
} }
resampleRateFixedPoint = noteSub->resampleRate; resampleRateFixedPoint = noteSub->resampleRate;
nParts = noteSub->bitField1.hasTwoParts + 1; numParts = noteSub->bitField1.hasTwoParts + 1;
sampleslenFixedPoint = (resampleRateFixedPoint * aiBufLen * 2) + synthState->samplePosFrac; sampleslenFixedPoint = ((resampleRateFixedPoint * aiBufLen) * 2) + synthState->samplePosFrac;
nSamplesToLoad = (sampleslenFixedPoint) >> 0x10; numSamplesToLoad = sampleslenFixedPoint >> 0x10;
synthState->samplePosFrac = sampleslenFixedPoint & 0xFFFF; synthState->samplePosFrac = sampleslenFixedPoint & 0xFFFF;
if ((synthState->numParts == 1) && (nParts == 2)) {
nSamplesToLoad += 2; if ((synthState->numParts == 1) && (numParts == 2)) {
numSamplesToLoad += 2;
sp56 = 2; sp56 = 2;
} else if ((synthState->numParts == 2) && (nParts == 1)) { } else if ((synthState->numParts == 2) && (numParts == 1)) {
nSamplesToLoad -= 4; numSamplesToLoad -= 4;
sp56 = 4; sp56 = 4;
} else { } else {
sp56 = 0; sp56 = 0;
} }
synthState->numParts = nParts;
synthState->numParts = numParts;
if (noteSub->bitField1.isSyntheticWave) { if (noteSub->bitField1.isSyntheticWave) {
aList = func_8000B3F0(aList, noteSub, synthState, nSamplesToLoad); aList = AudioSynth_LoadWaveSamples(aList, noteSub, synthState, numSamplesToLoad);
noteSamplesDmemAddrBeforeResampling = (synthState->samplePosInt * 2) + 0x5F0; noteSamplesDmemAddrBeforeResampling = (synthState->samplePosInt * ((char) 2)) + 0x5F0;
synthState->samplePosInt += nSamplesToLoad; synthState->samplePosInt += numSamplesToLoad;
} else { } else {
bookSample = *(Sample**) noteSub->waveSampleAddr; bookSample = *((Sample**) noteSub->waveSampleAddr);
loopInfo = bookSample->loop; loopInfo = bookSample->loop;
endPos = loopInfo->end; endPos = loopInfo->end;
sampleAddr = bookSample->sampleAddr; sampleAddr = bookSample->sampleAddr;
resampledTempLen = 0; resampledTempLen = 0;
for (curPart = 0; curPart < nParts; curPart++) { for (curPart = 0; curPart < numParts; curPart++) {
nAdpcmSamplesProcessed = 0; numSamplesProcessed = 0;
s5 = 0; dmemUncompressedAddrOffset1 = 0;
if (nParts == 1) { if (numParts == 1) {
samplesLenAdjusted = nSamplesToLoad; numSamplesToLoadAdj = numSamplesToLoad;
} else if (nSamplesToLoad & 1) { } else if (numSamplesToLoad & 1) {
samplesLenAdjusted = (nSamplesToLoad & ~1) + (curPart * 2); numSamplesToLoadAdj = (numSamplesToLoad & (~1)) + (curPart * 2);
} else { } else {
samplesLenAdjusted = nSamplesToLoad; numSamplesToLoadAdj = numSamplesToLoad;
} }
if ((bookSample->codec == 0) && (currentBook != bookSample->book->book)) { if ((bookSample->codec == 0) && (currentBook != bookSample->book->book)) {
switch (noteSub->bitField1.bookOffset) { switch (noteSub->bitField1.bookOffset) {
case 1: case 1:
currentBook = &gD_800DD200[1]; currentBook = &gD_800DD200[1];
break; break;
case 2: case 2:
currentBook = &gD_800DD200[2]; currentBook = &gD_800DD200[2];
break; break;
default: default:
case 3: case 3:
currentBook = bookSample->book->book; currentBook = bookSample->book->book;
break; 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)); aLoadADPCM(aList++, nEntries, OS_K0_TO_PHYSICAL(currentBook));
} }
while (nAdpcmSamplesProcessed != samplesLenAdjusted) {
restart = 0; while (numSamplesProcessed != numSamplesToLoadAdj) {
noteFinished = 0; sampleFinished = 0;
loopToPoint = 0;
samplesRemaining = endPos - synthState->samplePosInt; samplesRemaining = endPos - synthState->samplePosInt;
nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed; nSamplesToProcess = numSamplesToLoadAdj - numSamplesProcessed;
nFirstFrameSamplesToIgnore = synthState->samplePosInt & 0xF; nFirstFrameSamplesToIgnore = synthState->samplePosInt & 0xF;
if ((nFirstFrameSamplesToIgnore == 0) && (!synthState->restart)) {
if ((nFirstFrameSamplesToIgnore == 0) && !synthState->restart) {
nFirstFrameSamplesToIgnore = 0x10; nFirstFrameSamplesToIgnore = 0x10;
} }
numSamplesInFirstFrame = 0x10 - nFirstFrameSamplesToIgnore;
nSamplesInFirstFrame = 0x10 - nFirstFrameSamplesToIgnore;
if (nSamplesToProcess < samplesRemaining) { if (nSamplesToProcess < samplesRemaining) {
nFramesToDecode = (nSamplesToProcess - nSamplesInFirstFrame + 0xF) / 16; nFramesToDecode = ((nSamplesToProcess - numSamplesInFirstFrame) + 0xF) / 16;
nSamplesToDecode = nFramesToDecode * 0x10; numSamplesToDecode = nFramesToDecode * 0x10;
// if(1) {} numTrailingSamplesToIgnore = (numSamplesInFirstFrame + numSamplesToDecode) - nSamplesToProcess;
nTrailingSamplesToIgnore = (nSamplesInFirstFrame + nSamplesToDecode) - nSamplesToProcess;
} else { } else {
nSamplesToDecode = samplesRemaining - nSamplesInFirstFrame; numSamplesToDecode = samplesRemaining - numSamplesInFirstFrame;
nTrailingSamplesToIgnore = 0; numTrailingSamplesToIgnore = 0;
if (nSamplesToDecode <= 0) { if (numSamplesToDecode <= 0) {
nSamplesToDecode = 0; numSamplesToDecode = 0;
nSamplesInFirstFrame = samplesRemaining; numSamplesInFirstFrame = samplesRemaining;
} }
nFramesToDecode = (nSamplesToDecode + 0xF) / 16; nFramesToDecode = (numSamplesToDecode + 0xF) / 16;
if (loopInfo->count != 0) { if (loopInfo->count != 0) {
restart = 1; loopToPoint = 1;
} else { } else {
noteFinished = 1; sampleFinished = 1;
} }
} }
switch (bookSample->codec) { switch (bookSample->codec) {
case 0: case 0:
frameSize = 9; frameSize = 9;
skipInitialSamples = 0x10; skipInitialSamples = 0x10;
sampleDmaStart = 0; sampleDmaStart = 0;
break; break;
case 1: case 1:
frameSize = 0x10; frameSize = 0x10;
skipInitialSamples = 0x10; skipInitialSamples = 0x10;
sampleDmaStart = 0; sampleDmaStart = 0;
break; break;
case 2: case 2:
temp = temp = func_800097A8(bookSample, numSamplesToLoadAdj, flags,
func_800097A8(bookSample, samplesLenAdjusted, flags, &synthState->synthesisBuffers->unk_40); &synthState->synthesisBuffers->unk_40);
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(temp), 0x5F0, (samplesLenAdjusted + 0x10) * 2); if (0) {}
s5 = samplesLenAdjusted; aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(temp), 0x5F0, (numSamplesToLoadAdj + 0x10) * 2);
nAdpcmSamplesProcessed = samplesLenAdjusted; flags = 0;
skipBytes = 0; skipBytes = 0;
numSamplesProcessed = numSamplesToLoadAdj;
dmemUncompressedAddrOffset1 = numSamplesToLoadAdj;
goto skip; goto skip;
} }
aligned = ALIGN16(nFramesToDecode * frameSize + 0x10);
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
addr = 0x990 - aligned; addr = 0x990 - aligned;
if (nFramesToDecode != 0) { if (nFramesToDecode != 0) {
if (1) {}
frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16; frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16;
sampleDataOffset = frameIndex * frameSize; sampleDataOffset = frameIndex * frameSize;
if (bookSample->medium == 0) { if (bookSample->medium == 0) {
sampleData = sampleDmaStart + sampleDataOffset + sampleAddr; samplesToLoadAddr = (u8*) (sampleDmaStart + sampleDataOffset + sampleAddr);
} else { } else {
sampleData = AudioLoad_DmaSampleData(sampleDmaStart + sampleDataOffset + sampleAddr, aligned, samplesToLoadAddr =
flags, &synthState->sampleDmaIndex, bookSample->medium); AudioLoad_DmaSampleData(sampleDmaStart + sampleDataOffset + sampleAddr, aligned, flags,
&synthState->sampleDmaIndex, bookSample->medium);
} }
// if (1){} sampleDataChunkAlignPad = ((u32) samplesToLoadAddr) % 16;
sampleDataStartPad = (u32) sampleData & 0xF;
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(sampleData - sampleDataStartPad), addr, aligned); aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(samplesToLoadAddr - sampleDataChunkAlignPad), addr, aligned);
} else { } else {
nSamplesToDecode = 0; numSamplesToDecode = 0;
sampleDataStartPad = 0; sampleDataChunkAlignPad = 0;
} }
if (synthState->restart) { if (synthState->restart) {
aSetLoop(aList++, OS_K0_TO_PHYSICAL(bookSample->loop->predictorState)); aSetLoop(aList++, OS_K0_TO_PHYSICAL(bookSample->loop->predictorState));
flags = 2; flags = 2;
synthState->restart = 0; synthState->restart = 0;
} }
nSamplesInThisIteration = nSamplesToDecode + nSamplesInFirstFrame - nTrailingSamplesToIgnore;
if (nAdpcmSamplesProcessed == 0) { numSamplesInThisIteration = (numSamplesToDecode + numSamplesInFirstFrame) - numTrailingSamplesToIgnore;
if (numSamplesProcessed == 0) {
switch (bookSample->codec) { switch (bookSample->codec) {
case 0: 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)); aADPCMdec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break; break;
case 1: 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)); aS8Dec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break; break;
} }
skipBytes = nFirstFrameSamplesToIgnore * 2; skipBytes = nFirstFrameSamplesToIgnore * 2;
} else { } else {
// if (1) {} align2 = ALIGN16(dmemUncompressedAddrOffset1 + 0x10);
align2 = ALIGN16(s5 + 0x10);
switch (bookSample->codec) { switch (bookSample->codec) {
case 0: 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)); aADPCMdec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break; break;
case 1: 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)); aS8Dec(aList++, flags, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers));
break; 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) { switch (flags) {
case 1: case 1:
skipBytes = 0x20; skipBytes = 0x20;
s5 = (nSamplesToDecode + 0x10) * 2; dmemUncompressedAddrOffset1 = (numSamplesToDecode + 0x10) * 2;
break; break;
case 2: case 2:
// if(1) {} dmemUncompressedAddrOffset1 = (numSamplesInThisIteration * 2) + dmemUncompressedAddrOffset1;
s5 = nSamplesInThisIteration * 2 + s5;
break; break;
default: default:
if (s5 != 0) { if (dmemUncompressedAddrOffset1 != 0) {
s5 = nSamplesInThisIteration * 2 + s5; dmemUncompressedAddrOffset1 = (numSamplesInThisIteration * 2) + dmemUncompressedAddrOffset1;
} else { } else {
// if (1) { } dmemUncompressedAddrOffset1 = (nFirstFrameSamplesToIgnore + numSamplesInThisIteration) * 2;
s5 = (nFirstFrameSamplesToIgnore + nSamplesInThisIteration) * 2;
} }
break; break;
} }
skip: skip:
flags = 0; flags = 0;
// goto dummy_label_147574; dummy_label_147574: ;
if (noteFinished) { if (sampleFinished) {
aClearBuffer(aList++, s5 + 0x5F0, (samplesLenAdjusted - nAdpcmSamplesProcessed) * 2); aClearBuffer(aList++, dmemUncompressedAddrOffset1 + 0x5F0,
(numSamplesToLoadAdj - numSamplesProcessed) * 2);
noteSub->bitField0.finished = 1; noteSub->bitField0.finished = 1;
note->noteSubEu.bitField0.finished = 1; note->noteSubEu.bitField0.finished = 1;
func_80009A2C(updateIndex, noteIndex); func_80009A2C(updateIndex, noteIndex);
break; break;
} }
if (restart) { if (loopToPoint != 0) {
synthState->restart = 1; synthState->restart = 1;
synthState->samplePosInt = loopInfo->start; synthState->samplePosInt = loopInfo->start;
} else { } else {
synthState->samplePosInt += nSamplesToProcess; synthState->samplePosInt += nSamplesToProcess;
} }
} }
switch (nParts) {
switch (numParts) {
case 1: case 1:
noteSamplesDmemAddrBeforeResampling = skipBytes + 0x5F0; noteSamplesDmemAddrBeforeResampling = skipBytes + 0x5F0;
break; break;
case 2: case 2:
switch (curPart) { switch (curPart) {
case 0: case 0:
aInterl(aList++, skipBytes + 0x5F0, 0x470, ALIGN8(samplesLenAdjusted / 2)); aInterl(aList++, skipBytes + 0x5F0, 0x470, ALIGN8(numSamplesToLoadAdj / 2));
resampledTempLen = samplesLenAdjusted; resampledTempLen = numSamplesToLoadAdj;
noteSamplesDmemAddrBeforeResampling = 0x470; noteSamplesDmemAddrBeforeResampling = 0x470;
if (noteSub->bitField0.finished) { if (noteSub->bitField0.finished) {
aClearBuffer(aList++, resampledTempLen + noteSamplesDmemAddrBeforeResampling, aClearBuffer(aList++, resampledTempLen + noteSamplesDmemAddrBeforeResampling,
samplesLenAdjusted + 0x10); numSamplesToLoadAdj + 0x10);
} }
break; break;
case 1: case 1:
aInterl(aList++, skipBytes + 0x5F0, resampledTempLen + 0x470, aInterl(aList++, skipBytes + 0x5F0, resampledTempLen + 0x470,
ALIGN8(samplesLenAdjusted / 2)); ALIGN8(numSamplesToLoadAdj / 2));
break; break;
} }
break; break;
} }
@ -1125,12 +1172,15 @@ Acmd* func_8000A700(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisState* synth
flags = 1; flags = 1;
noteSub->bitField0.needsInit = 0; noteSub->bitField0.needsInit = 0;
} }
flags = sp56 | flags; flags = sp56 | flags;
aList = func_8000B480(aList, synthState, aiBufLen * 2, resampleRateFixedPoint, noteSamplesDmemAddrBeforeResampling, aList = func_8000B480(aList, synthState, aiBufLen * 2, resampleRateFixedPoint, noteSamplesDmemAddrBeforeResampling,
flags); flags);
if (flags & 1) { if (flags & 1) {
flags = 1; flags = 1;
} }
if (noteSub->bitField1.bookOffset == 3) { if (noteSub->bitField1.bookOffset == 3) {
aUnkCmd19(aList++, 0, aiBufLen * 2, 0x450, 0x450); 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); aHiLoGain(aList++, temp2, (aiBufLen + 0x10) * 2, 0x450, 0);
} }
if ((noteSub->leftDelaySize != 0) || (synthState->prevHaasEffectLeftDelaySize != 0)) { if ((noteSub->leftDelaySize != 0) || (synthState->prevHaasEffectLeftDelaySize != 0)) {
delaySide = 1; delaySide = 1;
} else if ((noteSub->rightDelaySize != 0) || (synthState->prevHaasEffectRightDelaySize != 0)) { } 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); aList = func_8000B51C(aList, noteSub, synthState, aiBufLen, 0x450, delaySide, flags);
// if(restart) {}
if (noteSub->bitField0.usesHeadsetPanEffects) { if (noteSub->bitField0.usesHeadsetPanEffects) {
if (!(flags & 1)) { if (!(flags & 1)) {
flags = 0; flags = 0;
} }
aList = func_8000B98C(aList, noteSub, synthState, aiBufLen * 2, flags, delaySide); aList = AudioSynth_ApplyHaasEffect(aList, noteSub, synthState, aiBufLen * 2, flags, delaySide);
} }
return aList; 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) { Acmd* AudioSynth_LoadWaveSamples(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthState,
s32 temp_v1; s32 numSamplesToLoad) {
s32 numSamplesAvail;
s32 numDuplicates;
aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(noteSub->waveSampleAddr), 0x5F0, 0x80); aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(noteSub->waveSampleAddr), DMEM_UNCOMPRESSED_NOTE,
synthState->samplePosInt &= 0x3F; WAVE_SAMPLE_COUNT * SAMPLE_SIZE);
temp_v1 = 0x40 - synthState->samplePosInt;
if (temp_v1 < numSamplesToLoad) { // Offset in the WAVE_SAMPLE_COUNT samples of gWaveSamples to start processing the wave for continuity
if ((((numSamplesToLoad - temp_v1) + 0x3F) / 64) != 0) { synthState->samplePosInt = (u32) synthState->samplePosInt % WAVE_SAMPLE_COUNT;
aDuplicate(aList++, ((numSamplesToLoad - temp_v1) + 0x3F) / 64, 0x5F0, 0x670); // 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; return aList;
@ -1263,60 +1322,67 @@ Acmd* func_8000B51C(Acmd* aList, NoteSubEu* noteSub, NoteSynthesisState* synthSt
return aList; 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) { s32 delaySide) {
u16 var_t0; u16 dmemDest;
u8 var_a1; u8 haasEffectDelaySize;
u8 var_v1; u8 prevHaasEffectDelaySize;
u16 temp; u16 pitch;
switch (delaySide) { switch (delaySide) {
case 1: case HAAS_EFFECT_DELAY_LEFT:
var_t0 = 0x990; dmemDest = DMEM_LEFT_CH;
var_a1 = noteSub->leftDelaySize; haasEffectDelaySize = noteSub->leftDelaySize;
prevHaasEffectDelaySize = synthState->prevHaasEffectLeftDelaySize;
synthState->prevHaasEffectRightDelaySize = 0; synthState->prevHaasEffectRightDelaySize = 0;
var_v1 = synthState->prevHaasEffectLeftDelaySize; synthState->prevHaasEffectLeftDelaySize = haasEffectDelaySize;
synthState->prevHaasEffectLeftDelaySize = var_a1;
break; break;
case 2: case HAAS_EFFECT_DELAY_RIGHT:
var_t0 = 0xB10; dmemDest = DMEM_RIGHT_CH;
var_a1 = noteSub->rightDelaySize; haasEffectDelaySize = noteSub->rightDelaySize;
prevHaasEffectDelaySize = synthState->prevHaasEffectRightDelaySize;
synthState->prevHaasEffectRightDelaySize = haasEffectDelaySize;
synthState->prevHaasEffectLeftDelaySize = 0; synthState->prevHaasEffectLeftDelaySize = 0;
var_v1 = synthState->prevHaasEffectRightDelaySize;
synthState->prevHaasEffectRightDelaySize = var_a1;
break; break;
default: default: // HAAS_EFFECT_DELAY_NONE
return aList; return aList;
} }
if (flags != 1) { if (flags != A_INIT) {
if (var_a1 != var_v1) { if (haasEffectDelaySize != prevHaasEffectDelaySize) {
temp = (((size << 0xF) / 2) - 1) / ((size + var_a1 - var_v1 - 2) / 2); pitch = (((size << 0xF) / 2) - 1) / ((size + haasEffectDelaySize - prevHaasEffectDelaySize - 2) / 2);
aSetBuffer(aList++, 0, 0x650, 0x450, size + var_a1 - var_v1); aSetBuffer(aList++, 0, DMEM_HAAS_TEMP, DMEM_TEMP, size + haasEffectDelaySize - prevHaasEffectDelaySize);
aResampleZoh(aList++, temp, 0); aResampleZoh(aList++, pitch, 0);
} else { } 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, aLoadBuffer(aList++, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers->panSamplesBuffer), 0x650,
ALIGN16(var_v1)); ALIGN16(prevHaasEffectDelaySize));
aDMEMMove(aList++, 0x450, var_v1 + 0x650, size + var_a1 - var_v1); aDMEMMove(aList++, DMEM_TEMP, prevHaasEffectDelaySize + DMEM_HAAS_TEMP,
size + haasEffectDelaySize - prevHaasEffectDelaySize);
} else { } else {
aDMEMMove(aList++, 0x450, 0x650, size + var_a1); aDMEMMove(aList++, DMEM_TEMP, DMEM_HAAS_TEMP, size + haasEffectDelaySize);
} }
} else { } else {
aDMEMMove(aList++, 0x650, 0x450, size); aDMEMMove(aList++, DMEM_HAAS_TEMP, DMEM_TEMP, size);
aClearBuffer(aList++, 0x650, var_a1); aClearBuffer(aList++, DMEM_HAAS_TEMP, haasEffectDelaySize);
aDMEMMove(aList++, 0x450, var_a1 + 0x650, size); aDMEMMove(aList++, DMEM_TEMP, haasEffectDelaySize + DMEM_HAAS_TEMP, size);
}
if (var_a1) {
aSaveBuffer(aList++, size + 0x650, OS_K0_TO_PHYSICAL(synthState->synthesisBuffers->panSamplesBuffer),
ALIGN16(var_a1));
} }
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; return aList;
} }

View File

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

View File

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

View File

@ -588,7 +588,7 @@ void ActorTeamArwing_Draw(ActorTeamArwing* this) {
gActorTeamArwing.laserGunsYpos = gActorTeamArwing.laserGunsXpos = gActorTeamArwing.wingsXrot = gActorTeamArwing.laserGunsYpos = gActorTeamArwing.laserGunsXpos = gActorTeamArwing.wingsXrot =
gActorTeamArwing.wingsYrot = gActorTeamArwing.cockpitGlassXrot = gActorTeamArwing.wingsZrot = 0.0f; gActorTeamArwing.wingsYrot = gActorTeamArwing.cockpitGlassXrot = gActorTeamArwing.wingsZrot = 0.0f;
gActorTeamArwing.unk_28 = this->fwork[17]; gActorTeamArwing.unk_28 = this->fwork[17];
gActorTeamArwing.drawFace = this->iwork[14]; gActorTeamArwing.drawFace = this->iwork[TEAM_FACE];
gActorTeamArwing.teamFaceXrot = this->fwork[20]; gActorTeamArwing.teamFaceXrot = this->fwork[20];
gActorTeamArwing.teamFaceYrot = this->fwork[19]; 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.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos = sAqCoralReef2Pos[posIdx]; this->obj.pos = sAqCoralReef2Pos[posIdx];
this->obj.pos.z -= gPathProgress; this->obj.pos.z -= gPathProgress;
this->animFrame = 46; this->animFrame = ACTOR_CS_AQ_CORAL_REEF_2;
Object_SetInfo(&this->info, this->obj.id); 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.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos = sAqRockPos[posIdx]; this->obj.pos = sAqRockPos[posIdx];
this->obj.pos.z -= gPathProgress; this->obj.pos.z -= gPathProgress;
this->animFrame = 47; this->animFrame = ACTOR_CS_AQ_ROCK;
Object_SetInfo(&this->info, this->obj.id); Object_SetInfo(&this->info, this->obj.id);
} }

View File

@ -2972,9 +2972,9 @@ void Corneria_LevelStart(Player* player) {
Corneria_CsTeamSetup(slippy, 1); Corneria_CsTeamSetup(slippy, 1);
Corneria_CsTeamSetup(peppy, 2); Corneria_CsTeamSetup(peppy, 2);
falco->iwork[14] = 2; falco->iwork[TEAM_FACE] = FACE_FALCO;
slippy->iwork[14] = 3; slippy->iwork[TEAM_FACE] = FACE_SLIPPY;
peppy->iwork[14] = 4; peppy->iwork[TEAM_FACE] = FACE_PEPPY;
player->cam.eye.x = gCsCamEyeX = player->pos.x - 400.0f; player->cam.eye.x = gCsCamEyeX = player->pos.x - 400.0f;
gPlayer[0].cam.eye.y = gCsCamEyeY = player->pos.y + 600.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); Object_SetInfo(&this->info, this->obj.id);
this->info.cullDistance = 200.0f; this->info.cullDistance = 200.0f;
if (this->animFrame == 0) { if (this->animFrame == ACTOR_CS_TEAM_ARWING) {
this->iwork[11] = 1; this->iwork[11] = 1;
AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, this->sfxSource, 4); AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, this->sfxSource, 4);
return; return;

View File

@ -114,7 +114,7 @@ void SectorX_SxSlippy_Update(SxSlippy* this) {
gPlayer[0].state = PLAYERSTATE_STANDBY; gPlayer[0].state = PLAYERSTATE_STANDBY;
this->timer_0BC = 200; this->timer_0BC = 200;
this->iwork[14] = 3; this->iwork[TEAM_FACE] = FACE_SLIPPY;
this->fwork[0] = 0.0f; this->fwork[0] = 0.0f;
this->fwork[1] = 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 }, { -600.0f, 2200.0f, -5000.0f },
{ -300.0f, 2270.0f, -5000.0f }, { -300.0f, 2270.0f, -5000.0f },
{ 300.0f, 2270.0f, -5000.0f }, { 300.0f, 2270.0f, -5000.0f },
{ 600.0f, 2200.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, 250.0f, 50.0f },
{ -150.0f, -50.0f, 50.0f }, { -150.0f, -50.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_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_80195760[4] = { -250.0f, -200.0f, -400.0f, -8000.0f };
f32 D_i2_80195770[3] = { 120.0f, 180.0f, -150.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) { void SectorX_SxSpyborg_Draw(SxSpyborg* this) {
f32 fwork; 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); Actor_Initialize(this);
this->obj.status = OBJ_ACTIVE; this->obj.status = OBJ_ACTIVE;
this->obj.id = OBJ_ACTOR_CUTSCENE; this->obj.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos.x = D_i2_801956B0[index].x; this->obj.pos.x = sSxCsCommanderPos[index].x;
this->obj.pos.y = D_i2_801956B0[index].y; this->obj.pos.y = sSxCsCommanderPos[index].y;
this->obj.pos.z = D_i2_801956B0[index].z; this->obj.pos.z = sSxCsCommanderPos[index].z;
this->vel.z = 30.0f; this->vel.z = 30.0f;
this->vel.y = -16.0f; this->vel.y = -16.0f;
this->animFrame = 20; this->animFrame = ACTOR_CS_COMMANDER;
this->obj.rot.x = 15.0f; this->obj.rot.x = 15.0f;
Object_SetInfo(&this->info, this->obj.id); Object_SetInfo(&this->info, this->obj.id);
AUDIO_PLAY_SFX(NA_SE_EN_ENGINE_01, this->sfxSource, 4); 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); Actor_Initialize(this);
this->obj.status = OBJ_ACTIVE; this->obj.status = OBJ_ACTIVE;
this->obj.id = OBJ_ACTOR_CUTSCENE; this->obj.id = OBJ_ACTOR_CUTSCENE;
this->obj.pos.x = gPlayer[0].cam.eye.x + D_i2_801956EC[index].x; this->obj.pos.x = gPlayer[0].cam.eye.x + sLevelStartTeamSetupPos[teamIdx].x;
this->obj.pos.y = gPlayer[0].cam.eye.y + D_i2_801956EC[index].y; this->obj.pos.y = gPlayer[0].cam.eye.y + sLevelStartTeamSetupPos[teamIdx].y;
this->obj.pos.z = gPlayer[0].cam.eye.z + D_i2_801956EC[index].z; this->obj.pos.z = gPlayer[0].cam.eye.z + sLevelStartTeamSetupPos[teamIdx].z;
this->state = 1; this->state = 1;
this->iwork[11] = 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.y = 180.0f;
this->obj.rot.x = 10.0f; this->obj.rot.x = 10.0f;
if (index == 2) { if (teamIdx == 2) {
this->obj.rot.z = -20.0f; this->obj.rot.z = -20.0f;
} }
@ -1492,7 +1492,7 @@ void SectorX_LevelStart(Player* player) {
case 0: case 0:
gCsFrameCount = 0; gCsFrameCount = 0;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
SectorX_80193800(&gActors[5 + i], i); SectorX_CsCommander_Setup(&gActors[5 + i], i);
} }
player->csState = 1; player->csState = 1;
player->cam.eye.x = gCsCamEyeX = 100.0f; player->cam.eye.x = gCsCamEyeX = 100.0f;
@ -1582,17 +1582,17 @@ void SectorX_LevelStart(Player* player) {
switch (gCsFrameCount) { switch (gCsFrameCount) {
case 195: case 195:
if (gTeamShields[TEAM_ID_FALCO] > 0) { if (gTeamShields[TEAM_ID_FALCO] > 0) {
SectorX_801938D8(&gActors[0], 0); SectorX_LevelStart_SetupTeam(&gActors[0], 0);
} }
break; break;
case 213: case 213:
if (gTeamShields[TEAM_ID_SLIPPY] > 0) { if (gTeamShields[TEAM_ID_SLIPPY] > 0) {
SectorX_801938D8(&gActors[1], 1); SectorX_LevelStart_SetupTeam(&gActors[1], 1);
} }
break; break;
case 229: case 229:
if (gTeamShields[TEAM_ID_PEPPY] > 0) { if (gTeamShields[TEAM_ID_PEPPY] > 0) {
SectorX_801938D8(&gActors[2], 2); SectorX_LevelStart_SetupTeam(&gActors[2], 2);
} }
break; break;
} }
@ -1664,7 +1664,7 @@ void SectorX_LevelStart(Player* player) {
player->trueZpos = player->pos.z + player->camDist; 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 srcA;
Vec3f destA; Vec3f destA;
Vec3f srcB; Vec3f srcB;
@ -1672,12 +1672,14 @@ void SectorX_801944D4(ActorCutscene* this, s32 index) {
Player* player = &gPlayer[0]; Player* player = &gPlayer[0];
Matrix_RotateY(gCalcMatrix, player->rot.y * M_DTOR, MTXF_NEW); Matrix_RotateY(gCalcMatrix, player->rot.y * M_DTOR, MTXF_NEW);
srcA.x = D_i2_80195710[index];
srcA.y = D_i2_80195720[index]; srcA.x = D_i2_80195710[teamIdx];
srcA.z = D_i2_80195730[index]; srcA.y = D_i2_80195720[teamIdx];
srcB.x = D_i2_80195740[index]; srcA.z = D_i2_80195730[teamIdx];
srcB.y = D_i2_80195750[index]; srcB.x = D_i2_80195740[teamIdx];
srcB.z = D_i2_80195760[index]; srcB.y = D_i2_80195750[teamIdx];
srcB.z = D_i2_80195760[teamIdx];
Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcA, &destA); Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcA, &destA);
Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcB, &destB); Matrix_MultVec3fNoTranslate(gCalcMatrix, &srcB, &destB);
@ -1698,16 +1700,16 @@ void SectorX_801944D4(ActorCutscene* this, s32 index) {
Object_SetInfo(&this->info, this->obj.id); Object_SetInfo(&this->info, this->obj.id);
if (index == 3) { if (teamIdx == 3) {
this->animFrame = ACTOR_CS_GREAT_FOX; this->animFrame = ACTOR_CS_GREAT_FOX;
this->state = 20; this->state = 20;
this->obj.rot.x = -player->rot.x - 10.0f; this->obj.rot.x = -player->rot.x - 10.0f;
this->obj.rot.y = (player->rot.y + 180.0f) - 10.0f; this->obj.rot.y = (player->rot.y + 180.0f) - 10.0f;
this->fwork[9] = 10.0f; this->fwork[9] = 10.0f;
} else { } else {
this->obj.rot.z = D_i2_80195770[index]; this->obj.rot.z = D_i2_80195770[teamIdx];
this->iwork[11] = 1; 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); AUDIO_PLAY_SFX(NA_SE_ARWING_ENGINE_FG, this->sfxSource, 4);
} }
} }
@ -1815,13 +1817,13 @@ void SectorX_LevelComplete(Player* player) {
case 100: case 100:
if (gTeamShields[TEAM_ID_FALCO] > 0) { if (gTeamShields[TEAM_ID_FALCO] > 0) {
SectorX_801944D4(&gActors[1], 0); SectorX_LevelComplete_SetupTeam(&gActors[1], 0);
} }
if (gTeamShields[TEAM_ID_SLIPPY] > 0) { if (gTeamShields[TEAM_ID_SLIPPY] > 0) {
SectorX_801944D4(&gActors[2], 1); SectorX_LevelComplete_SetupTeam(&gActors[2], 1);
} }
if (gTeamShields[TEAM_ID_PEPPY] > 0) { if (gTeamShields[TEAM_ID_PEPPY] > 0) {
SectorX_801944D4(&gActors[3], 2); SectorX_LevelComplete_SetupTeam(&gActors[3], 2);
} }
break; break;
@ -1838,8 +1840,8 @@ void SectorX_LevelComplete(Player* player) {
break; break;
case 920: case 920:
gActors[1].iwork[14] = gActors[2].iwork[14] = gActors[3].iwork[14] = 0; gActors[1].iwork[TEAM_FACE] = gActors[2].iwork[TEAM_FACE] = gActors[3].iwork[TEAM_FACE] = FACE_NONE;
SectorX_801944D4(&gActors[0], 3); SectorX_LevelComplete_SetupTeam(&gActors[0], 3);
AUDIO_PLAY_SFX(NA_SE_GREATFOX_ENGINE, gActors[0].sfxSource, 0); AUDIO_PLAY_SFX(NA_SE_GREATFOX_ENGINE, gActors[0].sfxSource, 0);
break; 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. // Peppy is omitted, probably because it's outside of the camera view.
if (teamIdx + 1 != 3) { if (teamIdx + 1 != 3) {
this->iwork[14] = teamIdx + 2; this->iwork[TEAM_FACE] = teamIdx + 2;
} }
Object_SetInfo(&this->info, this->obj.id); 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.y = D_i3_801C0504[i].y;
actor->obj.pos.z = D_i3_801C0504[i].z; actor->obj.pos.z = D_i3_801C0504[i].z;
actor->rot_0F4.y = D_i3_801C075C[i]; 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[0] = RAND_INT(20.0f);
actor->iwork[2] = i; actor->iwork[2] = i;
actor->timer_0BC = 231; actor->timer_0BC = 231;

View File

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

View File

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

View File

@ -57,104 +57,281 @@ AudioTable D_800C07B0 = {
(((numInst) &0xFF) << 8) | ((numDrums) &0xFF) \ (((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 = { AudioTable gSoundFontTableInit = {
{ 33, 0, 0 }, { 33, 0, 0 },
{ {
SOUNDFONT_ENTRY(0x00000, 0x2F00, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_SFX, SAMPLES_NONE, 127, 0), SOUNDFONT_ENTRY(0x0, 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(0x2f00, 0x820, MEDIUM_CART, CACHEPOLICY_1, SAMPLES_MAP, SAMPLES_NONE, 127, 0),
SOUNDFONT_ENTRY(0x03EE0, 0x0640, MEDIUM_CART, CACHEPOLICY_0, SAMPLES_VOICE, SAMPLES_NONE, 127, 0), SOUNDFONT_ENTRY(0x3720, 0x6e0, 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(0x3e00, 0x15e0, 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(0x53e0, 0xc20, 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(0x6000, 0xfe0, 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(0x6fe0, 0x1360, 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(0x8340, 0x1120, 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(0x9460, 0xea0, 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(0xa300, 0xce0, 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(0xafe0, 0x1ba0, 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(0xcb80, 0xac0, 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(0xd640, 0xac0, 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(0xe100, 0xee0, 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(0xefe0, 0xc00, 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(0xfbe0, 0x10a0, 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(0x10c80, 0xf80, 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(0x11c00, 0x10c0, 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(0x12cc0, 0x1380, 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(0x14040, 0x2b20, 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(0x16b60, 0x9a0, 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(0x17500, 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(0x18720, 0x180, 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(0x188a0, 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(0x19a60, 0x940, 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(0x1a3a0, 0x9e0, 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(0x1ad80, 0x920, 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(0x1b6a0, 0x9e0, 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(0x1c080, 0x9e0, 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(0x1ca60, 0xa10, 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(0x1d470, 0x9e0, 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(0x1de50, 0xa00, 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(0x1e850, 0x8d0, MEDIUM_CART, CACHEPOLICY_3, SAMPLES_INST, SAMPLES_NONE, 10, 64),
}, }
}; };
*/
#define AS_BYTES(x) (((x) >> 8) & 0xFF), ((x) &0xFF) #define AS_BYTES(x) (((x) >> 8) & 0xFF), ((x) &0xFF)
// u8 gSeqFontTableInit[283] u8 gSeqFontTableInit[288] = {
s32 D_800C0E00[] = { AS_BYTES(132),
0x00840086, 0x009B009D, 0x009F00A1, 0x00A300A5, 0x00A700A9, 0x00AB00AD, 0x00AF00B1, 0x00B300B5, 0x00B700B9, AS_BYTES(134),
0x00BB00BD, 0x00BF00C1, 0x00C300C5, 0x00C700C9, 0x00CB00CD, 0x00CF00D1, 0x00D300D5, 0x00D700D9, 0x00DB00DD, AS_BYTES(155),
0x00DF00E1, 0x00E300E5, 0x00E700E9, 0x00EB00ED, 0x00EF00F1, 0x00F300F5, 0x00F700F9, 0x00FB00FD, 0x00FF0101, AS_BYTES(157),
0x01030105, 0x01070109, 0x010B010D, 0x010F0111, 0x01130115, 0x01170119, 0x01001414, 0x13121110, 0x0F0E0D0C, AS_BYTES(159),
0x0B0A0908, 0x07060504, 0x03010201, 0x18011D01, 0x19011A01, 0x1C011901, 0x19011D01, 0x18011D01, 0x1C011901, AS_BYTES(161),
0x1E011801, 0x19011C01, 0x1C011F01, 0x1F011C01, 0x1C011F01, 0x1F011F01, 0x1C011F01, 0x1F011F01, 0x1F011F01, AS_BYTES(163),
0x1F012001, 0x15011501, 0x16011501, 0x15011501, 0x15011501, 0x17011901, 0x15011501, 0x1D011901, 0x1F011501, AS_BYTES(165),
0x15011501, 0x15011501, 0x15011501, 0x15011501, 0x1B011901, 0x15011901, 0x19011901, 0x15011F00, 0x00000000, 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