update audio_seqplayer.c with docs from the decomp.

This commit is contained in:
Sonic Dreamcaster
2024-11-10 23:22:01 -03:00
parent de6f28df81
commit 144db0e445
9 changed files with 619 additions and 449 deletions
+17 -17
View File
@@ -1033,9 +1033,9 @@ void func_80008780(f32*, s32, f32*);
Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen);
// audio_effects
void func_800135A8(SequencePlayer* seqplayer);
void Audio_SequencePlayerProcessSound(SequencePlayer* seqplayer);
void func_80013A18(Note* note);
void func_80013A84(Note* note);
void Audio_NoteVibratoInit(Note* note);
void func_80013B6C(AdsrState* adsr, EnvelopePoint* envelope, s16* arg2);
f32 func_80013B90(AdsrState* adsr);
@@ -1067,29 +1067,29 @@ void AudioLoad_DiscardSeqFonts(s32 seqId);
s32 AudioLoad_SlowLoadSample(s32 fontId, u8 instId, s8* status);
// audio_playback
TunedSample* func_80011D10(Instrument* instrument, s32 arg1);
TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 arg1);
Instrument* Audio_GetInstrument(s32, s32);
Drum* Audio_GetDrum(s32, s32);
void func_80011F4C(Note* note);
void func_80011FA8(void);
void func_8001266C(SequenceLayer* layer);
void func_800127B0(Note* note, SequenceLayer* layer);
void func_80012864(NotePool* pool);
void Audio_ProcessNotes(void);
void Audio_SeqLayerNoteDecay(SequenceLayer* layer);
void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer);
void Audio_InitNoteLists(NotePool* pool);
void func_800128B4(void);
void func_80012964(NotePool* pool);
void func_80012AC4(NotePool* pool, s32);
void Audio_NotePoolClear(NotePool* pool);
void Audio_NotePoolFill(NotePool* pool, s32);
void func_80012C40(Note* note);
Note* func_8001301C(SequenceLayer* layer);
Note* Audio_AllocNote(SequenceLayer* layer);
void func_800132E8(void);
// audio_seqplayer
void func_8001415C(SequenceChannel* channel);
void func_800144E4(SequencePlayer* seqPlayer);
void func_800145BC(AudioListItem* list, AudioListItem* item);
void* func_800145FC(AudioListItem* list);
void func_8001678C(s32 arg0);
void func_80016804(s32 arg0);
void func_800168BC(void);
void AudioSeq_SequenceChannelDisable(SequenceChannel* channel);
void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer);
void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item);
void* AudioSeq_AudioListPopBack(AudioListItem* list);
void AudioSeq_ProcessSequences(s32 arg0);
void AudioSeq_ResetSequencePlayer(s32 arg0);
void AudioSeq_InitSequencePlayers(void);
// audio_thread
void AudioThread_ScheduleProcessCmds(void);
+35 -35
View File
@@ -334,22 +334,22 @@ AudioLoad_GetSamplesForFont = 0x80011758;
func_80011890 = 0x80011890;
func_80011C58 = 0x80011C58;
func_80011D10 = 0x80011D10;
Audio_GetInstrumentTunedSample = 0x80011D10;
Audio_GetInstrument = 0x80011D4C;
Audio_GetDrum = 0x80011DFC;
func_80011EB8 = 0x80011EB8;
func_80011F4C = 0x80011F4C;
func_80011FA8 = 0x80011FA8;
Audio_ProcessNotes = 0x80011FA8;
func_80012438 = 0x80012438;
func_8001266C = 0x8001266C;
Audio_SeqLayerNoteDecay = 0x8001266C;
func_8001268C = 0x8001268C;
func_800126AC = 0x800126AC;
func_800127B0 = 0x800127B0;
Audio_InitSyntheticWave = 0x800127B0;
func_80012854 = 0x80012854;
func_80012864 = 0x80012864;
Audio_InitNoteLists = 0x80012864;
func_800128B4 = 0x800128B4;
func_80012964 = 0x80012964;
func_80012AC4 = 0x80012AC4;
Audio_NotePoolClear = 0x80012964;
Audio_NotePoolFill = 0x80012AC4;
func_80012C00 = 0x80012C00;
func_80012C40 = 0x80012C40;
func_80012C6C = 0x80012C6C;
@@ -359,45 +359,45 @@ func_80012E5C = 0x80012E5C;
func_80012E88 = 0x80012E88;
func_80012ED4 = 0x80012ED4;
func_80012F24 = 0x80012F24;
func_8001301C = 0x8001301C;
Audio_AllocNote = 0x8001301C;
func_800132E8 = 0x800132E8;
func_80013400 = 0x80013400;
func_800135A8 = 0x800135A8;
Audio_SequencePlayerProcessSound = 0x800135A8;
func_80013708 = 0x80013708;
func_800137DC = 0x800137DC;
func_80013820 = 0x80013820;
func_80013A18 = 0x80013A18;
func_80013A84 = 0x80013A84;
Audio_NoteVibratoInit = 0x80013A84;
func_80013B6C = 0x80013B6C;
func_80013B90 = 0x80013B90;
func_80013EA0 = 0x80013EA0;
func_80013FC4 = 0x80013FC4;
func_800140D0 = 0x800140D0;
func_8001410C = 0x8001410C;
func_8001415C = 0x8001415C;
func_800141C8 = 0x800141C8;
func_80014244 = 0x80014244;
func_80014370 = 0x80014370;
func_80014440 = 0x80014440;
func_800144E4 = 0x800144E4;
func_800145BC = 0x800145BC;
func_800145FC = 0x800145FC;
func_8001463C = 0x8001463C;
func_800146C0 = 0x800146C0;
func_800146D4 = 0x800146D4;
func_80014704 = 0x80014704;
func_80014748 = 0x80014748;
func_800152C0 = 0x800152C0;
func_80015330 = 0x80015330;
func_800153C4 = 0x800153C4;
func_800153E8 = 0x800153E8;
func_80015FD4 = 0x80015FD4;
func_8001678C = 0x8001678C;
func_80016804 = 0x80016804;
func_800168BC = 0x800168BC;
AudioSeq_InitSequenceChannel = 0x80013EA0;
AudioSeq_SeqChannelSetLayer = 0x80013FC4;
AudioSeq_SeqLayerDisable = 0x800140D0;
AudioSeq_SeqLayerFree = 0x8001410C;
AudioSeq_SequenceChannelDisable = 0x8001415C;
AudioSeq_RequestFreeSeqChannel = 0x800141C8;
AudioSeq_SequencePlayerSetupChannels = 0x80014244;
AudioSeq_SequencePlayerDisableChannels = 0x80014370;
AudioSeq_SequenceChannelEnable = 0x80014440;
AudioSeq_SequencePlayerDisable = 0x800144E4;
AudioSeq_AudioListPushBack = 0x800145BC;
AudioSeq_AudioListPopBack = 0x800145FC;
AudioSeq_InitLayerFreelist = 0x8001463C;
AudioSeq_ScriptReadU8 = 0x800146C0;
AudioSeq_ScriptReadS16 = 0x800146D4;
AudioSeq_ScriptReadCompressedU16 = 0x80014704;
AudioSeq_SeqLayerProcessScript = 0x80014748;
AudioSeq_GetInstrument = 0x800152C0;
AudioSeq_SetInstrument = 0x80015330;
AudioSeq_SequenceChannelSetVolume = 0x800153C4;
AudioSeq_SequenceChannelProcessScript = 0x800153E8;
AudioSeq_SequencePlayerProcessSequence = 0x80015FD4;
AudioSeq_ProcessSequences = 0x8001678C;
AudioSeq_ResetSequencePlayer = 0x80016804;
AudioSeq_InitSequencePlayers = 0x800168BC;
+3 -3
View File
@@ -43,7 +43,7 @@ void func_80013400(SequenceChannel* channel, s32 updateVolume) {
channel->changes.asByte = 0;
}
void func_800135A8(SequencePlayer* seqplayer) {
void Audio_SequencePlayerProcessSound(SequencePlayer* seqplayer) {
s32 i;
if (seqplayer->fadeTimer != 0) {
@@ -57,7 +57,7 @@ void func_800135A8(SequencePlayer* seqplayer) {
}
seqplayer->fadeTimer--;
if ((seqplayer->fadeTimer == 0) && (seqplayer->state == 2)) {
func_800144E4(seqplayer);
AudioSeq_SequencePlayerDisable(seqplayer);
return;
}
}
@@ -146,7 +146,7 @@ void func_80013A18(Note* note) {
}
}
void func_80013A84(Note* note) {
void Audio_NoteVibratoInit(Note* note) {
NotePlaybackState* noteState = &note->playbackState;
VibratoState* vibrato = &noteState->vibratoState;
+3 -3
View File
@@ -101,7 +101,7 @@ void AudioHeap_DiscardFont(s32 fontId) {
}
func_80011F4C(note);
func_80012C40(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++) {
if (gSeqPlayers[i].enabled && gSeqPlayers[i].seqId == seqId) {
func_800144E4(&gSeqPlayers[i]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[i]);
}
}
}
@@ -571,7 +571,7 @@ s32 AudioHeap_ResetStep(void) {
switch (gAudioResetStep) {
case 5:
for (i = 0; i < ARRAY_COUNT(gSeqPlayers); i++) {
func_800144E4(&gSeqPlayers[i]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[i]);
}
gResetFadeoutFramesLeft = 4 / sp24;
gAudioResetStep--;
+3 -3
View File
@@ -389,7 +389,7 @@ void AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
seqId = AudioLoad_GetLoadTableIndex(SEQUENCE_TABLE, seqId);
func_800144E4(&gSeqPlayers[playerIdx]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[playerIdx]);
index = *((u16*) gSeqFontTable + seqId);
numFonts = gSeqFontTable[index++];
@@ -402,7 +402,7 @@ void AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
seqData = AudioLoad_SyncLoadSeq(seqId);
func_80016804(playerIdx);
AudioSeq_ResetSequencePlayer(playerIdx);
gSeqPlayers[playerIdx].seqId = seqId;
gSeqPlayers[playerIdx].defaultFont = fontId;
@@ -895,7 +895,7 @@ void AudioLoad_Init(void) {
}
AudioHeap_InitPool(&gPermanentPool.pool, ramAddr, gPermanentPoolSize);
func_800168BC();
AudioSeq_InitSequencePlayers();
}
static const char devstr38[] = "Entry--- %d %d\n";
+25 -25
View File
@@ -153,7 +153,7 @@ void func_80011C58(Note* note, f32 arg1) {
note->noteSubEu.resampleRate = (s32) (var_fv0 * 32768.0f);
}
TunedSample* func_80011D10(Instrument* instrument, s32 arg1) {
TunedSample* Audio_GetInstrumentTunedSample(Instrument* instrument, s32 arg1) {
TunedSample* sample;
if (arg1 < instrument->normalRangeLo) {
@@ -242,7 +242,7 @@ void func_80011F4C(Note* note) {
note->playbackState.adsr.current = 0.0f;
}
void func_80011FA8(void) {
void Audio_ProcessNotes(void) {
s32 pad2;
s32 pad;
Note* note;
@@ -269,7 +269,7 @@ void func_80011FA8(void) {
if ((playbackState->parentLayer->enabled) || (playbackState->unk_04 != 0) ||
(playbackState->priority <= 0)) {
if (playbackState->parentLayer->channel->seqPlayer == NULL) {
func_8001415C(playbackState->parentLayer->channel);
AudioSeq_SequenceChannelDisable(playbackState->parentLayer->channel);
playbackState->priority = 1;
playbackState->unk_04 = 1;
continue;
@@ -298,28 +298,28 @@ void func_80011FA8(void) {
func_80011F4C(note);
if (playbackState->wantedParentLayer->channel != NULL) {
func_80012CEC(note, playbackState->wantedParentLayer);
func_80013A84(note);
Audio_NoteVibratoInit(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->active, &note->listItem);
AudioSeq_AudioListPushBack(&note->listItem.pool->active, &note->listItem);
playbackState->wantedParentLayer = NO_LAYER;
} else {
func_80011F4C(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->disabled, &note->listItem);
AudioSeq_AudioListPushBack(&note->listItem.pool->disabled, &note->listItem);
playbackState->wantedParentLayer = NO_LAYER;
goto next;
}
} else {
func_80011F4C(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->disabled, &note->listItem);
AudioSeq_AudioListPushBack(&note->listItem.pool->disabled, &note->listItem);
goto next;
}
}
} else if (playbackState->adsr.state == 0) {
func_80011F4C(note);
func_80012C40(note);
func_800145BC(&note->listItem.pool->disabled, &note->listItem);
AudioSeq_AudioListPushBack(&note->listItem.pool->disabled, &note->listItem);
goto next;
}
@@ -425,7 +425,7 @@ void func_80012438(SequenceLayer* layer, s32 arg1) {
}
}
void func_8001266C(SequenceLayer* layer) {
void Audio_SeqLayerNoteDecay(SequenceLayer* layer) {
func_80012438(layer, 6);
}
@@ -464,7 +464,7 @@ s32 func_800126AC(Note* note, SequenceLayer* layer, s32 waveId) {
return harmonicIndex;
}
void func_800127B0(Note* note, SequenceLayer* layer) {
void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer) {
s32 harmonicIndex;
s32 waveId;
@@ -484,7 +484,7 @@ void func_80012854(AudioListItem* item) {
item->u.value = NULL;
}
void func_80012864(NotePool* pool) {
void Audio_InitNoteLists(NotePool* pool) {
func_80012854(&pool->disabled);
func_80012854(&pool->decaying);
func_80012854(&pool->releasing);
@@ -498,15 +498,15 @@ void func_80012864(NotePool* pool) {
void func_800128B4(void) {
s32 i;
func_80012864(&gNoteFreeLists);
Audio_InitNoteLists(&gNoteFreeLists);
for (i = 0; i < gNumNotes; i++) {
gNotes[i].listItem.u.value = &gNotes[i];
gNotes[i].listItem.prev = NULL;
func_800145BC(&gNoteFreeLists.disabled, &gNotes[i].listItem);
AudioSeq_AudioListPushBack(&gNoteFreeLists.disabled, &gNotes[i].listItem);
}
}
void func_80012964(NotePool* pool) {
void Audio_NotePoolClear(NotePool* pool) {
s32 poolType;
AudioListItem* poolItem;
AudioListItem* nextPoolItem;
@@ -538,19 +538,19 @@ void func_80012964(NotePool* pool) {
break;
}
func_80012C40((Note*) nextPoolItem);
func_800145BC(freeList, nextPoolItem);
AudioSeq_AudioListPushBack(freeList, nextPoolItem);
}
}
}
void func_80012AC4(NotePool* pool, s32 arg1) {
void Audio_NotePoolFill(NotePool* pool, s32 arg1) {
s32 var_s0;
s32 poolType;
AudioListItem* note;
AudioListItem* freeList;
AudioListItem* poolList;
func_80012964(pool);
Audio_NotePoolClear(pool);
poolType = 0;
var_s0 = 0;
while (var_s0 < arg1) {
@@ -576,11 +576,11 @@ void func_80012AC4(NotePool* pool, s32 arg1) {
break;
}
while (var_s0 < arg1) {
note = func_800145FC(freeList);
note = AudioSeq_AudioListPopBack(freeList);
if (note == NULL) {
break;
}
func_800145BC(poolList, note);
AudioSeq_AudioListPushBack(poolList, note);
var_s0++;
}
poolType++;
@@ -678,7 +678,7 @@ void func_80012E5C(Note* note, SequenceLayer* layer) {
}
Note* func_80012E88(NotePool* pool, SequenceLayer* layer) {
Note* note = func_800145FC(&pool->disabled);
Note* note = AudioSeq_AudioListPopBack(&pool->disabled);
if (note != NULL) {
func_80012CEC(note, layer);
@@ -688,11 +688,11 @@ Note* func_80012E88(NotePool* pool, SequenceLayer* layer) {
}
Note* func_80012ED4(NotePool* pool, SequenceLayer* layer) {
Note* note = func_800145FC(&pool->decaying);
Note* note = AudioSeq_AudioListPopBack(&pool->decaying);
if (note != NULL) {
func_80012E5C(note, layer);
func_800145BC(&pool->releasing, &note->listItem);
AudioSeq_AudioListPushBack(&pool->releasing, &note->listItem);
}
return note;
}
@@ -718,7 +718,7 @@ Note* func_80012F24(NotePool* pool, SequenceLayer* layer) {
if (sp28 < sp2C) {
func_80012C40(sp30);
func_80012E28(sp30, layer);
func_800145BC(&pool->releasing, &sp30->listItem);
AudioSeq_AudioListPushBack(&pool->releasing, &sp30->listItem);
sp30->playbackState.priority = layer->channel->notePriority;
return sp30;
} else {
@@ -728,7 +728,7 @@ Note* func_80012F24(NotePool* pool, SequenceLayer* layer) {
}
}
Note* func_8001301C(SequenceLayer* layer) {
Note* Audio_AllocNote(SequenceLayer* layer) {
Note* sp24;
if (layer->channel->noteAllocPolicy & 1) {
@@ -738,7 +738,7 @@ Note* func_8001301C(SequenceLayer* layer) {
func_80012E5C(sp24, layer);
func_80012C40(sp24);
func_800145BC(&sp24->listItem.pool->releasing, &sp24->listItem);
AudioSeq_AudioListPushBack(&sp24->listItem.pool->releasing, &sp24->listItem);
return sp24;
}
}
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -639,7 +639,7 @@ Acmd* func_80009B64(Acmd* aList, s32* cmdCount, s16* aiBufStart, s32 aiBufLen) {
aCmdPtr = aList;
for (i = gAudioBufferParams.ticksPerUpdate; i > 0; i--) {
func_8001678C(i - 1);
AudioSeq_ProcessSequences(i - 1);
func_80009AAC(gAudioBufferParams.ticksPerUpdate - i);
}
+1 -1
View File
@@ -222,7 +222,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
case AUDIOCMD_OP_GLOBAL_DISABLE_SEQPLAYER:
if (gSeqPlayers[cmd->arg0].enabled) {
if (cmd->asInt == 0) {
func_800144E4(&gSeqPlayers[cmd->arg0]);
AudioSeq_SequencePlayerDisable(&gSeqPlayers[cmd->arg0]);
} else {
AudioThread_SetFadeOutTimer(cmd->arg0, cmd->asInt);
}