mirror of
https://github.com/zeldaret/oot.git
synced 2025-05-11 11:33:48 +00:00
Document parts of audio (#1000)
* Minor labelling * progress * play percentage -> delay * duration -> gatetime * more * more * more * seqIdx -> playerIdx * more * more * more * more * format * fix comment * filters * more * media * confusion * Sync load is actually slow load * AudioHeap prefix * more * more * reformat * more * more * AudioLoad * more * more * seq banks * more consistent * more * name last function in audio_load * More audio_synthesis * clean up audio tables * minor * slow/fast load ramAddr * format * remove unused * Remove union * remove padding * audio bank -> sound font * seqLayer -> layer * stuff * seqChannel -> channel * ChannelLayer -> Layer * remove define, add bug comment * format * more * cache enum * more * AudioSeq function prefix * naming * bankIdx -> bankId * more * format * review * more * fixes * avoid hardcoded sfxid's * SE -> Sfx Co-authored-by: zelda2774 <zelda2774@invalid>
This commit is contained in:
parent
823a3c0754
commit
5ad7cf9dbb
50 changed files with 3493 additions and 3508 deletions
|
@ -59,7 +59,7 @@ glabel gNoteFrequencies
|
|||
glabel gDefaultShortNoteVelocityTable
|
||||
.incbin "baserom.z64", 0xBA6C54, 0x10
|
||||
|
||||
glabel gDefaultShortNoteDurationTable
|
||||
glabel gDefaultShortNoteGateTimeTable
|
||||
.incbin "baserom.z64", 0xBA6C64, 0x10
|
||||
|
||||
glabel gDefaultEnvelope
|
||||
|
@ -95,10 +95,10 @@ glabel gDefaultPanVolume
|
|||
glabel D_80130224
|
||||
.incbin "baserom.z64", 0xBA73C4, 0x4
|
||||
|
||||
glabel D_80130228
|
||||
glabel sLowPassFilterData
|
||||
.incbin "baserom.z64", 0xBA73C8, 0x100
|
||||
|
||||
glabel D_80130328
|
||||
glabel sHighPassFilterData
|
||||
.incbin "baserom.z64", 0xBA74C8, 0x148
|
||||
|
||||
glabel D_80130470
|
||||
|
|
|
@ -33,34 +33,34 @@ glabel D_8016C8B0
|
|||
glabel sSoundRequests
|
||||
.space 0x1800
|
||||
|
||||
glabel D_8016E1A0
|
||||
glabel sSoundBankListEnd
|
||||
.space 0x8
|
||||
|
||||
glabel D_8016E1A8
|
||||
glabel sSoundBankFreeListStart
|
||||
.space 0x8
|
||||
|
||||
glabel D_8016E1B0
|
||||
glabel sSoundBankUnused
|
||||
.space 0x8
|
||||
|
||||
glabel D_8016E1B8
|
||||
glabel gActiveSounds
|
||||
.space 0xA8
|
||||
|
||||
glabel D_8016E260
|
||||
glabel sCurSfxPlayerChannelIdx
|
||||
.space 0x4
|
||||
|
||||
glabel gSoundBankMuted
|
||||
.space 0xC
|
||||
|
||||
glabel D_8016E270
|
||||
glabel sUnusedBankLerp
|
||||
.space 0x70
|
||||
|
||||
glabel gAudioSEFlagSwapSource
|
||||
glabel gAudioSfxSwapSource
|
||||
.space 0x18
|
||||
|
||||
glabel gAudioSEFlagSwapTarget
|
||||
glabel gAudioSfxSwapTarget
|
||||
.space 0x18
|
||||
|
||||
glabel gAudioSEFlagSwapMode
|
||||
glabel gAudioSfxSwapMode
|
||||
.space 0x10
|
||||
|
||||
glabel D_8016E320
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
|
||||
.balign 16
|
||||
|
||||
glabel gAudioBankTable
|
||||
glabel gSoundFontTable
|
||||
.incbin "baserom.z64", 0xBCC270, 0x270
|
||||
|
||||
glabel D_80155340
|
||||
glabel gSequenceFontTable
|
||||
.incbin "baserom.z64", 0xBCC4E0, 0x1C0
|
||||
|
||||
glabel gSequenceTable
|
||||
.incbin "baserom.z64", 0xBCC6A0, 0x6F0
|
||||
|
||||
glabel gAudioTable
|
||||
glabel gSampleBankTable
|
||||
.incbin "baserom.z64", 0xBCCD90, 0x80
|
||||
|
||||
glabel rspAspMainDataStart
|
||||
|
|
|
@ -17,9 +17,8 @@ void Idle_ThreadEntry(void* arg);
|
|||
void ViConfig_UpdateVi(u32 mode);
|
||||
void ViConfig_UpdateBlack(void);
|
||||
s32 DmaMgr_CompareName(const char* name1, const char* name2);
|
||||
s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size);
|
||||
s32 DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
|
||||
void DmaMgr_DmaCallback1(u32 ram, u32 rom, u32 size);
|
||||
s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size);
|
||||
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
|
||||
void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc);
|
||||
const char* DmaMgr_GetFileNameImpl(u32 vrom);
|
||||
const char* DmaMgr_GetFileName(u32 vrom);
|
||||
|
@ -1891,76 +1890,57 @@ void UCodeDisas_Destroy(UCodeDisas*);
|
|||
void UCodeDisas_RegisterUCode(UCodeDisas*, s32, UCodeInfo*);
|
||||
void UCodeDisas_SetCurUCode(UCodeDisas*, void*);
|
||||
Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen);
|
||||
void Audio_DiscardBank(s32 bankId);
|
||||
void Audio_DiscardSequence(s32 seqId);
|
||||
void func_800DE238(void* mem, u32 size);
|
||||
void* func_800DE258(SoundAllocPool* pool, u32 size);
|
||||
void* func_800DE2B0(SoundAllocPool* pool, u32 size);
|
||||
void* Audio_AllocDmaMemory(SoundAllocPool* pool, u32 size);
|
||||
void* Audio_AllocDmaMemoryZeroed(SoundAllocPool* pool, u32 size);
|
||||
void* Audio_AllocZeroed(SoundAllocPool* pool, u32 size);
|
||||
void* Audio_Alloc(SoundAllocPool* pool, u32 size);
|
||||
void Audio_SoundAllocPoolInit(SoundAllocPool* pool, void* memAddr, u32 size);
|
||||
void Audio_PersistentPoolClear(PersistentPool* persistent);
|
||||
void Audio_TemporaryPoolClear(TemporaryPool* temporary);
|
||||
void func_800DE4B0(s32 poolIdx);
|
||||
void Audio_InitMainPools(s32 sizeForAudioInitPool);
|
||||
void Audio_SessionPoolsInit(AudioPoolSplit4* split);
|
||||
void Audio_SeqAndBankPoolInit(AudioPoolSplit2* split);
|
||||
void Audio_PersistentPoolsInit(AudioPoolSplit3* split);
|
||||
void Audio_TemporaryPoolsInit(AudioPoolSplit3* split);
|
||||
void* Audio_AllocBankOrSeq(s32 poolIdx, s32 size, s32 arg2, s32 id);
|
||||
void* func_800DF074(s32 poolIdx, s32 arg1, s32 id);
|
||||
void* func_800DF0CC(s32 poolIdx, s32 arg1, s32 id);
|
||||
void func_800DF5DC(s16* arg0, s32 arg1);
|
||||
void func_800DF630(s16* arg0, s32 arg1);
|
||||
void func_800DF688(s16* arg0, s32 arg1, s32 arg2);
|
||||
void func_800DF7C4(void);
|
||||
void func_800DF888(void);
|
||||
s32 Audio_ResetStep(void);
|
||||
void Audio_InitHeap(void);
|
||||
void* func_800E04E8(s32 poolIdx, s32 id);
|
||||
void* func_800E0540(s32 poolIdx, s32 id, u32 size);
|
||||
void* func_800E05C4(u32 size, s32 arg1, void* arg2, s8 arg3, s32 arg4);
|
||||
void func_800E0634(u32 arg0, u32 arg1);
|
||||
UnkHeapEntry* func_800E06CC(u32 size);
|
||||
void func_800E0964(UnkHeapEntry* entry, s32 bankId);
|
||||
void func_800E0AD8(UnkHeapEntry* entry);
|
||||
void func_800E0BB4(UnkHeapEntry* entry, AudioBankSample* sample);
|
||||
UnkHeapEntry* func_800E0BF8(u32 size);
|
||||
// ? func_800E0C80(?);
|
||||
void func_800E0CBC(void);
|
||||
void func_800E0E6C(s32 id);
|
||||
void func_800E0E90(s32 id);
|
||||
void func_800E0EB4(s32 arg0, s32 id);
|
||||
void func_800E1148(void);
|
||||
void func_800E11F0(void);
|
||||
void* Audio_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef, s32 medium);
|
||||
void func_800E1618(s32 arg0);
|
||||
s32 Audio_IsBankLoadComplete(s32 bankId);
|
||||
s32 Audio_IsSeqLoadComplete(s32 seqId);
|
||||
void Audio_SetBankLoadStatus(s32 bankId, s32 status);
|
||||
void Audio_SetSeqLoadStatus(s32 seqId, s32 status);
|
||||
void func_800E1C18(s32 channelIdx, s32 arg1);
|
||||
s32 func_800E1D64(s32 arg0, s32 arg1, s32 arg2);
|
||||
void Audio_AudioSeqAsyncLoad(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue* arg3);
|
||||
void Audio_AudioTableAsyncLoad(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue* arg3);
|
||||
void Audio_AudioBankAsyncLoad(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue* arg3);
|
||||
u8* func_800E1F38(s32 arg0, u32* arg1);
|
||||
void func_800E1F7C(s32 arg0);
|
||||
s32 func_800E20D4(s32 playerIndex, s32 seqId, s32 arg2);
|
||||
s32 func_800E2124(s32 playerIndex, s32 seqId, s32 arg2);
|
||||
void Audio_ProcessLoads(s32 resetStatus);
|
||||
void func_800E301C(void* callback);
|
||||
void Audio_ContextInit(void* heap, u32 heapSize);
|
||||
void Audio_SyncLoadsInit(void);
|
||||
s32 Audio_SyncLoadSample(s32 arg0, s32 arg1, s8* arg2);
|
||||
s32 Audio_SyncLoadSeq(s32 seqIdx, u8* ramAddr, s8* arg2);
|
||||
void Audio_AsyncLoadReqInit(void);
|
||||
void func_800E4D94(void);
|
||||
void func_800E4EEC(s32 tableType, s32 arg1, s8* arg2);
|
||||
void func_800E4F58(void);
|
||||
void func_800E4FB0(void);
|
||||
void AudioHeap_DiscardFont(s32 fontId);
|
||||
void AudioHeap_DiscardSequence(s32 seqId);
|
||||
void AudioHeap_WritebackDCache(void* mem, u32 size);
|
||||
void* AudioHeap_AllocZeroedAttemptExternal(AudioAllocPool* pool, u32 size);
|
||||
void* AudioHeap_AllocAttemptExternal(AudioAllocPool* pool, u32 size);
|
||||
void* AudioHeap_AllocDmaMemory(AudioAllocPool* pool, u32 size);
|
||||
void* AudioHeap_AllocDmaMemoryZeroed(AudioAllocPool* pool, u32 size);
|
||||
void* AudioHeap_AllocZeroed(AudioAllocPool* pool, u32 size);
|
||||
void* AudioHeap_Alloc(AudioAllocPool* pool, u32 size);
|
||||
void AudioHeap_AllocPoolInit(AudioAllocPool* pool, void* mem, u32 size);
|
||||
void AudioHeap_PersistentCacheClear(AudioPersistentCache* persistent);
|
||||
void AudioHeap_TemporaryCacheClear(AudioTemporaryCache* temporary);
|
||||
void AudioHeap_PopCache(s32 tableType);
|
||||
void AudioHeap_InitMainPools(s32 sizeForAudioInitPool);
|
||||
void* AudioHeap_AllocCached(s32 tableType, s32 size, s32 cache, s32 id);
|
||||
void* AudioHeap_SearchCaches(s32 tableType, s32 arg1, s32 id);
|
||||
void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id);
|
||||
void AudioHeap_LoadFilter(s16* filter, s32 filter1, s32 filter2);
|
||||
s32 AudioHeap_ResetStep(void);
|
||||
void AudioHeap_Init(void);
|
||||
void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id);
|
||||
void* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size);
|
||||
void* AudioHeap_AllocSampleCache(u32 size, s32 fontId, void* sampleAddr, s8 medium, s32 cache);
|
||||
void AudioHeap_ApplySampleBankCache(s32 sampleBankId);
|
||||
void AudioLoad_DecreaseSampleDmaTtls(void);
|
||||
void* AudioLoad_DmaSampleData(u32 devAddr, u32 size, s32 arg2, u8* dmaIndexRef, s32 medium);
|
||||
void AudioLoad_InitSampleDmaBuffers(s32 arg0);
|
||||
s32 AudioLoad_IsFontLoadComplete(s32 fontId);
|
||||
s32 AudioLoad_IsSeqLoadComplete(s32 seqId);
|
||||
void AudioLoad_SetFontLoadStatus(s32 fontId, s32 status);
|
||||
void AudioLoad_SetSeqLoadStatus(s32 seqId, s32 status);
|
||||
void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1);
|
||||
s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId);
|
||||
void AudioLoad_AsyncLoadSeq(s32 seqId, s32 arg1, s32 retData, OSMesgQueue* retQueue);
|
||||
void AudioLoad_AsyncLoadSampleBank(s32 sampleBankId, s32 arg1, s32 retData, OSMesgQueue* retQueue);
|
||||
void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* retQueue);
|
||||
u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* arg1);
|
||||
void AudioLoad_DiscardSeqFonts(s32 seqId);
|
||||
s32 AudioLoad_SyncInitSeqPlayer(s32 playerIdx, s32 seqId, s32 arg2);
|
||||
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 arg2);
|
||||
void AudioLoad_ProcessLoads(s32 resetStatus);
|
||||
void AudioLoad_SetDmaHandler(DmaHandler callback);
|
||||
void AudioLoad_Init(void* heap, u32 heapSize);
|
||||
void AudioLoad_InitSlowLoads(void);
|
||||
s32 AudioLoad_SlowLoadSample(s32 arg0, s32 arg1, s8* arg2);
|
||||
s32 AudioLoad_SlowLoadSeq(s32 playerIdx, u8* ramAddr, s8* arg2);
|
||||
void AudioLoad_InitAsyncLoads(void);
|
||||
void AudioLoad_LoadPermanentSamples(void);
|
||||
void AudioLoad_ScriptLoad(s32 tableType, s32 arg1, s8* arg2);
|
||||
void AudioLoad_ProcessScriptLoads(void);
|
||||
void AudioLoad_InitScriptLoads(void);
|
||||
AudioTask* func_800E4FE0(void);
|
||||
void Audio_QueueCmdF32(u32 arg0, f32 arg1);
|
||||
void Audio_QueueCmdS32(u32 arg0, s32 arg1);
|
||||
|
@ -1983,16 +1963,16 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput);
|
|||
void Audio_NoteInit(Note* note);
|
||||
void Audio_NoteDisable(Note* note);
|
||||
void Audio_ProcessNotes(void);
|
||||
AudioBankSound* Audio_InstrumentGetAudioBankSound(Instrument* instrument, s32 semitone);
|
||||
Instrument* Audio_GetInstrumentInner(s32 bankId, s32 instId);
|
||||
Drum* Audio_GetDrum(s32 bankId, s32 drumId);
|
||||
AudioBankSound* Audio_GetSfx(s32 bankId, s32 sfxId);
|
||||
s32 func_800E7744(s32 instrument, s32 bankId, s32 instId, void* arg3);
|
||||
void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target);
|
||||
void Audio_SeqChanLayerNoteDecay(SequenceChannelLayer* seqLayer);
|
||||
void Audio_SeqChanLayerNoteRelease(SequenceChannelLayer* seqLayer);
|
||||
s32 Audio_BuildSyntheticWave(Note* note, SequenceChannelLayer* seqLayer, s32 waveId);
|
||||
void Audio_InitSyntheticWave(Note* note, SequenceChannelLayer* seqLayer);
|
||||
SoundFontSound* Audio_InstrumentGetSound(Instrument* instrument, s32 semitone);
|
||||
Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId);
|
||||
Drum* Audio_GetDrum(s32 fontId, s32 drumId);
|
||||
SoundFontSound* Audio_GetSfx(s32 fontId, s32 sfxId);
|
||||
s32 Audio_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* value);
|
||||
void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target);
|
||||
void Audio_SeqLayerNoteDecay(SequenceLayer* layer);
|
||||
void Audio_SeqLayerNoteRelease(SequenceLayer* layer);
|
||||
s32 Audio_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveId);
|
||||
void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer);
|
||||
void Audio_InitNoteList(AudioListItem* list);
|
||||
void Audio_InitNoteLists(NotePool* pool);
|
||||
void Audio_InitNoteFreeList(void);
|
||||
|
@ -2000,16 +1980,16 @@ void Audio_NotePoolClear(NotePool* pool);
|
|||
void Audio_NotePoolFill(NotePool* pool, s32 count);
|
||||
void Audio_AudioListPushFront(AudioListItem* list, AudioListItem* item);
|
||||
void Audio_AudioListRemove(AudioListItem* item);
|
||||
Note* Audio_PopNodeWithValueLessEqual(AudioListItem* list, s32 limit);
|
||||
void Audio_NoteInitForLayer(Note* note, SequenceChannelLayer* seqLayer);
|
||||
void func_800E82C0(Note* note, SequenceChannelLayer* seqLayer);
|
||||
void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceChannelLayer* seqLayer);
|
||||
Note* Audio_AllocNoteFromDisabled(NotePool* pool, SequenceChannelLayer* seqLayer);
|
||||
Note* Audio_AllocNoteFromDecaying(NotePool* pool, SequenceChannelLayer* seqLayer);
|
||||
Note* Audio_AllocNoteFromActive(NotePool* pool, SequenceChannelLayer* seqLayer);
|
||||
Note* Audio_AllocNote(SequenceChannelLayer* seqLayer);
|
||||
Note* Audio_FindNodeWithPrioLessThan(AudioListItem* list, s32 limit);
|
||||
void Audio_NoteInitForLayer(Note* note, SequenceLayer* layer);
|
||||
void func_800E82C0(Note* note, SequenceLayer* layer);
|
||||
void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer);
|
||||
Note* Audio_AllocNoteFromDisabled(NotePool* pool, SequenceLayer* layer);
|
||||
Note* Audio_AllocNoteFromDecaying(NotePool* pool, SequenceLayer* layer);
|
||||
Note* Audio_AllocNoteFromActive(NotePool* pool, SequenceLayer* layer);
|
||||
Note* Audio_AllocNote(SequenceLayer* layer);
|
||||
void Audio_NoteInitAll(void);
|
||||
void Audio_SequenceChannelProcessSound(SequenceChannel* seqChannel, s32 recalculateVolume, s32 b);
|
||||
void Audio_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculateVolume, s32 b);
|
||||
void Audio_SequencePlayerProcessSound(SequencePlayer* seqPlayer);
|
||||
f32 Audio_GetPortamentoFreqScale(Portamento* p);
|
||||
s16 Audio_GetVibratoPitchChange(VibratoState* vib);
|
||||
|
@ -2019,16 +1999,16 @@ void Audio_NoteVibratoInit(Note* note);
|
|||
void Audio_NotePortamentoInit(Note* note);
|
||||
void Audio_AdsrInit(AdsrState* adsr, AdsrEnvelope* envelope, s16* volOut);
|
||||
f32 Audio_AdsrUpdate(AdsrState* adsr);
|
||||
void Audio_SequenceChannelDisable(SequenceChannel* seqChannel);
|
||||
void Audio_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer);
|
||||
void Audio_SequencePlayerDisable(SequencePlayer* seqPlayer);
|
||||
void Audio_AudioListPushBack(AudioListItem* list, AudioListItem* item);
|
||||
void* Audio_AudioListPopBack(AudioListItem* list);
|
||||
void Audio_ProcessSequences(s32 arg0);
|
||||
void Audio_ProcessSequence(SequencePlayer* seqPlayer);
|
||||
void Audio_ResetSequencePlayer(SequencePlayer* seqPlayer);
|
||||
void func_800EC734(s32 seqPlayerIdx);
|
||||
void Audio_InitSequencePlayers(void);
|
||||
void AudioSeq_SequenceChannelDisable(SequenceChannel* channel);
|
||||
void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer);
|
||||
void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer);
|
||||
void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item);
|
||||
void* AudioSeq_AudioListPopBack(AudioListItem* list);
|
||||
void AudioSeq_ProcessSequences(s32 arg0);
|
||||
void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer);
|
||||
void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer);
|
||||
void AudioSeq_InitSequencePlayerChannels(s32 playerIdx);
|
||||
void AudioSeq_InitSequencePlayers(void);
|
||||
void func_800ECC04(u16);
|
||||
void func_800ED858(u8);
|
||||
void func_800ED93C(s8 songIdx, s8 arg1);
|
||||
|
@ -2042,7 +2022,7 @@ void func_800EE824(void);
|
|||
void AudioDebug_Draw(GfxPrint* printer);
|
||||
void AudioDebug_ScrPrt(const s8* str, u16 num);
|
||||
void func_800F3054(void);
|
||||
void Audio_SetSoundProperties(u8 bankIdx, u8 entryIdx, u8 channelIdx);
|
||||
void Audio_SetSoundProperties(u8 bankId, u8 entryIdx, u8 channelIdx);
|
||||
void func_800F3F3C(u8);
|
||||
void func_800F4010(Vec3f* pos, u16 sfxId, f32);
|
||||
void Audio_PlaySoundRandom(Vec3f* pos, u16 baseSfxId, u8 randLim);
|
||||
|
@ -2084,7 +2064,7 @@ void func_800F5B58(void);
|
|||
void func_800F5BF0(u8 arg0);
|
||||
void func_800F5C64(u16);
|
||||
void func_800F5C2C(void);
|
||||
void func_800F5E18(u8 seqIdx, u16 seqId, u8 fadeTimer, s8 arg3, s8 arg4);
|
||||
void func_800F5E18(u8 playerIdx, u16 seqId, u8 fadeTimer, s8 arg3, s8 arg4);
|
||||
void func_800F5E90(u8);
|
||||
void func_800F6114(f32 dist);
|
||||
void func_800F6268(f32 dist, u16);
|
||||
|
@ -2093,8 +2073,8 @@ void func_800F6584(u8 arg0);
|
|||
void Audio_SetEnvReverb(s8 reverb);
|
||||
void Audio_SetCodeReverb(s8 reverb);
|
||||
void func_800F6700(s8 outputMode);
|
||||
void func_800F67A0(u8);
|
||||
void func_800F6828(u8);
|
||||
void Audio_SetBaseFilter(u8);
|
||||
void Audio_SetExtraFilter(u8);
|
||||
void Audio_SetCutsceneFlag(s8 flag);
|
||||
void Audio_PlaySoundIfNotInCutscene(u16 sfxId);
|
||||
void func_800F6964(u16);
|
||||
|
@ -2106,33 +2086,30 @@ void Audio_PreNMI();
|
|||
void func_800F6D58(u8, u8, u8);
|
||||
// ? func_800F6E7C(?);
|
||||
void func_800F6FB4(u8);
|
||||
void func_800F70F8();
|
||||
void func_800F711C();
|
||||
void Audio_Init();
|
||||
void Audio_InitSound();
|
||||
void func_800F7170(void);
|
||||
void func_800F71BC(s32 arg0);
|
||||
void Audio_SetSoundBanksMute(u16 muteMask);
|
||||
void Audio_QueueSeqCmdMute(u8);
|
||||
void Audio_ClearBGMMute(u8);
|
||||
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 a2, f32* freqScale, f32* a4, s8* reverbAdd);
|
||||
void Audio_QueueSeqCmdMute(u8 channelIdx);
|
||||
void Audio_ClearBGMMute(u8 channelIdx);
|
||||
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* a4, s8* reverbAdd);
|
||||
void Audio_ProcessSoundRequest(void);
|
||||
void func_800F7B54(u8, u8);
|
||||
void func_800F7CEC(u8);
|
||||
void func_800F8480(u8);
|
||||
void func_800F87A0(u8);
|
||||
void Audio_ChooseActiveSounds(u8 bankId);
|
||||
void Audio_PlayActiveSounds(u8 bankId);
|
||||
void Audio_StopSfxByBank(u8 bankId);
|
||||
void func_800F8884(u8, Vec3f*);
|
||||
void func_800F89A0(u8, Vec3f*);
|
||||
void func_800F89E8(Vec3f*);
|
||||
void func_800F9280(u8 seqIdx, u8 seqId, u8 arg2, u16 fadeTimer);
|
||||
void Audio_StopSfxByPosAndBank(u8, Vec3f*);
|
||||
void Audio_StopSfxByPos(Vec3f*);
|
||||
void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer);
|
||||
void Audio_QueueSeqCmd(u32 bgmID);
|
||||
void func_800F8A44(Vec3f* pos, u16 sfxId);
|
||||
void func_800F8BA0(u8, u16);
|
||||
void Audio_StopSfx(u32 sfxId);
|
||||
void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId);
|
||||
void Audio_StopSfxByTokenAndId(u8, u16);
|
||||
void Audio_StopSfxById(u32 sfxId);
|
||||
void Audio_ProcessSoundRequests(void);
|
||||
void func_800F8EA0(u8, u8, u16);
|
||||
void func_800F8F34(u8);
|
||||
void func_800F8F88(void);
|
||||
u8 Audio_IsSfxPlaying(u32 sfxId);
|
||||
void func_800F905C(void);
|
||||
void Audio_ResetSounds(void);
|
||||
void func_800F9474(u8, u16);
|
||||
void func_800F94FC(u32);
|
||||
void Audio_ProcessSeqCmd(u32);
|
||||
|
@ -2141,7 +2118,7 @@ u16 func_800FA0B4(u8 a0);
|
|||
s32 func_800FA11C(u32 arg0, u32 arg1);
|
||||
void func_800FA174(u8);
|
||||
void func_800FA18C(u8, u8);
|
||||
void Audio_SetVolScale(u8 seqIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTimer);
|
||||
void Audio_SetVolScale(u8 playerIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTimer);
|
||||
void func_800FA3DC(void);
|
||||
u8 func_800FAD34(void);
|
||||
void func_800FADF8(void);
|
||||
|
|
|
@ -331,7 +331,7 @@ extern f32 gPitchBendFrequencyScale[256];
|
|||
extern f32 D_8012F4B4[256];
|
||||
extern f32 gNoteFrequencies[];
|
||||
extern u8 gDefaultShortNoteVelocityTable[16];
|
||||
extern u8 gDefaultShortNoteDurationTable[16];
|
||||
extern u8 gDefaultShortNoteGateTimeTable[16];
|
||||
extern AdsrEnvelope gDefaultEnvelope[3];
|
||||
extern NoteSubEu gZeroNoteSub;
|
||||
extern NoteSubEu gDefaultNoteSub;
|
||||
|
@ -339,14 +339,14 @@ extern u16 gHeadsetPanQuantization[0x10];
|
|||
extern f32 gHeadsetPanVolume[128];
|
||||
extern f32 gStereoPanVolume[128];
|
||||
extern f32 gDefaultPanVolume[128];
|
||||
extern s16 D_80130228[];
|
||||
extern s16 D_80130328[];
|
||||
extern s16 sLowPassFilterData[16*8];
|
||||
extern s16 sHighPassFilterData[15*8];
|
||||
extern s32 gAudioContextInitalized;
|
||||
extern f32 D_80130510;
|
||||
extern s32 D_80130514;
|
||||
extern u8 D_80130570[7];
|
||||
extern u8 D_80130578[4][7];
|
||||
extern u8 D_80130594[4][7];
|
||||
extern u8 gIsLargeSoundBank[7];
|
||||
extern u8 gChannelsPerBank[4][7];
|
||||
extern u8 gUsedChannelsPerBank[4][7];
|
||||
extern u8 gMorphaTransposeTable[16];
|
||||
extern u8* gFrogsSongPtr;
|
||||
extern OcarinaNote* gScarecrowCustomSongPtr;
|
||||
|
@ -357,13 +357,13 @@ extern char D_80133390[];
|
|||
extern char D_80133398[];
|
||||
extern SoundBankEntry* gSoundBanks[7];
|
||||
extern u8 sBankSizes[7];
|
||||
extern u8 D_801333CC;
|
||||
extern u8 gSfxChannelLayout;
|
||||
extern u16 D_801333D0;
|
||||
extern Vec3f D_801333D4;
|
||||
extern f32 D_801333E0;
|
||||
extern s8 D_801333E8;
|
||||
extern u8 D_801333F0;
|
||||
extern u8 gAudioSEFlagSwapOff;
|
||||
extern u8 gAudioSfxSwapOff;
|
||||
extern u8 D_801333F8;
|
||||
//extern ? sSeqCmdWrPos;
|
||||
//extern ? sSeqCmdRdPos;
|
||||
|
@ -2818,10 +2818,10 @@ extern s16 D_80153960[];
|
|||
//extern ? D_80154AE8;
|
||||
//extern ? D_80154AFC;
|
||||
//extern ? D_80154B00;
|
||||
extern u8 gAudioBankTable[];
|
||||
extern u8 D_80155340[];
|
||||
extern u8 gSoundFontTable[];
|
||||
extern u8 gSequenceFontTable[];
|
||||
extern u8 gSequenceTable[];
|
||||
extern u8 gAudioTable[];
|
||||
extern u8 gSampleBankTable[];
|
||||
extern u8 D_80155F50[];
|
||||
extern u8 D_80157580[];
|
||||
extern u8 D_801579A0[];
|
||||
|
@ -3038,60 +3038,11 @@ extern SpeedMeterTimeEntry* gSpeedMeterTimeEntryPtr;
|
|||
//extern ? D_8016A794;
|
||||
//extern ? D_8016A7AC;
|
||||
extern FaultThreadStruct gFaultStruct;
|
||||
//extern ? D_8016B5F6;
|
||||
//extern ? D_8016B684;
|
||||
//extern ? D_8016B690;
|
||||
//extern ? D_8016B692;
|
||||
//extern ? D_8016B6A0;
|
||||
//extern ? D_8016B6B5;
|
||||
//extern ? D_8016B6B8;
|
||||
extern OSMesgQueue D_8016B6E0;
|
||||
//extern ? D_8016B7A8;
|
||||
//extern ? D_8016B7AC;
|
||||
//extern ? D_8016B7B0;
|
||||
//extern ? D_8016B7D8;
|
||||
//extern ? D_8016B7DC;
|
||||
//extern ? D_8016B7E0;
|
||||
//extern ? D_8016B8B0;
|
||||
//extern ? D_8016B8B1;
|
||||
//extern ? D_8016B8B2;
|
||||
//extern ? D_8016B8B3;
|
||||
//extern ? D_8016B8B8;
|
||||
//extern ? D_8016B9B8;
|
||||
//extern ? D_8016B9D8;
|
||||
//extern ? D_8016B9F2;
|
||||
//extern ? D_8016B9F3;
|
||||
//extern ? D_8016B9F4;
|
||||
//extern ? D_8016B9F6;
|
||||
//extern ? D_8016B9F8;
|
||||
//extern ? D_8016B9F9;
|
||||
//extern ? D_8016BA00;
|
||||
//extern ? D_8016BA04;
|
||||
//extern ? D_8016BA08;
|
||||
//extern ? D_8016BA09;
|
||||
//extern ? D_8016BA10;
|
||||
//extern ? D_8016BA18;
|
||||
//extern ? D_8016BA2E;
|
||||
//extern ? D_8016BA50;
|
||||
//extern ? D_8016BA70;
|
||||
//extern ? D_8016BAA0;
|
||||
extern SoundBankEntry D_8016BAD0[9];
|
||||
extern SoundBankEntry D_8016BC80[12];
|
||||
extern SoundBankEntry D_8016BEC0[22];
|
||||
extern SoundBankEntry D_8016C2E0[20];
|
||||
extern SoundBankEntry D_8016C6A0[8];
|
||||
extern SoundBankEntry D_8016C820[3];
|
||||
extern SoundBankEntry D_8016C8B0[5];
|
||||
extern u8 D_8016E1A0[7];
|
||||
extern u8 D_8016E1A8[7];
|
||||
extern u8 D_8016E1B0[7];
|
||||
extern Struct_800F7CEC D_8016E1B8[7][3]; // total size = 0xA8
|
||||
extern u8 D_8016E260;
|
||||
extern ActiveSound gActiveSounds[7][MAX_CHANNELS_PER_BANK]; // total size = 0xA8
|
||||
extern u8 gSoundBankMuted[];
|
||||
//extern ? D_8016E270;
|
||||
extern u16 gAudioSEFlagSwapSource[10];
|
||||
extern u16 gAudioSEFlagSwapTarget[10];
|
||||
extern u8 gAudioSEFlagSwapMode[10];
|
||||
extern u16 gAudioSfxSwapSource[10];
|
||||
extern u16 gAudioSfxSwapTarget[10];
|
||||
extern u8 gAudioSfxSwapMode[10];
|
||||
//extern ? D_8016E320;
|
||||
//extern ? D_8016E348;
|
||||
extern unk_D_8016E750 D_8016E750[4];
|
||||
|
|
|
@ -3,42 +3,68 @@
|
|||
|
||||
#define MK_CMD(b0,b1,b2,b3) ((((b0) & 0xFF) << 0x18) | (((b1) & 0xFF) << 0x10) | (((b2) & 0xFF) << 0x8) | (((b3) & 0xFF) << 0))
|
||||
|
||||
/**
|
||||
* Structs in this repository have primarily been imported from the SM64 Decompilation.
|
||||
* Some struct members may be wrong; the symbol '?' next to an offset means the member is a guess.
|
||||
*/
|
||||
|
||||
#define NO_LAYER ((SequenceChannelLayer*)(-1))
|
||||
#define NO_CHANNEL ((SequenceChannel*)(-1))
|
||||
#define NO_LAYER ((SequenceLayer*)(-1))
|
||||
|
||||
#define TATUMS_PER_BEAT 48
|
||||
|
||||
#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((u32)(ptr) != (u32)&gAudioContext.sequenceChannelNone)
|
||||
|
||||
#define ADSR_STATE_DISABLED 0
|
||||
#define ADSR_STATE_INITIAL 1
|
||||
#define ADSR_STATE_START_LOOP 2
|
||||
#define ADSR_STATE_LOOP 3
|
||||
#define ADSR_STATE_FADE 4
|
||||
#define ADSR_STATE_HANG 5
|
||||
#define ADSR_STATE_DECAY 6
|
||||
#define ADSR_STATE_RELEASE 7
|
||||
#define ADSR_STATE_SUSTAIN 8
|
||||
#define MAX_CHANNELS_PER_BANK 3
|
||||
|
||||
#define ADSR_DISABLE 0
|
||||
#define ADSR_HANG -1
|
||||
#define ADSR_GOTO -2
|
||||
#define ADSR_RESTART -3
|
||||
|
||||
#define AIBUF_LEN 0xB00
|
||||
#define AIBUF_LEN 0x580
|
||||
|
||||
#define CODEC_ADPCM 0
|
||||
#define CODEC_S8 1
|
||||
typedef enum {
|
||||
/* 0 */ ADSR_STATE_DISABLED,
|
||||
/* 1 */ ADSR_STATE_INITIAL,
|
||||
/* 2 */ ADSR_STATE_START_LOOP,
|
||||
/* 3 */ ADSR_STATE_LOOP,
|
||||
/* 4 */ ADSR_STATE_FADE,
|
||||
/* 5 */ ADSR_STATE_HANG,
|
||||
/* 6 */ ADSR_STATE_DECAY,
|
||||
/* 7 */ ADSR_STATE_RELEASE,
|
||||
/* 8 */ ADSR_STATE_SUSTAIN
|
||||
} AdsrStatus;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ MEDIUM_RAM,
|
||||
/* 1 */ MEDIUM_UNK,
|
||||
/* 2 */ MEDIUM_CART,
|
||||
/* 3 */ MEDIUM_DISK_DRIVE
|
||||
} SampleMedium;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ CODEC_ADPCM,
|
||||
/* 1 */ CODEC_S8,
|
||||
/* 2 */ CODEC_S16_INMEMORY,
|
||||
/* 3 */ CODEC_SMALL_ADPCM,
|
||||
/* 4 */ CODEC_REVERB,
|
||||
/* 5 */ CODEC_S16
|
||||
} SampleCodec;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ SEQUENCE_TABLE,
|
||||
/* 1 */ FONT_TABLE,
|
||||
/* 2 */ SAMPLE_TABLE
|
||||
} SampleBankTableType;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ CACHE_TEMPORARY,
|
||||
/* 1 */ CACHE_PERSISTENT,
|
||||
/* 2 */ CACHE_EITHER,
|
||||
/* 3 */ CACHE_PERMANENT
|
||||
} AudioCacheType;
|
||||
|
||||
typedef s32 (*DmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction);
|
||||
|
||||
struct Note;
|
||||
struct NotePool;
|
||||
struct SequenceChannel;
|
||||
struct SequenceChannelLayer;
|
||||
struct SequenceLayer;
|
||||
|
||||
typedef struct AudioListItem {
|
||||
// A node in a circularly linked list. Each node is either a head or an item:
|
||||
|
@ -51,7 +77,7 @@ typedef struct AudioListItem {
|
|||
/* 0x00 */ struct AudioListItem* prev;
|
||||
/* 0x04 */ struct AudioListItem* next;
|
||||
/* 0x08 */ union {
|
||||
void* value; // either Note* or SequenceChannelLayer*
|
||||
void* value; // either Note* or SequenceLayer*
|
||||
s32 count;
|
||||
} u;
|
||||
/* 0x0C */ struct NotePool* pool;
|
||||
|
@ -97,18 +123,18 @@ typedef struct {
|
|||
typedef struct {
|
||||
/* 0x00 */ u32 codec : 4;
|
||||
/* 0x00 */ u32 medium : 2;
|
||||
/* 0x00 */ u32 unk_bits26 : 1;
|
||||
/* 0x00 */ u32 unk_bits25 : 1;
|
||||
/* 0x00 */ u32 unk_bit26 : 1;
|
||||
/* 0x00 */ u32 unk_bit25 : 1;
|
||||
/* 0x01 */ u32 size : 24;
|
||||
/* 0x04 */ u8* sampleAddr;
|
||||
/* 0x08 */ AdpcmLoop* loop;
|
||||
/* 0x0C */ AdpcmBook* book;
|
||||
} AudioBankSample; // size = 0x10
|
||||
} SoundFontSample; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ AudioBankSample* sample;
|
||||
/* 0x00 */ SoundFontSample* sample;
|
||||
/* 0x04 */ f32 tuning; // frequency scale factor
|
||||
} AudioBankSound; // size = 0x8
|
||||
} SoundFontSound; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 numSamplesAfterDownsampling; // never read
|
||||
|
@ -158,8 +184,8 @@ typedef struct {
|
|||
/* 0x274 */ s16* filterRight;
|
||||
/* 0x278 */ s16* filterLeftState;
|
||||
/* 0x27C */ s16* filterRightState;
|
||||
/* 0x280 */ AudioBankSound sound;
|
||||
/* 0x288 */ AudioBankSample sample;
|
||||
/* 0x280 */ SoundFontSound sound;
|
||||
/* 0x288 */ SoundFontSample sample;
|
||||
/* 0x298 */ AdpcmLoop loop;
|
||||
} SynthesisReverb; // size = 0x2C8
|
||||
|
||||
|
@ -169,29 +195,29 @@ typedef struct {
|
|||
/* 0x02 */ u8 normalRangeHi;
|
||||
/* 0x03 */ u8 releaseRate;
|
||||
/* 0x04 */ AdsrEnvelope* envelope;
|
||||
/* 0x08 */ AudioBankSound lowNotesSound;
|
||||
/* 0x10 */ AudioBankSound normalNotesSound;
|
||||
/* 0x18 */ AudioBankSound highNotesSound;
|
||||
/* 0x08 */ SoundFontSound lowNotesSound;
|
||||
/* 0x10 */ SoundFontSound normalNotesSound;
|
||||
/* 0x18 */ SoundFontSound highNotesSound;
|
||||
} Instrument; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 releaseRate;
|
||||
/* 0x01 */ u8 pan;
|
||||
/* 0x02 */ u8 loaded;
|
||||
/* 0x04 */ AudioBankSound sound;
|
||||
/* 0x04 */ SoundFontSound sound;
|
||||
/* 0x14 */ AdsrEnvelope* envelope;
|
||||
} Drum; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 numInstruments;
|
||||
/* 0x01 */ u8 numDrums;
|
||||
/* 0x02 */ u8 unk_02;
|
||||
/* 0x03 */ u8 unk_03;
|
||||
/* 0x02 */ u8 sampleBankId1;
|
||||
/* 0x03 */ u8 sampleBankId2;
|
||||
/* 0x04 */ u16 numSfx;
|
||||
/* 0x08 */ Instrument** instruments;
|
||||
/* 0x0C */ Drum** drums;
|
||||
/* 0x10 */ AudioBankSound* soundEffects;
|
||||
} CtlEntry; // size = 0x14
|
||||
/* 0x10 */ SoundFontSound* soundEffects;
|
||||
} SoundFont; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8* pc;
|
||||
|
@ -199,7 +225,7 @@ typedef struct {
|
|||
/* 0x14 */ u8 remLoopIters[4];
|
||||
/* 0x18 */ u8 depth;
|
||||
/* 0x19 */ s8 value;
|
||||
} M64ScriptState; // size = 0x1C
|
||||
} SeqScriptState; // size = 0x1C
|
||||
|
||||
// Also known as a Group, according to debug strings.
|
||||
typedef struct {
|
||||
|
@ -207,17 +233,17 @@ typedef struct {
|
|||
/* 0x000 */ u8 finished : 1;
|
||||
/* 0x000 */ u8 muted : 1;
|
||||
/* 0x000 */ u8 seqDmaInProgress : 1;
|
||||
/* 0x000 */ u8 bankDmaInProgress : 1;
|
||||
/*?0x000 */ u8 recalculateVolume : 1;
|
||||
/* 0x000 */ u8 unk_0b2 : 1;
|
||||
/* 0x000 */ u8 fontDmaInProgress : 1;
|
||||
/* 0x000 */ u8 recalculateVolume : 1;
|
||||
/* 0x000 */ u8 stopScript : 1;
|
||||
/* 0x000 */ u8 unk_0b1 : 1;
|
||||
/* 0x001 */ u8 state;
|
||||
/* 0x002 */ u8 noteAllocPolicy;
|
||||
/* 0x003 */ u8 muteBehavior;
|
||||
/* 0x004 */ u8 seqId;
|
||||
/* 0x005 */ u8 defaultBank;
|
||||
/* 0x005 */ u8 defaultFont;
|
||||
/* 0x006 */ u8 unk_06[1];
|
||||
/* 0x007 */ s8 playerIndex;
|
||||
/* 0x007 */ s8 playerIdx;
|
||||
/* 0x008 */ u16 tempo; // tatums per minute
|
||||
/* 0x00A */ u16 tempoAcc;
|
||||
/* 0x00C */ u16 unk_0C;
|
||||
|
@ -234,23 +260,14 @@ typedef struct {
|
|||
/* 0x030 */ f32 appliedFadeVolume;
|
||||
/* 0x034 */ f32 unk_34;
|
||||
/* 0x038 */ struct SequenceChannel* channels[16];
|
||||
/* 0x078 */ M64ScriptState scriptState;
|
||||
/* 0x078 */ SeqScriptState scriptState;
|
||||
/* 0x094 */ u8* shortNoteVelocityTable;
|
||||
/* 0x098 */ u8* shortNoteDurationTable;
|
||||
/* 0x098 */ u8* shortNoteGateTimeTable;
|
||||
/* 0x09C */ NotePool notePool;
|
||||
/* 0x0DC */ s32 unk_DC;
|
||||
/* 0x0E0 */ u32 unk_E0;
|
||||
/* 0x0E4 */ u8 pad_E4[0x10]; // OSMesgQueue seqDmaMesgQueue;
|
||||
/*?0x0F4 */ OSMesg seqDmaMesg;
|
||||
/*?0x0F8 */ OSIoMesg seqDmaIoMesg;
|
||||
/*?0x110 */ OSMesgQueue bankDmaMesgQueue;
|
||||
/*?0x128 */ OSMesg bankDmaMesg;
|
||||
/*?0x12C */ OSIoMesg bankDmaIoMesg;
|
||||
/*?0x144 */ u8* bankDmaCurrMemAddr;
|
||||
/*?0x148 */ u32 bankDmaCurrDevAddr;
|
||||
/*?0x14C */ s32 bankDmaRemaining;
|
||||
/* */ u8 pad_150[8];
|
||||
/* 0x158 */ s8 unk_158[8]; // "port" according to debug strings. seqVariationEu? soundScriptIO?
|
||||
/* 0x0DC */ s32 skipTicks;
|
||||
/* 0x0E0 */ u32 scriptCounter;
|
||||
/* 0x0E4 */ char unk_E4[0x74]; // unused struct members for sequence/sound font dma management, according to sm64 decomp
|
||||
/* 0x158 */ s8 soundScriptIO[8];
|
||||
} SequencePlayer; // size = 0x160
|
||||
|
||||
typedef struct {
|
||||
|
@ -282,8 +299,7 @@ typedef struct {
|
|||
} AdsrState;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 bit0 : 1; // unused?
|
||||
/* 0x00 */ u8 bit1 : 1; // unused?
|
||||
/* 0x00 */ u8 unused : 2;
|
||||
/* 0x00 */ u8 bit2 : 2;
|
||||
/* 0x00 */ u8 strongRight : 1;
|
||||
/* 0x00 */ u8 strongLeft : 1;
|
||||
|
@ -309,13 +325,12 @@ typedef struct {
|
|||
/* 0x14 */ s16 filterBuf[8];
|
||||
} NoteAttributes; // size = 0x24
|
||||
|
||||
// Also known as a SubTrack, according to debug strings.
|
||||
// Confusingly, a SubTrack is a container of Tracks.
|
||||
// Also known as a SubTrack, according to sm64 debug strings.
|
||||
typedef struct SequenceChannel {
|
||||
/* 0x00 */ u8 enabled : 1;
|
||||
/* 0x00 */ u8 finished : 1;
|
||||
/* 0x00 */ u8 stopScript : 1;
|
||||
/* 0x00 */ u8 stopSomething2 : 1; // sets SequenceChannelLayer.stopSomething
|
||||
/* 0x00 */ u8 stopSomething2 : 1; // sets SequenceLayer.stopSomething
|
||||
/* 0x00 */ u8 hasInstrument : 1;
|
||||
/* 0x00 */ u8 stereoHeadsetEffects : 1;
|
||||
/* 0x00 */ u8 largeNotes : 1; // notes specify duration and velocity
|
||||
|
@ -333,14 +348,14 @@ typedef struct SequenceChannel {
|
|||
/* 0x04 */ u8 reverb; // or dry/wet mix
|
||||
/* 0x05 */ u8 notePriority; // 0-3
|
||||
/* 0x06 */ u8 someOtherPriority;
|
||||
/* 0x07 */ u8 bankId;
|
||||
/* 0x07 */ u8 fontId;
|
||||
/* 0x08 */ u8 reverbIndex;
|
||||
/* 0x09 */ u8 bookOffset;
|
||||
/* 0x0A */ u8 newPan;
|
||||
/* 0x0B */ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128)
|
||||
/* 0x0C */ u8 unk_0C;
|
||||
/* 0x0D */ u8 velocityRandomVariance;
|
||||
/* 0x0E */ u8 durationRandomVariance;
|
||||
/* 0x0E */ u8 gateTimeRandomVariance;
|
||||
/* 0x0F */ u8 unk_0F;
|
||||
/* 0x10 */ u16 vibratoRateStart;
|
||||
/* 0x12 */ u16 vibratoExtentStart;
|
||||
|
@ -362,20 +377,20 @@ typedef struct SequenceChannel {
|
|||
/* 0x38 */ f32 freqScale;
|
||||
/* 0x3C */ u8 (*dynTable)[][2];
|
||||
/* 0x40 */ struct Note* noteUnused;
|
||||
/* 0x44 */ struct SequenceChannelLayer* layerUnused;
|
||||
/* 0x44 */ struct SequenceLayer* layerUnused;
|
||||
/* 0x48 */ Instrument* instrument;
|
||||
/* 0x4C */ SequencePlayer* seqPlayer;
|
||||
/* 0x50 */ struct SequenceChannelLayer* layers[4];
|
||||
/* 0x60 */ M64ScriptState scriptState;
|
||||
/* 0x50 */ struct SequenceLayer* layers[4];
|
||||
/* 0x60 */ SeqScriptState scriptState;
|
||||
/* 0x7C */ AdsrSettings adsr;
|
||||
/* 0x84 */ NotePool notePool;
|
||||
/* 0xC4 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib
|
||||
/* 0xC4 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib, "io ports"
|
||||
/* 0xCC */ s16* filter;
|
||||
/* 0xD0 */ Stereo stereo;
|
||||
} SequenceChannel; // size = 0xD4
|
||||
|
||||
// Also known as a Track, according to debug strings.
|
||||
typedef struct SequenceChannelLayer {
|
||||
// Might also be known as a Track, according to sm64 debug strings (?).
|
||||
typedef struct SequenceLayer {
|
||||
/* 0x00 */ u8 enabled : 1;
|
||||
/* 0x00 */ u8 finished : 1;
|
||||
/* 0x00 */ u8 stopSomething : 1;
|
||||
|
@ -386,20 +401,20 @@ typedef struct SequenceChannelLayer {
|
|||
/* 0x00 */ u8 notePropertiesNeedInit : 1;
|
||||
/* 0x01 */ Stereo stereo;
|
||||
/* 0x02 */ u8 instOrWave;
|
||||
/* 0x03 */ u8 noteDuration;
|
||||
/* 0x03 */ u8 gateTime;
|
||||
/* 0x04 */ u8 semitone;
|
||||
/* 0x05 */ u8 portamentoTargetNote;
|
||||
/* 0x06 */ u8 pan; // 0..128
|
||||
/* 0x07 */ u8 notePan;
|
||||
/* 0x08 */ s16 delay;
|
||||
/* 0x0A */ s16 duration;
|
||||
/* 0x0A */ s16 gateDelay;
|
||||
/* 0x0C */ s16 delay2;
|
||||
/* 0x0E */ u16 portamentoTime;
|
||||
/* 0x10 */ s16 transposition; // #semitones added to play commands
|
||||
// (m64 instruction encoding only allows referring to the limited range
|
||||
// (seq instruction encoding only allows referring to the limited range
|
||||
// 0..0x3F; this makes 0x40..0x7F accessible as well)
|
||||
/* 0x12 */ s16 shortNoteDefaultPlayPercentage;
|
||||
/* 0x14 */ s16 playPercentage;
|
||||
/* 0x12 */ s16 shortNoteDefaultDelay;
|
||||
/* 0x14 */ s16 lastDelay;
|
||||
/* 0x18 */ AdsrSettings adsr;
|
||||
/* 0x20 */ Portamento portamento;
|
||||
/* 0x2C */ struct Note* note;
|
||||
|
@ -410,11 +425,11 @@ typedef struct SequenceChannelLayer {
|
|||
/* 0x40 */ f32 noteVelocity;
|
||||
/* 0x44 */ f32 noteFreqScale;
|
||||
/* 0x48 */ Instrument* instrument;
|
||||
/* 0x4C */ AudioBankSound* sound;
|
||||
/* 0x50 */ SequenceChannel* seqChannel;
|
||||
/* 0x54 */ M64ScriptState scriptState;
|
||||
/* 0x4C */ SoundFontSound* sound;
|
||||
/* 0x50 */ SequenceChannel* channel;
|
||||
/* 0x54 */ SeqScriptState scriptState;
|
||||
/* 0x70 */ AudioListItem listItem;
|
||||
} SequenceChannelLayer; // size = 0x80
|
||||
} SequenceLayer; // size = 0x80
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ s16 adpcmdecState[0x10];
|
||||
|
@ -431,7 +446,7 @@ typedef struct {
|
|||
/* 0x02 */ u8 prevHeadsetPanRight;
|
||||
/* 0x03 */ u8 prevHeadsetPanLeft;
|
||||
/* 0x04 */ u8 reverbVol;
|
||||
/* 0x05 */ u8 numAdpcmParts;
|
||||
/* 0x05 */ u8 numParts;
|
||||
/* 0x06 */ u16 samplePosFrac;
|
||||
/* 0x08 */ s32 samplePosInt;
|
||||
/* 0x0C */ NoteSynthesisBuffers* synthesisBuffers;
|
||||
|
@ -446,7 +461,7 @@ typedef struct {
|
|||
} NoteSynthesisState; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ struct SequenceChannel* seqChannel;
|
||||
/* 0x00 */ struct SequenceChannel* channel;
|
||||
/* 0x04 */ u32 time;
|
||||
/* 0x08 */ s16* curve;
|
||||
/* 0x0C */ f32 extent;
|
||||
|
@ -461,44 +476,37 @@ typedef struct {
|
|||
/* 0x00 */ u8 priority;
|
||||
/* 0x01 */ u8 waveId;
|
||||
/* 0x02 */ u8 sampleCountIndex;
|
||||
/* 0x03 */ u8 bankId;
|
||||
/* 0x03 */ u8 fontId;
|
||||
/* 0x04 */ u8 unk_04;
|
||||
/* 0x05 */ u8 stereoHeadsetEffects;
|
||||
/* 0x06 */ s16 adsrVolScale; // unused?
|
||||
/* 0x06 */ s16 adsrVolScaleUnused;
|
||||
/* 0x08 */ f32 portamentoFreqScale;
|
||||
/* 0x0C */ f32 vibratoFreqScale;
|
||||
/* 0x10 */ SequenceChannelLayer* prevParentLayer;
|
||||
/* 0x14 */ SequenceChannelLayer* parentLayer;
|
||||
/* 0x18 */ SequenceChannelLayer* wantedParentLayer;
|
||||
/* 0x10 */ SequenceLayer* prevParentLayer;
|
||||
/* 0x14 */ SequenceLayer* parentLayer;
|
||||
/* 0x18 */ SequenceLayer* wantedParentLayer;
|
||||
/* 0x1C */ NoteAttributes attributes;
|
||||
/* 0x40 */ AdsrState adsr;
|
||||
// may contain portamento, vibratoState, if those are not part of Note itself
|
||||
} NotePlaybackState;
|
||||
|
||||
typedef struct {
|
||||
// these bitfields should perhaps be merged into a single struct
|
||||
union {
|
||||
struct {
|
||||
/* 0x00 */ vu8 enabled : 1;
|
||||
/* 0x00 */ u8 needsInit : 1;
|
||||
/*?0x00 */ u8 finished : 1;
|
||||
/* 0x00 */ u8 unused : 1;
|
||||
/* 0x00 */ u8 stereoStrongRight : 1;
|
||||
/* 0x00 */ u8 stereoStrongLeft : 1;
|
||||
/* 0x00 */ u8 stereoHeadsetEffects : 1;
|
||||
/*?0x00 */ u8 usesHeadsetPanEffects : 1;
|
||||
} s;
|
||||
/* 0x00 */ u8 asByte; // likely does not exist
|
||||
struct {
|
||||
/* 0x00 */ volatile u8 enabled : 1;
|
||||
/* 0x00 */ u8 needsInit : 1;
|
||||
/* 0x00 */ u8 finished : 1; // ?
|
||||
/* 0x00 */ u8 unused : 1;
|
||||
/* 0x00 */ u8 stereoStrongRight : 1;
|
||||
/* 0x00 */ u8 stereoStrongLeft : 1;
|
||||
/* 0x00 */ u8 stereoHeadsetEffects : 1;
|
||||
/* 0x00 */ u8 usesHeadsetPanEffects : 1; // ?
|
||||
} bitField0;
|
||||
union {
|
||||
struct {
|
||||
/* 0x01 */ u8 reverbIndex : 3;
|
||||
/* 0x01 */ u8 bookOffset : 2;
|
||||
/* 0x01 */ u8 isSyntheticWave : 1;
|
||||
/* 0x01 */ u8 hasTwoAdpcmParts : 1;
|
||||
/* 0x01 */ u8 usesHeadsetPanEffects2 : 1;
|
||||
} s;
|
||||
/* 0x01 */ u8 asByte; // likely does not exist
|
||||
struct {
|
||||
/* 0x01 */ u8 reverbIndex : 3;
|
||||
/* 0x01 */ u8 bookOffset : 2;
|
||||
/* 0x01 */ u8 isSyntheticWave : 1;
|
||||
/* 0x01 */ u8 hasTwoParts : 1;
|
||||
/* 0x01 */ u8 usesHeadsetPanEffects2 : 1;
|
||||
} bitField1;
|
||||
/* 0x02 */ u8 unk_2;
|
||||
/* 0x03 */ u8 headsetPanRight;
|
||||
|
@ -511,7 +519,7 @@ typedef struct {
|
|||
/* 0x0C */ u16 resamplingRateFixedPoint;
|
||||
/* 0x0E */ u16 unk_0E;
|
||||
/* 0x10 */ union {
|
||||
AudioBankSound* audioBankSound;
|
||||
SoundFontSound* soundFontSound;
|
||||
s16* samples; // used for synthetic waves
|
||||
} sound;
|
||||
/* 0x14 */ s16* filter;
|
||||
|
@ -540,30 +548,30 @@ typedef struct {
|
|||
/* 0x0E */ u16 leakLtr;
|
||||
/* 0x10 */ s8 unk_10;
|
||||
/* 0x12 */ u16 unk_12;
|
||||
/* 0x14 */ s16 unk_14;
|
||||
/* 0x16 */ s16 unk_16;
|
||||
/* 0x14 */ s16 lowPassFilterCutoffLeft;
|
||||
/* 0x16 */ s16 lowPassFilterCutoffRight;
|
||||
} ReverbSettings; // size = 0x18
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 frequency;
|
||||
/* 0x04 */ u8 unk_04;
|
||||
/* 0x05 */ u8 maxSimultaneousNotes;
|
||||
/* 0x05 */ u8 numNotes;
|
||||
/* 0x06 */ u8 numSequencePlayers;
|
||||
/* 0x07 */ u8 unk_07[0x2];
|
||||
/* 0x07 */ u8 unk_07; // unused, set to zero
|
||||
/* 0x08 */ u8 unk_08; // unused, set to zero
|
||||
/* 0x09 */ u8 numReverbs;
|
||||
/* 0x0A */ u8 unk_0A[0x2];
|
||||
/* 0x0C */ ReverbSettings* reverbSettings;
|
||||
/* 0x10 */ u16 unk_10;
|
||||
/* 0x12 */ u16 unk_12;
|
||||
/* 0x10 */ u16 sampleDmaBufSize1;
|
||||
/* 0x12 */ u16 sampleDmaBufSize2;
|
||||
/* 0x14 */ u16 unk_14;
|
||||
/* 0x18 */ u32 persistentSeqMem;
|
||||
/* 0x1C */ u32 persistentBankMem;
|
||||
/* 0x20 */ u32 persistentUnusedMem;
|
||||
/* 0x1C */ u32 persistentFontMem;
|
||||
/* 0x20 */ u32 persistentSampleMem;
|
||||
/* 0x24 */ u32 temporarySeqMem;
|
||||
/* 0x28 */ u32 temporaryBankMem;
|
||||
/* 0x2C */ u32 temporaryUnusedMem;
|
||||
/* 0x30 */ s32 unk_30;
|
||||
/* 0x34 */ s32 unk_34;
|
||||
/* 0x28 */ u32 temporaryFontMem;
|
||||
/* 0x2C */ u32 temporarySampleMem;
|
||||
/* 0x30 */ s32 persistentSampleCacheMem;
|
||||
/* 0x34 */ s32 temporarySampleCacheMem;
|
||||
} AudioSpec; // size = 0x38
|
||||
|
||||
typedef struct {
|
||||
|
@ -588,52 +596,49 @@ typedef struct {
|
|||
/* 0x0 */ u8* start;
|
||||
/* 0x4 */ u8* cur;
|
||||
/* 0x8 */ s32 size;
|
||||
/* 0xC */ s32 unused; // set to 0, never read
|
||||
} SoundAllocPool; // size = 0x10
|
||||
/* 0xC */ s32 count;
|
||||
} AudioAllocPool; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u8* ptr;
|
||||
/* 0x4 */ u32 size;
|
||||
/* 0x8 */ s16 poolIndex;
|
||||
/* 0xA */ s16 id; // seqId or bankId
|
||||
} SeqOrBankEntry; // size = 0xC
|
||||
/* 0x8 */ s16 tableType;
|
||||
/* 0xA */ s16 id;
|
||||
} AudioCacheEntry; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s8 unk_00;
|
||||
/* 0x01 */ s8 unk_01;
|
||||
/* 0x02 */ s8 unk_02;
|
||||
/* 0x00 */ s8 inUse;
|
||||
/* 0x01 */ s8 origMedium;
|
||||
/* 0x02 */ s8 sampleBankId;
|
||||
/* 0x03 */ char unk_03[0x5];
|
||||
/* 0x08 */ u8* unk_08;
|
||||
/* 0x0C */ void* unk_0C;
|
||||
/* 0x08 */ u8* allocatedAddr;
|
||||
/* 0x0C */ void* sampleAddr;
|
||||
/* 0x10 */ u32 size;
|
||||
} UnkHeapEntry; // size = 0x14
|
||||
} SampleCacheEntry; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ SoundAllocPool pool;
|
||||
/* 0x010 */ UnkHeapEntry entries[32];
|
||||
/* 0x000 */ AudioAllocPool pool;
|
||||
/* 0x010 */ SampleCacheEntry entries[32];
|
||||
/* 0x290 */ s32 size;
|
||||
} UnkPool; // size = 0x294
|
||||
} AudioSampleCache; // size = 0x294
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
/* 0x00*/ u32 numEntries;
|
||||
/* 0x04*/ SoundAllocPool pool;
|
||||
/* 0x14*/ SeqOrBankEntry entries[16];
|
||||
} PersistentPool; // size = 0xD4
|
||||
/* 0x04*/ AudioAllocPool pool;
|
||||
/* 0x14*/ AudioCacheEntry entries[16];
|
||||
} AudioPersistentCache; // size = 0xD4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
/* 0x00*/ u32 nextSide;
|
||||
/* 0x04*/ SoundAllocPool pool;
|
||||
/* 0x14*/ SeqOrBankEntry entries[2];
|
||||
} TemporaryPool; // size = 0x3C
|
||||
/* 0x04*/ AudioAllocPool pool;
|
||||
/* 0x14*/ AudioCacheEntry entries[2];
|
||||
} AudioTemporaryCache; // size = 0x3C
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x000*/ PersistentPool persistent;
|
||||
/* 0x0D4*/ TemporaryPool temporary;
|
||||
typedef struct {
|
||||
/* 0x000*/ AudioPersistentCache persistent;
|
||||
/* 0x0D4*/ AudioTemporaryCache temporary;
|
||||
/* 0x100*/ u8 unk_100[0x10];
|
||||
} SoundMultiPool; // size = 0x110
|
||||
} AudioCache; // size = 0x110
|
||||
|
||||
typedef struct {
|
||||
u32 wantPersistent;
|
||||
|
@ -642,40 +647,24 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
u32 wantSeq;
|
||||
u32 wantBank;
|
||||
u32 wantUnused;
|
||||
u32 wantFont;
|
||||
u32 wantSample;
|
||||
} AudioPoolSplit3; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
u32 wantSeq;
|
||||
u32 wantBank;
|
||||
u32 wantUnused;
|
||||
u32 wantFont;
|
||||
u32 wantSample;
|
||||
u32 wantCustom;
|
||||
} AudioPoolSplit4; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
u8* unk_0;
|
||||
u8* unk_4;
|
||||
u32 unk_8;
|
||||
s8 unk_C;
|
||||
s8 unk_D;
|
||||
s16 unk_E;
|
||||
} Struct_800E0E0C_2;
|
||||
|
||||
typedef struct {
|
||||
char unk_00[0x2];
|
||||
s16 unk_02;
|
||||
char unk_04[0x8];
|
||||
Struct_800E0E0C_2 unk_C[1]; // unknown size
|
||||
} ManyStruct_800E0E0C_2;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 endAndMediumKey;
|
||||
/* 0x04 */ AudioBankSample* sample;
|
||||
/* 0x04 */ SoundFontSample* sample;
|
||||
/* 0x08 */ u8* ramAddr;
|
||||
/* 0x0C */ u32 encodedInfo;
|
||||
/* 0x10 */ s32 isFree;
|
||||
} AudioStruct0D68; // size = 0x14
|
||||
} AudioPreloadReq; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
union{
|
||||
|
@ -698,111 +687,56 @@ typedef struct {
|
|||
};
|
||||
} AudioCmd;
|
||||
|
||||
typedef struct {
|
||||
union{
|
||||
struct {
|
||||
s16 unk_00;
|
||||
u16 unk_02;
|
||||
};
|
||||
u32 unk_00w;
|
||||
};
|
||||
u32 unk_04;
|
||||
s8 unk_08;
|
||||
char unk_09[0x7];
|
||||
} unk_dma_s;
|
||||
|
||||
#define MK_ASYNC_MSG(b0,b1,b2,b3)(((b0) << 0x18) | ((b1) << 0x10) | ((b2) << 0x08) | ((b3) << 0x00))
|
||||
#define ASYNC_TBLTYPE(v)((u8)(v >> 0x10))
|
||||
#define ASYNC_B2(v)((u8)(v >> 0x08))
|
||||
#define ASYNC_B3(v)((u8)(v >> 0x00))
|
||||
#define AYSNC_B0(v)(((u8)(v >> 0x18))
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s8 status;
|
||||
/* 0x01 */ s8 unk_01;
|
||||
/* 0x02 */ s8 unk_02; // type?
|
||||
/* 0x03 */ char unk_03[0x1];
|
||||
/* 0x04 */ u32 unk_04;
|
||||
/* 0x08 */ u32 devAddr;
|
||||
/* 0x0C */ u8* ramAddr;
|
||||
/* 0x01 */ s8 delay;
|
||||
/* 0x02 */ s8 medium;
|
||||
/* 0x04 */ u8* ramAddr;
|
||||
/* 0x08 */ u32 curDevAddr;
|
||||
/* 0x0C */ u8* curRamAddr;
|
||||
/* 0x10 */ u32 bytesRemaining;
|
||||
/* 0x14 */ u32 chunkSize;
|
||||
/* 0x18 */ s32 unk_18;
|
||||
/* 0x18 */ s32 unkMediumParam;
|
||||
/* 0x1C */ u32 retMsg;
|
||||
/* 0x20 */ OSMesgQueue* retQueue;
|
||||
/* 0x24 */ OSMesgQueue msgQueue;
|
||||
/* 0x3C */ OSMesg msg;
|
||||
/* 0x40 */ OSIoMesg ioMesg;
|
||||
} AsyncLoadReq; // size = 0x58
|
||||
} AudioAsyncLoad; // size = 0x58
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 unk_00;
|
||||
/* 0x01 */ u8 unk_01;
|
||||
/* 0x02 */ u16 unk_02;
|
||||
/* 0x04 */ s32 unk_04;
|
||||
/* 0x08 */ s32 devAddr;
|
||||
/* 0x0C */ u8* ramAddr;
|
||||
/* 0x10 */ u8* unk_10;
|
||||
/* 0x00 */ u8 medium;
|
||||
/* 0x01 */ u8 seqOrFontId;
|
||||
/* 0x02 */ u16 instId;
|
||||
/* 0x04 */ s32 unkMediumParam;
|
||||
/* 0x08 */ s32 curDevAddr;
|
||||
/* 0x0C */ u8* curRamAddr;
|
||||
/* 0x10 */ u8* ramAddr;
|
||||
/* 0x14 */ s32 status;
|
||||
/* 0x18 */ s32 size;
|
||||
/* 0x18 */ s32 bytesRemaining;
|
||||
/* 0x1C */ s8* isDone;
|
||||
/* 0x20 */ AudioBankSample sample;
|
||||
/* 0x20 */ SoundFontSample sample;
|
||||
/* 0x30 */ OSMesgQueue msgqueue;
|
||||
/* 0x48 */ OSMesg msg;
|
||||
/* 0x4C */ OSIoMesg ioMesg;
|
||||
} AudioSyncLoad; // size = 0x64
|
||||
|
||||
typedef struct {
|
||||
u16 offsets[18];
|
||||
char data[1];
|
||||
} unk_283C;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 entryCnt;
|
||||
/* 0x02 */ s16 unk_02;
|
||||
/* 0x04 */ u32 romAddr;
|
||||
/* 0x08 */ char pad[0x8];
|
||||
} AudioTableHeader; // size = 0x10
|
||||
} AudioSlowLoad; // size = 0x64
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 romAddr;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ s8 unk_08;
|
||||
/* 0x09 */ s8 type;
|
||||
/* 0x0A */ char pad[6];
|
||||
} SequenceTableEntry; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 romAddr;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ u8 unk_08;
|
||||
/* 0x09 */ u8 unk_09;
|
||||
/* 0x0A */ s16 unk_0A;
|
||||
/* 0x0C */ s16 unk_0C;
|
||||
/* 0x0E */ s16 unk_0E;
|
||||
} AudioBankTableEntry; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 romAddr;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ s8 unk_08;
|
||||
/* 0x09 */ s8 unk_09;
|
||||
/* 0x0A */ char pad[6];
|
||||
/* 0x08 */ s8 medium;
|
||||
/* 0x09 */ s8 cachePolicy;
|
||||
/* 0x0A */ s16 shortData1;
|
||||
/* 0x0C */ s16 shortData2;
|
||||
/* 0x0E */ s16 shortData3;
|
||||
} AudioTableEntry; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ AudioTableHeader header;
|
||||
/* 0x10 */ SequenceTableEntry entries[1];
|
||||
} SequenceTable; // size >= 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ AudioTableHeader header;
|
||||
/* 0x10 */ AudioBankTableEntry entries[1];
|
||||
} AudioBankTable; // size >= 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ AudioTableHeader header;
|
||||
/* 0x10 */ AudioTableEntry entries[1];
|
||||
/* 0x00 */ s16 numEntries;
|
||||
/* 0x02 */ s16 unkMediumParam;
|
||||
/* 0x04 */ u32 romAddr;
|
||||
/* 0x08 */ char pad[0x8];
|
||||
/* 0x10 */ AudioTableEntry entries[1]; // (dynamic size)
|
||||
} AudioTable; // size >= 0x20
|
||||
|
||||
typedef struct {
|
||||
|
@ -820,22 +754,7 @@ typedef struct {
|
|||
/* 0x0C */ u8 unused;
|
||||
/* 0x0D */ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/* 0x0E */ u8 ttl; // duration after which the DMA can be discarded
|
||||
} SampleDmaReq; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 index1;
|
||||
/* 0x04 */ s32 index2;
|
||||
/* 0x08 */ s32 baseAddr1;
|
||||
/* 0x0C */ s32 baseAddr2;
|
||||
/* 0x10 */ u32 medium1;
|
||||
/* 0x14 */ u32 medium2;
|
||||
} RelocInfo; // size = 0x18
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ SEQUENCE_TABLE,
|
||||
/* 1 */ BANK_TABLE,
|
||||
/* 2 */ AUDIO_TABLE
|
||||
} AudioTableType;
|
||||
} SampleDma; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ char unk_0000;
|
||||
|
@ -847,56 +766,52 @@ typedef struct {
|
|||
/* 0x0014 */ NoteSubEu* noteSubsEu;
|
||||
/* 0x0018 */ SynthesisReverb synthesisReverbs[4];
|
||||
/* 0x0B38 */ char unk_0B38[0x30];
|
||||
/* 0x0B68 */ AudioBankSample* unk_0B68[128];
|
||||
/* 0x0D68 */ AudioStruct0D68 unk_0D68[128];
|
||||
/* 0x1768 */ s32 unk_1768;
|
||||
/* 0x176C */ s32 unk_176C;
|
||||
/* 0x1770 */ AsyncLoadReq asyncReqs[0x10];
|
||||
/* 0x1CF0 */ OSMesgQueue asyncLoadQueue;
|
||||
/* 0x0B68 */ SoundFontSample* usedSamples[128];
|
||||
/* 0x0D68 */ AudioPreloadReq preloadSampleStack[128];
|
||||
/* 0x1768 */ s32 numUsedSamples;
|
||||
/* 0x176C */ s32 preloadSampleStackTop;
|
||||
/* 0x1770 */ AudioAsyncLoad asyncLoads[0x10];
|
||||
/* 0x1CF0 */ OSMesgQueue asyncLoadUnkMediumQueue;
|
||||
/* 0x1D08 */ char unk_1D08[0x40];
|
||||
/* 0x1D48 */ AsyncLoadReq* curAsyncReq;
|
||||
/* 0x1D4C */ u32 syncLoadPos;
|
||||
/* 0x1D50 */ AudioSyncLoad syncLoads[2];
|
||||
/* 0x1D48 */ AudioAsyncLoad* curUnkMediumLoad;
|
||||
/* 0x1D4C */ u32 slowLoadPos;
|
||||
/* 0x1D50 */ AudioSlowLoad slowLoads[2];
|
||||
/* 0x1E18 */ OSPiHandle* cartHandle;
|
||||
/* probably an unused PI handle for n64 disk drive */
|
||||
/* 0x1E1C */ OSPiHandle* unk_1E1C;
|
||||
/* 0x1E20 */ OSMesgQueue unk_1E20;
|
||||
/* 0x1E38 */ OSMesg unk_1E38[0x10];
|
||||
/* 0x1E78 */ OSMesgQueue unk_1E78;
|
||||
/* 0x1E90 */ OSMesg unk_1E90[0x10];
|
||||
/* 0x1E1C */ OSPiHandle* driveHandle;
|
||||
/* 0x1E20 */ OSMesgQueue externalLoadQueue;
|
||||
/* 0x1E38 */ OSMesg externalLoadMesgBuf[0x10];
|
||||
/* 0x1E78 */ OSMesgQueue preloadSampleQueue;
|
||||
/* 0x1E90 */ OSMesg preloadSampleMesgBuf[0x10];
|
||||
/* 0x1ED0 */ OSMesgQueue currAudioFrameDmaQueue;
|
||||
/* 0x1EE8 */ OSMesg currAudioFrameDmaMesgBufs[0x40];
|
||||
/* 0x1FE8 */ OSIoMesg currAudioFrameDmaIoMesgBufs[0x40];
|
||||
/* 0x25E8 */ OSMesgQueue unk_25E8;
|
||||
/* 0x2600 */ OSMesg unk_2600;
|
||||
/* 0x2604 */ OSIoMesg unk_2604;
|
||||
/* 0x261C */ SampleDmaReq* sampleDmaReqs;
|
||||
/* 0x2620 */ u32 sampleDmaReqCnt;
|
||||
/* 0x1EE8 */ OSMesg currAudioFrameDmaMesgBuf[0x40];
|
||||
/* 0x1FE8 */ OSIoMesg currAudioFrameDmaIoMesgBuf[0x40];
|
||||
/* 0x25E8 */ OSMesgQueue syncDmaQueue;
|
||||
/* 0x2600 */ OSMesg syncDmaMesg;
|
||||
/* 0x2604 */ OSIoMesg syncDmaIoMesg;
|
||||
/* 0x261C */ SampleDma* sampleDmas;
|
||||
/* 0x2620 */ u32 sampleDmaCount;
|
||||
/* 0x2624 */ u32 sampleDmaListSize1;
|
||||
/* 0x2628 */ s32 unk_2628;
|
||||
/* 0x2628 */ s32 unused2628;
|
||||
/* 0x262C */ u8 sampleDmaReuseQueue1[0x100]; // read pos <= write pos, wrapping mod 256
|
||||
/* 0x272C */ u8 sampleDmaReuseQueue2[0x100];
|
||||
/* 0x282C */ u8 sampleDmaReuseQueue1RdPos;
|
||||
/* 0x282D */ u8 sampleDmaReuseQueue2RdPos;
|
||||
/* 0x282E */ u8 sampleDmaReuseQueue1WrPos;
|
||||
/* 0x282F */ u8 sampleDmaReuseQueue2WrPos;
|
||||
/* 0x2830 */ SequenceTable* sequenceTable;
|
||||
/* 0x2834 */ AudioBankTable* audioBankTable;
|
||||
/* 0x2838 */ AudioTable* audioTable;
|
||||
union {
|
||||
/* 0x283C */ u16* unk_283C;
|
||||
/* 0x283C */ u8* unk_283Cb;
|
||||
};
|
||||
/* 0x2840 */ u16 seqTabEntCnt; // channels used?
|
||||
/* 0x2844 */ CtlEntry* ctlEntries;
|
||||
/* 0x2830 */ AudioTable* sequenceTable;
|
||||
/* 0x2834 */ AudioTable* soundFontTable;
|
||||
/* 0x2838 */ AudioTable* sampleBankTable;
|
||||
/* 0x283C */ u8* sequenceFontTable;
|
||||
/* 0x2840 */ u16 numSequences;
|
||||
/* 0x2844 */ SoundFont* soundFonts;
|
||||
/* 0x2848 */ AudioBufferParameters audioBufferParameters;
|
||||
/* 0x2870 */ f32 unk_2870;
|
||||
/* 0x2874 */ s32 unk_2874;
|
||||
/* 0x2874 */ s32 unk_2878;
|
||||
/* 0x2874 */ s32 sampleDmaBufSize1;
|
||||
/* 0x2874 */ s32 sampleDmaBufSize2;
|
||||
/* 0x287C */ char unk_287C[0x10];
|
||||
/* 0x288C */ s32 unk_288C;
|
||||
/* 0x288C */ s32 sampleDmaBufSize;
|
||||
/* 0x2890 */ s32 maxAudioCmds;
|
||||
/* 0x2894 */ s32 maxSimultaneousNotes; // (bad name)
|
||||
/* 0x2894 */ s32 numNotes;
|
||||
/* 0x2898 */ s16 tempoInternalToExternal;
|
||||
/* 0x289A */ s8 soundMode;
|
||||
/* 0x289C */ s32 totalTaskCnt;
|
||||
|
@ -916,27 +831,27 @@ typedef struct {
|
|||
/* 0x2980 */ s32 audioErrorFlags;
|
||||
/* 0x2984 */ volatile u32 resetTimer;
|
||||
/* 0x2988 */ char unk_2988[0x8];
|
||||
/* 0x2990 */ SoundAllocPool audioSessionPool;
|
||||
/* 0x29A0 */ SoundAllocPool unkPool;
|
||||
/* 0x29B0 */ SoundAllocPool audioInitPool;
|
||||
/* 0x29C0 */ SoundAllocPool notesAndBuffersPool;
|
||||
/* 0x2990 */ AudioAllocPool audioSessionPool;
|
||||
/* 0x29A0 */ AudioAllocPool externalPool;
|
||||
/* 0x29B0 */ AudioAllocPool audioInitPool;
|
||||
/* 0x29C0 */ AudioAllocPool notesAndBuffersPool;
|
||||
/* 0x29D0 */ char unk_29D0[0x20]; // probably two unused pools
|
||||
/* 0x29F0 */ SoundAllocPool seqAndBankPool;
|
||||
/* 0x2A00 */ SoundAllocPool persistentCommonPool;
|
||||
/* 0x2A10 */ SoundAllocPool temporaryCommonPool;
|
||||
/* 0x2A20 */ SoundMultiPool seqLoadedPool;
|
||||
/* 0x2B30 */ SoundMultiPool bankLoadedPool;
|
||||
/* 0x2C40 */ SoundMultiPool unusedLoadedPool; // rename after we figure out what this is
|
||||
/* 0x2D50 */ SoundAllocPool unk_2D50;
|
||||
/* 0x2D60 */ SeqOrBankEntry unk_2D60[32];
|
||||
/* 0x2EE0 */ UnkPool unk_2EE0;
|
||||
/* 0x3174 */ UnkPool unk_3174;
|
||||
/* 0x29F0 */ AudioAllocPool cachePool;
|
||||
/* 0x2A00 */ AudioAllocPool persistentCommonPool;
|
||||
/* 0x2A10 */ AudioAllocPool temporaryCommonPool;
|
||||
/* 0x2A20 */ AudioCache seqCache;
|
||||
/* 0x2B30 */ AudioCache fontCache;
|
||||
/* 0x2C40 */ AudioCache sampleBankCache;
|
||||
/* 0x2D50 */ AudioAllocPool permanentPool;
|
||||
/* 0x2D60 */ AudioCacheEntry permanentCache[32];
|
||||
/* 0x2EE0 */ AudioSampleCache persistentSampleCache;
|
||||
/* 0x3174 */ AudioSampleCache temporarySampleCache;
|
||||
/* 0x3408 */ AudioPoolSplit4 sessionPoolSplit;
|
||||
/* 0x3418 */ AudioPoolSplit2 seqAndBankPoolSplit;
|
||||
/* 0x3418 */ AudioPoolSplit2 cachePoolSplit;
|
||||
/* 0x3420 */ AudioPoolSplit3 persistentCommonPoolSplit;
|
||||
/* 0x342C */ AudioPoolSplit3 temporaryCommonPoolSplit;
|
||||
/* 0x3438 */ u8 audioTableLoadStatus[0x30];
|
||||
/* 0x3468 */ u8 bankLoadStatus[0x30];
|
||||
/* 0x3438 */ u8 sampleFontLoadStatus[0x30];
|
||||
/* 0x3468 */ u8 fontLoadStatus[0x30];
|
||||
/* 0x3498 */ u8 seqLoadStatus[0x80];
|
||||
/* 0x3518 */ volatile u8 resetStatus;
|
||||
/* 0x3519 */ u8 audioResetSpecIdToLoad;
|
||||
|
@ -946,7 +861,7 @@ typedef struct {
|
|||
/* 0x3528 */ u32 audioHeapSize;
|
||||
/* 0x352C */ Note* notes;
|
||||
/* 0x3530 */ SequencePlayer seqPlayers[4];
|
||||
/* 0x3AB0 */ SequenceChannelLayer sequenceLayers[64];
|
||||
/* 0x3AB0 */ SequenceLayer sequenceLayers[64];
|
||||
/* 0x5AB0 */ SequenceChannel sequenceChannelNone;
|
||||
/* 0x5B84 */ s32 noteSubEuOffset;
|
||||
/* 0x5B88 */ AudioListItem layerFreeList;
|
||||
|
@ -954,7 +869,6 @@ typedef struct {
|
|||
/* 0x5BD8 */ u8 cmdWrPos;
|
||||
/* 0x5BD9 */ u8 cmdRdPos;
|
||||
/* 0x5BDA */ u8 cmdQueueFinished;
|
||||
/* 0x5BDB */ char unk_5BDB[0x1];
|
||||
/* 0x5BDC */ u16 unk_5BDC[4];
|
||||
/* 0x5BE4 */ OSMesgQueue* audioResetQueueP;
|
||||
/* 0x5BE8 */ OSMesgQueue* taskStartQueueP;
|
||||
|
@ -982,9 +896,9 @@ typedef struct {
|
|||
} NoteSubAttributes; // size = 0x18
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 heap;
|
||||
/* 0x04 */ u32 mainPool;
|
||||
/* 0x08 */ u32 initPool;
|
||||
/* 0x00 */ u32 heapSize;
|
||||
/* 0x04 */ u32 initPoolSize;
|
||||
/* 0x08 */ u32 permanentPoolSize;
|
||||
} AudioContextInitSizes; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
|
@ -1012,22 +926,18 @@ typedef struct {
|
|||
/* 0x020 */ f32 unk_20;
|
||||
/* 0x024 */ f32 unk_24;
|
||||
/* 0x028 */ u16 unk_28;
|
||||
/* 0x02A */ char unk_2A[0x2];
|
||||
/* 0x02C */ u32 unk_2C[8];
|
||||
/* 0x04C */ u8 unk_4C;
|
||||
/* 0x04D */ u8 unk_4D;
|
||||
/* 0x04E */ u8 unk_4E;
|
||||
/* 0x04F */ char unk_4F;
|
||||
/* 0x050 */ unk_50_s unk_50[0x10];
|
||||
/* 0x250 */ u16 unk_250;
|
||||
/* 0x252 */ u16 unk_252;
|
||||
/* 0x254 */ u16 unk_254;
|
||||
/* 0x256 */ u16 unk_256;
|
||||
/* 0x258 */ u16 unk_258;
|
||||
/* 0x25A */ char unk_25A[0x2];
|
||||
/* 0x25C */ u32 unk_25C;
|
||||
/* 0x260 */ u8 unk_260;
|
||||
/* 0x261 */ char unk_261[0x3];
|
||||
} unk_D_8016E750; // size = 0x264
|
||||
|
||||
typedef enum {
|
||||
|
@ -1040,24 +950,33 @@ typedef enum {
|
|||
/* 6 */ BANK_VOICE
|
||||
} SoundBankTypes;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ SFX_STATE_EMPTY,
|
||||
/* 1 */ SFX_STATE_QUEUED,
|
||||
/* 2 */ SFX_STATE_READY,
|
||||
/* 3 */ SFX_STATE_PLAYING_REFRESH,
|
||||
/* 4 */ SFX_STATE_PLAYING_1,
|
||||
/* 5 */ SFX_STATE_PLAYING_2
|
||||
} SfxState;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ f32* posX;
|
||||
/* 0x04 */ f32* posY;
|
||||
/* 0x08 */ f32* posZ;
|
||||
/* 0x0C */ u8 unk_C;
|
||||
/* 0x0C */ u8 token;
|
||||
/* 0x10 */ f32* freqScale;
|
||||
/* 0x14 */ f32* unk_14;
|
||||
/* 0x14 */ f32* vol;
|
||||
/* 0x18 */ s8* reverbAdd;
|
||||
/* 0x1C */ f32 dist;
|
||||
/* 0x20 */ u32 priority; // lower is more prioritized
|
||||
/* 0x24 */ u8 sfxImportance;
|
||||
/* 0x26 */ u16 sfxParams;
|
||||
/* 0x28 */ u16 sfxId;
|
||||
/* 0x2A */ u8 unk_2A;
|
||||
/* 0x2B */ u8 unk_2B;
|
||||
/* 0x2A */ u8 state; // uses SfxState enum
|
||||
/* 0x2B */ u8 freshness;
|
||||
/* 0x2C */ u8 prev;
|
||||
/* 0x2D */ u8 next;
|
||||
/* 0x2E */ u8 unk_2E;
|
||||
/* 0x2E */ u8 channelIdx;
|
||||
/* 0x2F */ u8 unk_2F;
|
||||
} SoundBankEntry; // size = 0x30
|
||||
|
||||
|
@ -1084,8 +1003,8 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
u32 priority; // lower is more prioritized
|
||||
u8 unk_4;
|
||||
} Struct_800F7CEC;
|
||||
u8 entryIndex;
|
||||
} ActiveSound;
|
||||
|
||||
typedef struct {
|
||||
u8 importance;
|
||||
|
|
2
spec
2
spec
|
@ -418,7 +418,7 @@ beginseg
|
|||
include "build/data/code_800F7260.bss.o"
|
||||
include "build/src/code/code_800F9280.o"
|
||||
include "build/data/code_800F9280.data.o"
|
||||
include "build/src/code/audio_rodata.o"
|
||||
include "build/src/code/audio_init_params.o"
|
||||
include "build/src/code/logseverity.o"
|
||||
include "build/src/code/gfxprint.o"
|
||||
include "build/src/code/code_800FBCE0.o"
|
||||
|
|
|
@ -17,7 +17,7 @@ void* Yaz0_FirstDMA(void) {
|
|||
curSize = sYaz0CurDataEnd - (u32)sYaz0DataBuffer;
|
||||
dmaSize = (curSize > sYaz0CurSize) ? sYaz0CurSize : curSize;
|
||||
|
||||
DmaMgr_DMARomToRam(sYaz0CurRomStart, sYaz0DataBuffer, dmaSize);
|
||||
DmaMgr_DmaRomToRam(sYaz0CurRomStart, sYaz0DataBuffer, dmaSize);
|
||||
sYaz0CurRomStart += dmaSize;
|
||||
sYaz0CurSize -= dmaSize;
|
||||
return sYaz0DataBuffer;
|
||||
|
@ -38,7 +38,7 @@ void* Yaz0_NextDMA(void* curSrcPos) {
|
|||
}
|
||||
|
||||
if (dmaSize != 0) {
|
||||
DmaMgr_DMARomToRam(sYaz0CurRomStart, (u32)dst + restSize, dmaSize);
|
||||
DmaMgr_DmaRomToRam(sYaz0CurRomStart, (u32)dst + restSize, dmaSize);
|
||||
sYaz0CurRomStart += dmaSize;
|
||||
sYaz0CurSize -= dmaSize;
|
||||
if (!sYaz0CurSize) {
|
||||
|
|
|
@ -1569,7 +1569,7 @@ s32 DmaMgr_CompareName(const char* name1, const char* name2) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) {
|
||||
s32 DmaMgr_DmaRomToRam(u32 rom, u32 ram, u32 size) {
|
||||
OSIoMesg ioMsg;
|
||||
OSMesgQueue queue;
|
||||
OSMesg msg;
|
||||
|
@ -1601,14 +1601,14 @@ s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) {
|
|||
|
||||
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
||||
if (ret) {
|
||||
goto DmaMgr_DMARomToRam_end;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (D_80009460 == 10) {
|
||||
osSyncPrintf("%10lld ノーマルDMA START (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount);
|
||||
}
|
||||
|
||||
osRecvMesg(&queue, NULL, 1);
|
||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
if (D_80009460 == 10) {
|
||||
osSyncPrintf("%10lld ノーマルDMA END (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount);
|
||||
}
|
||||
|
@ -1633,22 +1633,22 @@ s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) {
|
|||
|
||||
ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ);
|
||||
if (ret) {
|
||||
goto DmaMgr_DMARomToRam_end;
|
||||
goto end;
|
||||
}
|
||||
|
||||
osRecvMesg(&queue, NULL, 1);
|
||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
if (D_80009460 == 10) {
|
||||
osSyncPrintf("%10lld ノーマルDMA END (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount);
|
||||
}
|
||||
|
||||
DmaMgr_DMARomToRam_end:
|
||||
end:
|
||||
osInvalICache((void*)ram, size);
|
||||
osInvalDCache((void*)ram, size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||
s32 ret;
|
||||
|
||||
ASSERT(pihandle == gCartHandle, "pihandle == carthandle", "../z_std_dma.c", 530);
|
||||
|
@ -1667,7 +1667,7 @@ s32 DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void DmaMgr_DmaCallback1(u32 ram, u32 rom, u32 size) {
|
||||
void DmaMgr_DmaFromDriveRom(u32 ram, u32 rom, u32 size) {
|
||||
OSPiHandle* handle = osDriveRomInit();
|
||||
OSMesgQueue queue;
|
||||
OSMesg msg;
|
||||
|
@ -1684,7 +1684,7 @@ void DmaMgr_DmaCallback1(u32 ram, u32 rom, u32 size) {
|
|||
ioMsg.size = size;
|
||||
handle->transferInfo.cmdType = 2;
|
||||
|
||||
osEPiStartDma(handle, &ioMsg, 0);
|
||||
osEPiStartDma(handle, &ioMsg, OS_READ);
|
||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
return;
|
||||
}
|
||||
|
@ -1783,7 +1783,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
|
|||
"セグメント境界をまたがってDMA転送することはできません");
|
||||
}
|
||||
|
||||
DmaMgr_DMARomToRam(iter->romStart + (vrom - iter->vromStart), (u32)ram, size);
|
||||
DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->vromStart), (u32)ram, size);
|
||||
found = true;
|
||||
|
||||
if (0) {
|
||||
|
@ -1823,7 +1823,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
|
|||
return;
|
||||
}
|
||||
|
||||
DmaMgr_DMARomToRam(vrom, (u32)ram, size);
|
||||
DmaMgr_DmaRomToRam(vrom, (u32)ram, size);
|
||||
|
||||
if (0) {
|
||||
osSyncPrintf("No Press ROM:%08X RAM:%08X SIZE:%08X (非公式)\n", vrom, ram, size);
|
||||
|
@ -1837,7 +1837,7 @@ void DmaMgr_ThreadEntry(void* arg0) {
|
|||
|
||||
osSyncPrintf("DMAマネージャスレッド実行開始\n");
|
||||
while (true) {
|
||||
osRecvMesg(&sDmaMgrMsgQueue, &msg, 1);
|
||||
osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK);
|
||||
req = (DmaRequest*)msg;
|
||||
if (req == NULL) {
|
||||
break;
|
||||
|
@ -1861,8 +1861,8 @@ void DmaMgr_ThreadEntry(void* arg0) {
|
|||
s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg) {
|
||||
static s32 sDmaMgrQueueFullLogged = 0;
|
||||
|
||||
if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000) ||
|
||||
(size == 0) || (size & 1)) {
|
||||
if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) ||
|
||||
(size & 1)) {
|
||||
DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です");
|
||||
}
|
||||
|
||||
|
@ -1910,7 +1910,7 @@ void DmaMgr_Init(void) {
|
|||
s32 idx;
|
||||
DmaEntry* iter;
|
||||
|
||||
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, (u32)_dmadataSegmentStart,
|
||||
DmaMgr_DmaRomToRam((u32)_dmadataSegmentRomStart, (u32)_dmadataSegmentStart,
|
||||
(u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
|
||||
osSyncPrintf("dma_rom_ad[]\n");
|
||||
|
||||
|
@ -1972,6 +1972,6 @@ s32 DmaMgr_SendRequest1(void* ram0, u32 vrom, u32 size, const char* file, s32 li
|
|||
return ret;
|
||||
}
|
||||
|
||||
osRecvMesg(&queue, NULL, 1);
|
||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -55,9 +55,9 @@ void AudioMgr_ThreadEntry(void* arg0) {
|
|||
s16* msg = NULL;
|
||||
|
||||
osSyncPrintf("オーディオマネージャスレッド実行開始\n"); // "Start running audio manager thread"
|
||||
func_800F70F8();
|
||||
func_800E301C(DmaMgr_DmaCallback0);
|
||||
func_800F711C();
|
||||
Audio_Init();
|
||||
AudioLoad_SetDmaHandler(DmaMgr_DmaHandler);
|
||||
Audio_InitSound();
|
||||
osSendMesg(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK);
|
||||
IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74);
|
||||
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
void Audio_SequenceChannelProcessSound(SequenceChannel* seqChannel, s32 recalculateVolume, s32 b) {
|
||||
void Audio_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculateVolume, s32 b) {
|
||||
f32 channelVolume;
|
||||
f32 chanFreqScale;
|
||||
s32 i;
|
||||
|
||||
if (seqChannel->changes.s.volume || recalculateVolume) {
|
||||
channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->appliedFadeVolume;
|
||||
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & 0x20)) {
|
||||
channelVolume = seqChannel->seqPlayer->muteVolumeScale * channelVolume;
|
||||
if (channel->changes.s.volume || recalculateVolume) {
|
||||
channelVolume = channel->volume * channel->volumeScale * channel->seqPlayer->appliedFadeVolume;
|
||||
if (channel->seqPlayer->muted && (channel->muteBehavior & 0x20)) {
|
||||
channelVolume = channel->seqPlayer->muteVolumeScale * channelVolume;
|
||||
}
|
||||
seqChannel->appliedVolume = channelVolume * channelVolume;
|
||||
channel->appliedVolume = channelVolume * channelVolume;
|
||||
}
|
||||
|
||||
if (seqChannel->changes.s.pan) {
|
||||
seqChannel->pan = seqChannel->newPan * seqChannel->panChannelWeight;
|
||||
if (channel->changes.s.pan) {
|
||||
channel->pan = channel->newPan * channel->panChannelWeight;
|
||||
}
|
||||
|
||||
chanFreqScale = seqChannel->freqScale;
|
||||
chanFreqScale = channel->freqScale;
|
||||
if (b != 0) {
|
||||
chanFreqScale *= seqChannel->seqPlayer->unk_34;
|
||||
seqChannel->changes.s.freqScale = true;
|
||||
chanFreqScale *= channel->seqPlayer->unk_34;
|
||||
channel->changes.s.freqScale = true;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
SequenceChannelLayer* layer = seqChannel->layers[i];
|
||||
SequenceLayer* layer = channel->layers[i];
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL) {
|
||||
if (layer->notePropertiesNeedInit) {
|
||||
layer->noteFreqScale = layer->freqScale * chanFreqScale;
|
||||
layer->noteVelocity = layer->velocitySquare2 * seqChannel->appliedVolume;
|
||||
layer->notePan = (seqChannel->pan + layer->pan * (0x80 - seqChannel->panChannelWeight)) >> 7;
|
||||
layer->noteVelocity = layer->velocitySquare2 * channel->appliedVolume;
|
||||
layer->notePan = (channel->pan + layer->pan * (0x80 - channel->panChannelWeight)) >> 7;
|
||||
layer->notePropertiesNeedInit = false;
|
||||
} else {
|
||||
if (seqChannel->changes.s.freqScale) {
|
||||
if (channel->changes.s.freqScale) {
|
||||
layer->noteFreqScale = layer->freqScale * chanFreqScale;
|
||||
}
|
||||
if (seqChannel->changes.s.volume || recalculateVolume) {
|
||||
layer->noteVelocity = layer->velocitySquare2 * seqChannel->appliedVolume;
|
||||
if (channel->changes.s.volume || recalculateVolume) {
|
||||
layer->noteVelocity = layer->velocitySquare2 * channel->appliedVolume;
|
||||
}
|
||||
if (seqChannel->changes.s.pan) {
|
||||
layer->notePan = (seqChannel->pan + layer->pan * (0x80 - seqChannel->panChannelWeight)) >> 7;
|
||||
if (channel->changes.s.pan) {
|
||||
layer->notePan = (channel->pan + layer->pan * (0x80 - channel->panChannelWeight)) >> 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
seqChannel->changes.asByte = 0;
|
||||
channel->changes.asByte = 0;
|
||||
}
|
||||
|
||||
void Audio_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
|
||||
|
@ -63,7 +63,7 @@ void Audio_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
|
|||
}
|
||||
|
||||
if (--seqPlayer->fadeTimer == 0 && seqPlayer->state == 2) {
|
||||
Audio_SequencePlayerDisable(seqPlayer);
|
||||
AudioSeq_SequencePlayerDisable(seqPlayer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -112,14 +112,16 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
|
|||
f32 temp;
|
||||
f32 twoToThe16th = 65536.0f;
|
||||
s32 one = 1;
|
||||
SequenceChannel* channel = vib->seqChannel;
|
||||
SequenceChannel* channel = vib->channel;
|
||||
|
||||
if (vib->delay != 0) {
|
||||
vib->delay--;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (channel != NO_CHANNEL) {
|
||||
//! @bug this probably meant to compare with gAudioContext.sequenceChannelNone.
|
||||
//! -1 isn't used as a channel pointer anywhere else.
|
||||
if (channel != ((SequenceChannel*)(-1))) {
|
||||
if (vib->extentChangeTimer) {
|
||||
if (vib->extentChangeTimer == 1) {
|
||||
vib->extent = (s32)channel->vibratoExtentTarget;
|
||||
|
@ -179,7 +181,7 @@ void Audio_NoteVibratoUpdate(Note* note) {
|
|||
|
||||
void Audio_NoteVibratoInit(Note* note) {
|
||||
VibratoState* vib;
|
||||
SequenceChannel* seqChannel;
|
||||
SequenceChannel* channel;
|
||||
|
||||
note->playbackState.vibratoFreqScale = 1.0f;
|
||||
|
||||
|
@ -189,20 +191,20 @@ void Audio_NoteVibratoInit(Note* note) {
|
|||
vib->time = 0;
|
||||
|
||||
vib->curve = gWaveSamples[2];
|
||||
vib->seqChannel = note->playbackState.parentLayer->seqChannel;
|
||||
seqChannel = vib->seqChannel;
|
||||
if ((vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay) == 0) {
|
||||
vib->extent = (s32)seqChannel->vibratoExtentTarget;
|
||||
vib->channel = note->playbackState.parentLayer->channel;
|
||||
channel = vib->channel;
|
||||
if ((vib->extentChangeTimer = channel->vibratoExtentChangeDelay) == 0) {
|
||||
vib->extent = (s32)channel->vibratoExtentTarget;
|
||||
} else {
|
||||
vib->extent = (s32)seqChannel->vibratoExtentStart;
|
||||
vib->extent = (s32)channel->vibratoExtentStart;
|
||||
}
|
||||
|
||||
if ((vib->rateChangeTimer = seqChannel->vibratoRateChangeDelay) == 0) {
|
||||
vib->rate = (s32)seqChannel->vibratoRateTarget;
|
||||
if ((vib->rateChangeTimer = channel->vibratoRateChangeDelay) == 0) {
|
||||
vib->rate = (s32)channel->vibratoRateTarget;
|
||||
} else {
|
||||
vib->rate = (s32)seqChannel->vibratoRateStart;
|
||||
vib->rate = (s32)channel->vibratoRateStart;
|
||||
}
|
||||
vib->delay = seqChannel->vibratoDelay;
|
||||
vib->delay = channel->vibratoDelay;
|
||||
}
|
||||
|
||||
void Audio_NotePortamentoInit(Note* note) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
#include "global.h"
|
||||
|
||||
const s16 D_8014A6C0[] = {
|
||||
0x1C00,
|
||||
0x0030,
|
||||
0x1C00, // unused
|
||||
0x0030, // gTatumsPerBeat
|
||||
};
|
||||
const AudioContextInitSizes D_8014A6C4 = { 0x37F00, 0xE0E0, 0xBCE0 };
|
File diff suppressed because it is too large
Load diff
|
@ -17,8 +17,8 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
reverbVol = attrs->reverbVol;
|
||||
sp24 = attrs->stereo.s;
|
||||
|
||||
sub->bitField0.s = note->noteSubEu.bitField0.s;
|
||||
sub->bitField1.s = note->noteSubEu.bitField1.s;
|
||||
sub->bitField0 = note->noteSubEu.bitField0;
|
||||
sub->bitField1 = note->noteSubEu.bitField1;
|
||||
sub->sound.samples = note->noteSubEu.sound.samples;
|
||||
sub->unk_06 = note->noteSubEu.unk_06;
|
||||
|
||||
|
@ -26,10 +26,10 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
|
||||
pan &= 0x7F;
|
||||
|
||||
sub->bitField0.s.stereoStrongRight = false;
|
||||
sub->bitField0.s.stereoStrongLeft = false;
|
||||
sub->bitField0.s.stereoHeadsetEffects = sp24.stereoHeadsetEffects;
|
||||
sub->bitField0.s.usesHeadsetPanEffects = sp24.usesHeadsetPanEffects;
|
||||
sub->bitField0.stereoStrongRight = false;
|
||||
sub->bitField0.stereoStrongLeft = false;
|
||||
sub->bitField0.stereoHeadsetEffects = sp24.stereoHeadsetEffects;
|
||||
sub->bitField0.usesHeadsetPanEffects = sp24.usesHeadsetPanEffects;
|
||||
if (stereoHeadsetEffects && gAudioContext.soundMode == 1) {
|
||||
smallPanIndex = pan >> 1;
|
||||
if (smallPanIndex > 0x3F) {
|
||||
|
@ -38,7 +38,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
|
||||
sub->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex];
|
||||
sub->headsetPanRight = gHeadsetPanQuantization[0x3F - smallPanIndex];
|
||||
sub->bitField1.s.usesHeadsetPanEffects2 = true;
|
||||
sub->bitField1.usesHeadsetPanEffects2 = true;
|
||||
|
||||
volLeft = gHeadsetPanVolume[pan];
|
||||
volRight = gHeadsetPanVolume[0x7F - pan];
|
||||
|
@ -46,7 +46,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
strongLeft = strongRight = 0;
|
||||
sub->headsetPanRight = 0;
|
||||
sub->headsetPanLeft = 0;
|
||||
sub->bitField1.s.usesHeadsetPanEffects2 = false;
|
||||
sub->bitField1.usesHeadsetPanEffects2 = false;
|
||||
|
||||
volLeft = gStereoPanVolume[pan];
|
||||
volRight = gStereoPanVolume[0x7F - pan];
|
||||
|
@ -56,34 +56,34 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
strongRight = 1;
|
||||
}
|
||||
|
||||
sub->bitField0.s.stereoStrongRight = strongRight;
|
||||
sub->bitField0.s.stereoStrongLeft = strongLeft;
|
||||
sub->bitField0.stereoStrongRight = strongRight;
|
||||
sub->bitField0.stereoStrongLeft = strongLeft;
|
||||
|
||||
switch (sp24.bit2) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
sub->bitField0.s.stereoStrongRight = sp24.strongRight;
|
||||
sub->bitField0.s.stereoStrongLeft = sp24.strongLeft;
|
||||
sub->bitField0.stereoStrongRight = sp24.strongRight;
|
||||
sub->bitField0.stereoStrongLeft = sp24.strongLeft;
|
||||
break;
|
||||
case 2:
|
||||
sub->bitField0.s.stereoStrongRight = sp24.strongRight | strongRight;
|
||||
sub->bitField0.s.stereoStrongLeft = sp24.strongLeft | strongLeft;
|
||||
sub->bitField0.stereoStrongRight = sp24.strongRight | strongRight;
|
||||
sub->bitField0.stereoStrongLeft = sp24.strongLeft | strongLeft;
|
||||
break;
|
||||
case 3:
|
||||
sub->bitField0.s.stereoStrongRight = sp24.strongRight ^ strongRight;
|
||||
sub->bitField0.s.stereoStrongLeft = sp24.strongLeft ^ strongLeft;
|
||||
sub->bitField0.stereoStrongRight = sp24.strongRight ^ strongRight;
|
||||
sub->bitField0.stereoStrongLeft = sp24.strongLeft ^ strongLeft;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (gAudioContext.soundMode == 3) {
|
||||
sub->bitField0.s.stereoHeadsetEffects = false;
|
||||
sub->bitField0.s.usesHeadsetPanEffects = false;
|
||||
sub->bitField0.stereoHeadsetEffects = false;
|
||||
sub->bitField0.usesHeadsetPanEffects = false;
|
||||
volLeft = 0.707f; // approx 1/sqrt(2)
|
||||
volRight = 0.707f;
|
||||
} else {
|
||||
sub->bitField0.s.stereoStrongRight = sp24.strongRight;
|
||||
sub->bitField0.s.stereoStrongLeft = sp24.strongLeft;
|
||||
sub->bitField0.stereoStrongRight = sp24.strongRight;
|
||||
sub->bitField0.stereoStrongLeft = sp24.strongLeft;
|
||||
volLeft = gDefaultPanVolume[pan];
|
||||
volRight = gDefaultPanVolume[0x7F - pan];
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput)
|
|||
f32 resamplingRate = 0.0f;
|
||||
|
||||
if (resamplingRateInput < 2.0f) {
|
||||
noteSubEu->bitField1.s.hasTwoAdpcmParts = false;
|
||||
noteSubEu->bitField1.hasTwoParts = false;
|
||||
|
||||
if (1.99998f < resamplingRateInput) {
|
||||
resamplingRate = 1.99998f;
|
||||
|
@ -114,7 +114,7 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput)
|
|||
}
|
||||
|
||||
} else {
|
||||
noteSubEu->bitField1.s.hasTwoAdpcmParts = true;
|
||||
noteSubEu->bitField1.hasTwoParts = true;
|
||||
if (3.99996f < resamplingRateInput) {
|
||||
resamplingRate = 1.99998f;
|
||||
} else {
|
||||
|
@ -126,11 +126,11 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput)
|
|||
|
||||
void Audio_NoteInit(Note* note) {
|
||||
if (note->playbackState.parentLayer->adsr.releaseRate == 0) {
|
||||
Audio_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->seqChannel->adsr.envelope,
|
||||
¬e->playbackState.adsrVolScale);
|
||||
Audio_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->channel->adsr.envelope,
|
||||
¬e->playbackState.adsrVolScaleUnused);
|
||||
} else {
|
||||
Audio_AdsrInit(¬e->playbackState.adsr, note->playbackState.parentLayer->adsr.envelope,
|
||||
¬e->playbackState.adsrVolScale);
|
||||
¬e->playbackState.adsrVolScaleUnused);
|
||||
}
|
||||
|
||||
note->playbackState.unk_04 = 0;
|
||||
|
@ -139,13 +139,13 @@ void Audio_NoteInit(Note* note) {
|
|||
}
|
||||
|
||||
void Audio_NoteDisable(Note* note) {
|
||||
if (note->noteSubEu.bitField0.s.needsInit == true) {
|
||||
note->noteSubEu.bitField0.s.needsInit = false;
|
||||
if (note->noteSubEu.bitField0.needsInit == true) {
|
||||
note->noteSubEu.bitField0.needsInit = false;
|
||||
}
|
||||
note->playbackState.priority = 0;
|
||||
note->noteSubEu.bitField0.s.enabled = false;
|
||||
note->noteSubEu.bitField0.enabled = false;
|
||||
note->playbackState.unk_04 = 0;
|
||||
note->noteSubEu.bitField0.s.finished = false;
|
||||
note->noteSubEu.bitField0.finished = false;
|
||||
note->playbackState.parentLayer = NO_LAYER;
|
||||
note->playbackState.prevParentLayer = NO_LAYER;
|
||||
note->playbackState.adsr.action.s.state = ADSR_STATE_DISABLED;
|
||||
|
@ -164,7 +164,7 @@ void Audio_ProcessNotes(void) {
|
|||
f32 scale;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
note = &gAudioContext.notes[i];
|
||||
noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i];
|
||||
playbackState = ¬e->playbackState;
|
||||
|
@ -182,19 +182,19 @@ void Audio_ProcessNotes(void) {
|
|||
} else if (!playbackState->parentLayer->enabled && playbackState->unk_04 == 0 &&
|
||||
playbackState->priority >= 1) {
|
||||
// do nothing
|
||||
} else if (playbackState->parentLayer->seqChannel->seqPlayer == NULL) {
|
||||
Audio_SequenceChannelDisable(playbackState->parentLayer->seqChannel);
|
||||
} else if (playbackState->parentLayer->channel->seqPlayer == NULL) {
|
||||
AudioSeq_SequenceChannelDisable(playbackState->parentLayer->channel);
|
||||
playbackState->priority = 1;
|
||||
playbackState->unk_04 = 1;
|
||||
continue;
|
||||
} else if (playbackState->parentLayer->seqChannel->seqPlayer->muted &&
|
||||
(playbackState->parentLayer->seqChannel->muteBehavior & 0x40)) {
|
||||
} else if (playbackState->parentLayer->channel->seqPlayer->muted &&
|
||||
(playbackState->parentLayer->channel->muteBehavior & 0x40)) {
|
||||
// do nothing
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
|
||||
Audio_SeqChanLayerNoteRelease(playbackState->parentLayer);
|
||||
Audio_SeqLayerNoteRelease(playbackState->parentLayer);
|
||||
Audio_AudioListRemove(¬e->listItem);
|
||||
Audio_AudioListPushFront(¬e->listItem.pool->decaying, ¬e->listItem);
|
||||
playbackState->priority = 1;
|
||||
|
@ -207,22 +207,22 @@ void Audio_ProcessNotes(void) {
|
|||
if (playbackState->priority != 0) {
|
||||
if (1) {}
|
||||
noteSubEu = ¬e->noteSubEu;
|
||||
if (playbackState->unk_04 >= 1 || noteSubEu->bitField0.s.finished) {
|
||||
if (playbackState->adsr.action.s.state == ADSR_STATE_DISABLED || noteSubEu->bitField0.s.finished) {
|
||||
if (playbackState->unk_04 >= 1 || noteSubEu->bitField0.finished) {
|
||||
if (playbackState->adsr.action.s.state == ADSR_STATE_DISABLED || noteSubEu->bitField0.finished) {
|
||||
if (playbackState->wantedParentLayer != NO_LAYER) {
|
||||
Audio_NoteDisable(note);
|
||||
if (playbackState->wantedParentLayer->seqChannel != NULL) {
|
||||
if (playbackState->wantedParentLayer->channel != NULL) {
|
||||
Audio_NoteInitForLayer(note, playbackState->wantedParentLayer);
|
||||
Audio_NoteVibratoInit(note);
|
||||
Audio_NotePortamentoInit(note);
|
||||
Audio_AudioListRemove(¬e->listItem);
|
||||
Audio_AudioListPushBack(¬e->listItem.pool->active, ¬e->listItem);
|
||||
AudioSeq_AudioListPushBack(¬e->listItem.pool->active, ¬e->listItem);
|
||||
playbackState->wantedParentLayer = NO_LAYER;
|
||||
// don't skip
|
||||
} else {
|
||||
Audio_NoteDisable(note);
|
||||
Audio_AudioListRemove(¬e->listItem);
|
||||
Audio_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem);
|
||||
AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem);
|
||||
playbackState->wantedParentLayer = NO_LAYER;
|
||||
goto skip;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ void Audio_ProcessNotes(void) {
|
|||
}
|
||||
Audio_NoteDisable(note);
|
||||
Audio_AudioListRemove(¬e->listItem);
|
||||
Audio_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem);
|
||||
AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ void Audio_ProcessNotes(void) {
|
|||
}
|
||||
Audio_NoteDisable(note);
|
||||
Audio_AudioListRemove(¬e->listItem);
|
||||
Audio_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem);
|
||||
AudioSeq_AudioListPushBack(¬e->listItem.pool->disabled, ¬e->listItem);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -259,10 +259,10 @@ void Audio_ProcessNotes(void) {
|
|||
subAttrs.filter = attrs->filter;
|
||||
subAttrs.unk_14 = attrs->unk_4;
|
||||
subAttrs.unk_16 = attrs->unk_6;
|
||||
bookOffset = noteSubEu->bitField1.s.bookOffset;
|
||||
bookOffset = noteSubEu->bitField1.bookOffset;
|
||||
} else {
|
||||
SequenceChannelLayer* layer = playbackState->parentLayer;
|
||||
SequenceChannel* channel = layer->seqChannel;
|
||||
SequenceLayer* layer = playbackState->parentLayer;
|
||||
SequenceChannel* channel = layer->channel;
|
||||
|
||||
subAttrs.frequency = layer->noteFreqScale;
|
||||
subAttrs.velocity = layer->noteVelocity;
|
||||
|
@ -289,14 +289,14 @@ void Audio_ProcessNotes(void) {
|
|||
subAttrs.frequency *= gAudioContext.audioBufferParameters.resampleRate;
|
||||
subAttrs.velocity *= scale;
|
||||
Audio_InitNoteSub(note, noteSubEu2, &subAttrs);
|
||||
noteSubEu->bitField1.s.bookOffset = bookOffset;
|
||||
noteSubEu->bitField1.bookOffset = bookOffset;
|
||||
skip:;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AudioBankSound* Audio_InstrumentGetAudioBankSound(Instrument* instrument, s32 semitone) {
|
||||
AudioBankSound* sound;
|
||||
SoundFontSound* Audio_InstrumentGetSound(Instrument* instrument, s32 semitone) {
|
||||
SoundFontSound* sound;
|
||||
if (semitone < instrument->normalRangeLo) {
|
||||
sound = &instrument->lowNotesSound;
|
||||
} else if (semitone <= instrument->normalRangeHi) {
|
||||
|
@ -307,85 +307,85 @@ AudioBankSound* Audio_InstrumentGetAudioBankSound(Instrument* instrument, s32 se
|
|||
return sound;
|
||||
}
|
||||
|
||||
Instrument* Audio_GetInstrumentInner(s32 bankId, s32 instId) {
|
||||
Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
||||
Instrument* inst;
|
||||
|
||||
if (bankId == 0xFF) {
|
||||
if (fontId == 0xFF) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!Audio_IsBankLoadComplete(bankId)) {
|
||||
gAudioContext.audioErrorFlags = bankId + 0x10000000;
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (instId >= gAudioContext.ctlEntries[bankId].numInstruments) {
|
||||
gAudioContext.audioErrorFlags = ((bankId << 8) + instId) + 0x3000000;
|
||||
if (instId >= gAudioContext.soundFonts[fontId].numInstruments) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inst = gAudioContext.ctlEntries[bankId].instruments[instId];
|
||||
inst = gAudioContext.soundFonts[fontId].instruments[instId];
|
||||
if (inst == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((bankId << 8) + instId) + 0x1000000;
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
||||
return inst;
|
||||
}
|
||||
|
||||
return inst;
|
||||
}
|
||||
|
||||
Drum* Audio_GetDrum(s32 bankId, s32 drumId) {
|
||||
Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
|
||||
Drum* drum;
|
||||
|
||||
if (bankId == 0xFF) {
|
||||
if (fontId == 0xFF) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!Audio_IsBankLoadComplete(bankId)) {
|
||||
gAudioContext.audioErrorFlags = bankId + 0x10000000;
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (drumId >= gAudioContext.ctlEntries[bankId].numDrums) {
|
||||
gAudioContext.audioErrorFlags = ((bankId << 8) + drumId) + 0x4000000;
|
||||
if (drumId >= gAudioContext.soundFonts[fontId].numDrums) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
|
||||
return NULL;
|
||||
}
|
||||
if ((u32)gAudioContext.ctlEntries[bankId].drums < 0x80000000) {
|
||||
if ((u32)gAudioContext.soundFonts[fontId].drums < 0x80000000) {
|
||||
return NULL;
|
||||
}
|
||||
drum = gAudioContext.ctlEntries[bankId].drums[drumId];
|
||||
drum = gAudioContext.soundFonts[fontId].drums[drumId];
|
||||
|
||||
if (drum == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((bankId << 8) + drumId) + 0x5000000;
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
|
||||
}
|
||||
|
||||
return drum;
|
||||
}
|
||||
|
||||
AudioBankSound* Audio_GetSfx(s32 bankId, s32 sfxId) {
|
||||
AudioBankSound* sfx;
|
||||
SoundFontSound* Audio_GetSfx(s32 fontId, s32 sfxId) {
|
||||
SoundFontSound* sfx;
|
||||
|
||||
if (bankId == 0xFF) {
|
||||
if (fontId == 0xFF) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!Audio_IsBankLoadComplete(bankId)) {
|
||||
gAudioContext.audioErrorFlags = bankId + 0x10000000;
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sfxId >= gAudioContext.ctlEntries[bankId].numSfx) {
|
||||
gAudioContext.audioErrorFlags = ((bankId << 8) + sfxId) + 0x4000000;
|
||||
if (sfxId >= gAudioContext.soundFonts[fontId].numSfx) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((u32)gAudioContext.ctlEntries[bankId].soundEffects < 0x80000000) {
|
||||
if ((u32)gAudioContext.soundFonts[fontId].soundEffects < 0x80000000) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sfx = &gAudioContext.ctlEntries[bankId].soundEffects[sfxId];
|
||||
sfx = &gAudioContext.soundFonts[fontId].soundEffects[sfxId];
|
||||
|
||||
if (sfx == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((bankId << 8) + sfxId) + 0x5000000;
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
|
||||
}
|
||||
|
||||
if (sfx->sample == NULL) {
|
||||
|
@ -395,67 +395,67 @@ AudioBankSound* Audio_GetSfx(s32 bankId, s32 sfxId) {
|
|||
return sfx;
|
||||
}
|
||||
|
||||
s32 func_800E7744(s32 instrument, s32 bankId, s32 instId, void* arg3) {
|
||||
if (bankId == 0xFF) {
|
||||
s32 Audio_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* value) {
|
||||
if (fontId == 0xFF) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!Audio_IsBankLoadComplete(bankId)) {
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
switch (instrument) {
|
||||
switch (instrumentType) {
|
||||
case 0:
|
||||
if (instId >= gAudioContext.ctlEntries[bankId].numDrums) {
|
||||
if (index >= gAudioContext.soundFonts[fontId].numDrums) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.ctlEntries[bankId].drums[instId] = arg3;
|
||||
gAudioContext.soundFonts[fontId].drums[index] = value;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (instId >= gAudioContext.ctlEntries[bankId].numSfx) {
|
||||
if (index >= gAudioContext.soundFonts[fontId].numSfx) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.ctlEntries[bankId].soundEffects[instId] = *(AudioBankSound*)arg3;
|
||||
gAudioContext.soundFonts[fontId].soundEffects[index] = *(SoundFontSound*)value;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (instId >= gAudioContext.ctlEntries[bankId].numInstruments) {
|
||||
if (index >= gAudioContext.soundFonts[fontId].numInstruments) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.ctlEntries[bankId].instruments[instId] = arg3;
|
||||
gAudioContext.soundFonts[fontId].instruments[index] = value;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target) {
|
||||
void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
||||
Note* note;
|
||||
NoteAttributes* attrs;
|
||||
SequenceChannel* chan;
|
||||
s32 i;
|
||||
|
||||
if (seqLayer == NO_LAYER) {
|
||||
if (layer == NO_LAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
seqLayer->bit3 = false;
|
||||
layer->bit3 = false;
|
||||
|
||||
if (seqLayer->note == NULL) {
|
||||
if (layer->note == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
note = seqLayer->note;
|
||||
note = layer->note;
|
||||
attrs = ¬e->playbackState.attributes;
|
||||
|
||||
if (note->playbackState.wantedParentLayer == seqLayer) {
|
||||
if (note->playbackState.wantedParentLayer == layer) {
|
||||
note->playbackState.wantedParentLayer = NO_LAYER;
|
||||
}
|
||||
|
||||
if (note->playbackState.parentLayer != seqLayer) {
|
||||
if (note->playbackState.parentLayer != layer) {
|
||||
if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER &&
|
||||
note->playbackState.prevParentLayer == seqLayer && target != ADSR_STATE_DECAY) {
|
||||
note->playbackState.prevParentLayer == layer && target != ADSR_STATE_DECAY) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.action.s.release = true;
|
||||
}
|
||||
|
@ -463,12 +463,12 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
|
|||
}
|
||||
|
||||
if (note->playbackState.adsr.action.s.state != ADSR_STATE_DECAY) {
|
||||
attrs->freqScale = seqLayer->noteFreqScale;
|
||||
attrs->velocity = seqLayer->noteVelocity;
|
||||
attrs->pan = seqLayer->notePan;
|
||||
attrs->freqScale = layer->noteFreqScale;
|
||||
attrs->velocity = layer->noteVelocity;
|
||||
attrs->pan = layer->notePan;
|
||||
|
||||
if (seqLayer->seqChannel != NULL) {
|
||||
chan = seqLayer->seqChannel;
|
||||
if (layer->channel != NULL) {
|
||||
chan = layer->channel;
|
||||
attrs->reverb = chan->reverb;
|
||||
attrs->unk_1 = chan->unk_0C;
|
||||
attrs->filter = chan->filter;
|
||||
|
@ -483,17 +483,17 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
|
|||
attrs->unk_6 = chan->unk_20;
|
||||
attrs->unk_4 = chan->unk_0F;
|
||||
if (chan->seqPlayer->muted && (chan->muteBehavior & 8)) {
|
||||
note->noteSubEu.bitField0.s.finished = true;
|
||||
note->noteSubEu.bitField0.finished = true;
|
||||
}
|
||||
|
||||
if (seqLayer->stereo.asByte == 0) {
|
||||
if (layer->stereo.asByte == 0) {
|
||||
attrs->stereo = chan->stereo;
|
||||
} else {
|
||||
attrs->stereo = seqLayer->stereo;
|
||||
attrs->stereo = layer->stereo;
|
||||
}
|
||||
note->playbackState.priority = chan->someOtherPriority;
|
||||
} else {
|
||||
attrs->stereo = seqLayer->stereo;
|
||||
attrs->stereo = layer->stereo;
|
||||
note->playbackState.priority = 1;
|
||||
}
|
||||
|
||||
|
@ -506,13 +506,13 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
|
|||
} else {
|
||||
note->playbackState.unk_04 = 1;
|
||||
note->playbackState.adsr.action.s.decay = true;
|
||||
if (seqLayer->adsr.releaseRate == 0) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[seqLayer->seqChannel->adsr.releaseRate];
|
||||
if (layer->adsr.releaseRate == 0) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[layer->channel->adsr.releaseRate];
|
||||
} else {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[seqLayer->adsr.releaseRate];
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.unk_3520[layer->adsr.releaseRate];
|
||||
}
|
||||
note->playbackState.adsr.sustain =
|
||||
((f32)(s32)(seqLayer->seqChannel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f;
|
||||
((f32)(s32)(layer->channel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -522,15 +522,15 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
|
|||
}
|
||||
}
|
||||
|
||||
void Audio_SeqChanLayerNoteDecay(SequenceChannelLayer* seqLayer) {
|
||||
Audio_SeqChanLayerDecayRelease(seqLayer, ADSR_STATE_DECAY);
|
||||
void Audio_SeqLayerNoteDecay(SequenceLayer* layer) {
|
||||
Audio_SeqLayerDecayRelease(layer, ADSR_STATE_DECAY);
|
||||
}
|
||||
|
||||
void Audio_SeqChanLayerNoteRelease(SequenceChannelLayer* seqLayer) {
|
||||
Audio_SeqChanLayerDecayRelease(seqLayer, ADSR_STATE_RELEASE);
|
||||
void Audio_SeqLayerNoteRelease(SequenceLayer* layer) {
|
||||
Audio_SeqLayerDecayRelease(layer, ADSR_STATE_RELEASE);
|
||||
}
|
||||
|
||||
s32 Audio_BuildSyntheticWave(Note* note, SequenceChannelLayer* seqLayer, s32 waveId) {
|
||||
s32 Audio_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveId) {
|
||||
f32 freqScale;
|
||||
f32 ratio;
|
||||
u8 sampleCountIndex;
|
||||
|
@ -539,9 +539,9 @@ s32 Audio_BuildSyntheticWave(Note* note, SequenceChannelLayer* seqLayer, s32 wav
|
|||
waveId = 128;
|
||||
}
|
||||
|
||||
freqScale = seqLayer->freqScale;
|
||||
if (seqLayer->portamento.mode != 0 && 0.0f < seqLayer->portamento.extent) {
|
||||
freqScale *= (seqLayer->portamento.extent + 1.0f);
|
||||
freqScale = layer->freqScale;
|
||||
if (layer->portamento.mode != 0 && 0.0f < layer->portamento.extent) {
|
||||
freqScale *= (layer->portamento.extent + 1.0f);
|
||||
}
|
||||
if (freqScale < 0.99999f) {
|
||||
sampleCountIndex = 0;
|
||||
|
@ -556,7 +556,7 @@ s32 Audio_BuildSyntheticWave(Note* note, SequenceChannelLayer* seqLayer, s32 wav
|
|||
sampleCountIndex = 3;
|
||||
ratio = 0.13081f;
|
||||
}
|
||||
seqLayer->freqScale *= ratio;
|
||||
layer->freqScale *= ratio;
|
||||
note->playbackState.waveId = waveId;
|
||||
note->playbackState.sampleCountIndex = sampleCountIndex;
|
||||
|
||||
|
@ -565,17 +565,17 @@ s32 Audio_BuildSyntheticWave(Note* note, SequenceChannelLayer* seqLayer, s32 wav
|
|||
return sampleCountIndex;
|
||||
}
|
||||
|
||||
void Audio_InitSyntheticWave(Note* note, SequenceChannelLayer* seqLayer) {
|
||||
void Audio_InitSyntheticWave(Note* note, SequenceLayer* layer) {
|
||||
s32 sampleCountIndex;
|
||||
s32 waveSampleCountIndex;
|
||||
s32 waveId = seqLayer->instOrWave;
|
||||
s32 waveId = layer->instOrWave;
|
||||
|
||||
if (waveId == 0xFF) {
|
||||
waveId = seqLayer->seqChannel->instOrWave;
|
||||
waveId = layer->channel->instOrWave;
|
||||
}
|
||||
|
||||
sampleCountIndex = note->playbackState.sampleCountIndex;
|
||||
waveSampleCountIndex = Audio_BuildSyntheticWave(note, seqLayer, waveId);
|
||||
waveSampleCountIndex = Audio_BuildSyntheticWave(note, layer, waveId);
|
||||
|
||||
if (waveSampleCountIndex != sampleCountIndex) {
|
||||
note->noteSubEu.unk_06 = waveSampleCountIndex * 4 + sampleCountIndex;
|
||||
|
@ -603,10 +603,10 @@ void Audio_InitNoteFreeList(void) {
|
|||
s32 i;
|
||||
|
||||
Audio_InitNoteLists(&gAudioContext.noteFreeLists);
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
gAudioContext.notes[i].listItem.u.value = &gAudioContext.notes[i];
|
||||
gAudioContext.notes[i].listItem.prev = NULL;
|
||||
Audio_AudioListPushBack(&gAudioContext.noteFreeLists.disabled, &gAudioContext.notes[i].listItem);
|
||||
AudioSeq_AudioListPushBack(&gAudioContext.noteFreeLists.disabled, &gAudioContext.notes[i].listItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,7 @@ void Audio_NotePoolClear(NotePool* pool) {
|
|||
break;
|
||||
}
|
||||
Audio_AudioListRemove(cur);
|
||||
Audio_AudioListPushBack(dest, cur);
|
||||
AudioSeq_AudioListPushBack(dest, cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -687,11 +687,11 @@ void Audio_NotePoolFill(NotePool* pool, s32 count) {
|
|||
}
|
||||
|
||||
while (j < count) {
|
||||
note = Audio_AudioListPopBack(source);
|
||||
note = AudioSeq_AudioListPopBack(source);
|
||||
if (note == NULL) {
|
||||
break;
|
||||
}
|
||||
Audio_AudioListPushBack(dest, ¬e->listItem);
|
||||
AudioSeq_AudioListPushBack(dest, ¬e->listItem);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ void Audio_AudioListRemove(AudioListItem* item) {
|
|||
}
|
||||
}
|
||||
|
||||
Note* Audio_PopNodeWithValueLessEqual(AudioListItem* list, s32 limit) {
|
||||
Note* Audio_FindNodeWithPrioLessThan(AudioListItem* list, s32 limit) {
|
||||
AudioListItem* cur = list->next;
|
||||
AudioListItem* best;
|
||||
|
||||
|
@ -743,89 +743,90 @@ Note* Audio_PopNodeWithValueLessEqual(AudioListItem* list, s32 limit) {
|
|||
return best->u.value;
|
||||
}
|
||||
|
||||
void Audio_NoteInitForLayer(Note* note, SequenceChannelLayer* seqLayer) {
|
||||
void Audio_NoteInitForLayer(Note* note, SequenceLayer* layer) {
|
||||
s32 pad[3];
|
||||
s16 instId;
|
||||
NotePlaybackState* playback = ¬e->playbackState;
|
||||
NoteSubEu* sub = ¬e->noteSubEu;
|
||||
|
||||
note->playbackState.prevParentLayer = NO_LAYER;
|
||||
note->playbackState.parentLayer = seqLayer;
|
||||
playback->priority = seqLayer->seqChannel->notePriority;
|
||||
seqLayer->notePropertiesNeedInit = true;
|
||||
seqLayer->bit3 = true;
|
||||
seqLayer->note = note;
|
||||
seqLayer->seqChannel->noteUnused = note;
|
||||
seqLayer->seqChannel->layerUnused = seqLayer;
|
||||
seqLayer->noteVelocity = 0.0f;
|
||||
note->playbackState.parentLayer = layer;
|
||||
playback->priority = layer->channel->notePriority;
|
||||
layer->notePropertiesNeedInit = true;
|
||||
layer->bit3 = true;
|
||||
layer->note = note;
|
||||
layer->channel->noteUnused = note;
|
||||
layer->channel->layerUnused = layer;
|
||||
layer->noteVelocity = 0.0f;
|
||||
Audio_NoteInit(note);
|
||||
instId = seqLayer->instOrWave;
|
||||
instId = layer->instOrWave;
|
||||
|
||||
if (instId == 0xFF) {
|
||||
instId = seqLayer->seqChannel->instOrWave;
|
||||
instId = layer->channel->instOrWave;
|
||||
}
|
||||
sub->sound.audioBankSound = seqLayer->sound;
|
||||
sub->sound.soundFontSound = layer->sound;
|
||||
|
||||
if (instId >= 0x80 && instId < 0xC0) {
|
||||
sub->bitField1.s.isSyntheticWave = true;
|
||||
sub->bitField1.isSyntheticWave = true;
|
||||
} else {
|
||||
sub->bitField1.s.isSyntheticWave = false;
|
||||
sub->bitField1.isSyntheticWave = false;
|
||||
}
|
||||
|
||||
if (sub->bitField1.s.isSyntheticWave) {
|
||||
Audio_BuildSyntheticWave(note, seqLayer, instId);
|
||||
if (sub->bitField1.isSyntheticWave) {
|
||||
Audio_BuildSyntheticWave(note, layer, instId);
|
||||
}
|
||||
|
||||
playback->bankId = seqLayer->seqChannel->bankId;
|
||||
playback->stereoHeadsetEffects = seqLayer->seqChannel->stereoHeadsetEffects;
|
||||
sub->bitField1.s.reverbIndex = seqLayer->seqChannel->reverbIndex & 3;
|
||||
playback->fontId = layer->channel->fontId;
|
||||
playback->stereoHeadsetEffects = layer->channel->stereoHeadsetEffects;
|
||||
sub->bitField1.reverbIndex = layer->channel->reverbIndex & 3;
|
||||
}
|
||||
|
||||
void func_800E82C0(Note* note, SequenceChannelLayer* seqLayer) {
|
||||
Audio_SeqChanLayerNoteRelease(note->playbackState.parentLayer);
|
||||
note->playbackState.wantedParentLayer = seqLayer;
|
||||
void func_800E82C0(Note* note, SequenceLayer* layer) {
|
||||
// similar to Audio_NoteReleaseAndTakeOwnership, hard to say what the difference is
|
||||
Audio_SeqLayerNoteRelease(note->playbackState.parentLayer);
|
||||
note->playbackState.wantedParentLayer = layer;
|
||||
}
|
||||
|
||||
void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceChannelLayer* seqLayer) {
|
||||
note->playbackState.wantedParentLayer = seqLayer;
|
||||
note->playbackState.priority = seqLayer->seqChannel->notePriority;
|
||||
void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer) {
|
||||
note->playbackState.wantedParentLayer = layer;
|
||||
note->playbackState.priority = layer->channel->notePriority;
|
||||
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.action.s.release = true;
|
||||
}
|
||||
|
||||
Note* Audio_AllocNoteFromDisabled(NotePool* pool, SequenceChannelLayer* seqLayer) {
|
||||
Note* note = Audio_AudioListPopBack(&pool->disabled);
|
||||
Note* Audio_AllocNoteFromDisabled(NotePool* pool, SequenceLayer* layer) {
|
||||
Note* note = AudioSeq_AudioListPopBack(&pool->disabled);
|
||||
if (note != NULL) {
|
||||
Audio_NoteInitForLayer(note, seqLayer);
|
||||
Audio_NoteInitForLayer(note, layer);
|
||||
Audio_AudioListPushFront(&pool->active, ¬e->listItem);
|
||||
}
|
||||
return note;
|
||||
}
|
||||
|
||||
Note* Audio_AllocNoteFromDecaying(NotePool* pool, SequenceChannelLayer* seqLayer) {
|
||||
Note* note = Audio_AudioListPopBack(&pool->decaying);
|
||||
Note* Audio_AllocNoteFromDecaying(NotePool* pool, SequenceLayer* layer) {
|
||||
Note* note = AudioSeq_AudioListPopBack(&pool->decaying);
|
||||
if (note != NULL) {
|
||||
Audio_NoteReleaseAndTakeOwnership(note, seqLayer);
|
||||
Audio_AudioListPushBack(&pool->releasing, ¬e->listItem);
|
||||
Audio_NoteReleaseAndTakeOwnership(note, layer);
|
||||
AudioSeq_AudioListPushBack(&pool->releasing, ¬e->listItem);
|
||||
}
|
||||
return note;
|
||||
}
|
||||
|
||||
Note* Audio_AllocNoteFromActive(NotePool* pool, SequenceChannelLayer* seqLayer) {
|
||||
Note* Audio_AllocNoteFromActive(NotePool* pool, SequenceLayer* layer) {
|
||||
Note* rNote;
|
||||
Note* aNote;
|
||||
s32 rPriority;
|
||||
s32 aPriority;
|
||||
|
||||
rPriority = aPriority = 0x10;
|
||||
rNote = Audio_PopNodeWithValueLessEqual(&pool->releasing, seqLayer->seqChannel->notePriority);
|
||||
rNote = Audio_FindNodeWithPrioLessThan(&pool->releasing, layer->channel->notePriority);
|
||||
|
||||
if (rNote != NULL) {
|
||||
rPriority = rNote->playbackState.priority;
|
||||
}
|
||||
|
||||
aNote = Audio_PopNodeWithValueLessEqual(&pool->active, seqLayer->seqChannel->notePriority);
|
||||
aNote = Audio_FindNodeWithPrioLessThan(&pool->active, layer->channel->notePriority);
|
||||
|
||||
if (aNote != NULL) {
|
||||
aPriority = aNote->playbackState.priority;
|
||||
|
@ -837,76 +838,76 @@ Note* Audio_AllocNoteFromActive(NotePool* pool, SequenceChannelLayer* seqLayer)
|
|||
|
||||
if (aPriority < rPriority) {
|
||||
Audio_AudioListRemove(&aNote->listItem);
|
||||
func_800E82C0(aNote, seqLayer);
|
||||
Audio_AudioListPushBack(&pool->releasing, &aNote->listItem);
|
||||
aNote->playbackState.priority = seqLayer->seqChannel->notePriority;
|
||||
func_800E82C0(aNote, layer);
|
||||
AudioSeq_AudioListPushBack(&pool->releasing, &aNote->listItem);
|
||||
aNote->playbackState.priority = layer->channel->notePriority;
|
||||
return aNote;
|
||||
}
|
||||
rNote->playbackState.wantedParentLayer = seqLayer;
|
||||
rNote->playbackState.priority = seqLayer->seqChannel->notePriority;
|
||||
rNote->playbackState.wantedParentLayer = layer;
|
||||
rNote->playbackState.priority = layer->channel->notePriority;
|
||||
return rNote;
|
||||
}
|
||||
|
||||
Note* Audio_AllocNote(SequenceChannelLayer* seqLayer) {
|
||||
Note* Audio_AllocNote(SequenceLayer* layer) {
|
||||
Note* ret;
|
||||
u32 policy = seqLayer->seqChannel->noteAllocPolicy;
|
||||
u32 policy = layer->channel->noteAllocPolicy;
|
||||
|
||||
if (policy & 1) {
|
||||
ret = seqLayer->note;
|
||||
if (ret != NULL && ret->playbackState.prevParentLayer == seqLayer &&
|
||||
ret = layer->note;
|
||||
if (ret != NULL && ret->playbackState.prevParentLayer == layer &&
|
||||
ret->playbackState.wantedParentLayer == NO_LAYER) {
|
||||
Audio_NoteReleaseAndTakeOwnership(ret, seqLayer);
|
||||
Audio_NoteReleaseAndTakeOwnership(ret, layer);
|
||||
Audio_AudioListRemove(&ret->listItem);
|
||||
Audio_AudioListPushBack(&ret->listItem.pool->releasing, &ret->listItem);
|
||||
AudioSeq_AudioListPushBack(&ret->listItem.pool->releasing, &ret->listItem);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (policy & 2) {
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&seqLayer->seqChannel->notePool, seqLayer))) {
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&layer->channel->notePool, layer))) {
|
||||
goto null_return;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (policy & 4) {
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDisabled(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer))) {
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer))) {
|
||||
goto null_return;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (policy & 8) {
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, seqLayer))) {
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, layer))) {
|
||||
goto null_return;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDisabled(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&seqLayer->seqChannel->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&seqLayer->seqChannel->seqPlayer->notePool, seqLayer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, seqLayer))) {
|
||||
if (!(ret = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(ret = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, layer))) {
|
||||
goto null_return;
|
||||
}
|
||||
return ret;
|
||||
|
||||
null_return:
|
||||
seqLayer->bit3 = true;
|
||||
layer->bit3 = true;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -914,7 +915,7 @@ void Audio_NoteInitAll(void) {
|
|||
Note* note;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
note = &gAudioContext.notes[i];
|
||||
note->noteSubEu = gZeroNoteSub;
|
||||
note->playbackState.priority = 0;
|
||||
|
@ -924,13 +925,13 @@ void Audio_NoteInitAll(void) {
|
|||
note->playbackState.prevParentLayer = NO_LAYER;
|
||||
note->playbackState.waveId = 0;
|
||||
note->playbackState.attributes.velocity = 0.0f;
|
||||
note->playbackState.adsrVolScale = 0;
|
||||
note->playbackState.adsrVolScaleUnused = 0;
|
||||
note->playbackState.adsr.action.asByte = 0;
|
||||
note->vibratoState.active = 0;
|
||||
note->portamento.cur = 0;
|
||||
note->portamento.speed = 0;
|
||||
note->playbackState.stereoHeadsetEffects = false;
|
||||
note->unk_BC = 0;
|
||||
note->synthesisState.synthesisBuffers = Audio_AllocDmaMemory(&gAudioContext.notesAndBuffersPool, 0x1E0);
|
||||
note->synthesisState.synthesisBuffers = AudioHeap_AllocDmaMemory(&gAudioContext.notesAndBuffersPool, 0x1E0);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -112,14 +112,14 @@ void func_800DB03C(s32 arg0) {
|
|||
s32 baseIndex;
|
||||
s32 i;
|
||||
|
||||
baseIndex = gAudioContext.maxSimultaneousNotes * arg0;
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
baseIndex = gAudioContext.numNotes * arg0;
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
subEu = &gAudioContext.notes[i].noteSubEu;
|
||||
subEu2 = &gAudioContext.noteSubsEu[baseIndex + i];
|
||||
if (subEu->bitField0.s.enabled) {
|
||||
subEu->bitField0.s.needsInit = false;
|
||||
if (subEu->bitField0.enabled) {
|
||||
subEu->bitField0.needsInit = false;
|
||||
} else {
|
||||
subEu2->bitField0.s.enabled = false;
|
||||
subEu2->bitField0.enabled = false;
|
||||
}
|
||||
|
||||
subEu->unk_06 = 0;
|
||||
|
@ -136,7 +136,7 @@ Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen)
|
|||
|
||||
cmdP = cmdStart;
|
||||
for (i = gAudioContext.audioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
Audio_ProcessSequences(i - 1);
|
||||
AudioSeq_ProcessSequences(i - 1);
|
||||
func_800DB03C(gAudioContext.audioBufferParameters.updatesPerFrame - i);
|
||||
}
|
||||
|
||||
|
@ -181,9 +181,9 @@ void func_800DB2C0(s32 updateIndexStart, s32 noteIndex) {
|
|||
s32 i;
|
||||
|
||||
for (i = updateIndexStart + 1; i < gAudioContext.audioBufferParameters.updatesPerFrame; i++) {
|
||||
temp_v1 = &gAudioContext.noteSubsEu[(gAudioContext.maxSimultaneousNotes * i) + noteIndex];
|
||||
if (!temp_v1->bitField0.s.needsInit) {
|
||||
temp_v1->bitField0.s.enabled = 0;
|
||||
temp_v1 = &gAudioContext.noteSubsEu[(gAudioContext.numNotes * i) + noteIndex];
|
||||
if (!temp_v1->bitField0.needsInit) {
|
||||
temp_v1->bitField0.enabled = 0;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -442,11 +442,11 @@ void func_800DBE64(void) {
|
|||
void func_800DBE6C(void) {
|
||||
}
|
||||
|
||||
void AudioSynth_SetFilter(Acmd* cmd, s32 flags, s32 countOrBuf, s32 addr) {
|
||||
void AudioSynth_LoadFilter(Acmd* cmd, s32 flags, s32 countOrBuf, s32 addr) {
|
||||
aFilter(cmd, flags, countOrBuf, addr);
|
||||
}
|
||||
|
||||
void AudioSynth_SetFilterCount(Acmd* cmd, s32 count, s32 addr) {
|
||||
void AudioSynth_LoadFilterCount(Acmd* cmd, s32 count, s32 addr) {
|
||||
aFilter(cmd, 2, count, addr);
|
||||
}
|
||||
|
||||
|
@ -563,28 +563,27 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
NoteSubEu* noteSubEu2;
|
||||
s32 unk14;
|
||||
|
||||
t = gAudioContext.maxSimultaneousNotes * updateIndex;
|
||||
t = gAudioContext.numNotes * updateIndex;
|
||||
count = 0;
|
||||
if (gAudioContext.numSynthesisReverbs == 0) {
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.noteSubsEu[t + i].bitField0.s.enabled) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
if (gAudioContext.noteSubsEu[t + i].bitField0.enabled) {
|
||||
noteIndices[count++] = i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) {
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
noteSubEu = &gAudioContext.noteSubsEu[t + i];
|
||||
if (noteSubEu->bitField0.s.enabled && noteSubEu->bitField1.s.reverbIndex == reverbIndex) {
|
||||
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex == reverbIndex) {
|
||||
noteIndices[count++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
noteSubEu = &gAudioContext.noteSubsEu[t + i];
|
||||
if (noteSubEu->bitField0.s.enabled &&
|
||||
noteSubEu->bitField1.s.reverbIndex >= gAudioContext.numSynthesisReverbs) {
|
||||
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex >= gAudioContext.numSynthesisReverbs) {
|
||||
noteIndices[count++] = i;
|
||||
}
|
||||
}
|
||||
|
@ -620,7 +619,7 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
|
||||
while (i < count) {
|
||||
noteSubEu2 = &gAudioContext.noteSubsEu[noteIndices[i] + t];
|
||||
if (noteSubEu2->bitField1.s.reverbIndex == reverbIndex) {
|
||||
if (noteSubEu2->bitField1.reverbIndex == reverbIndex) {
|
||||
cmd = AudioSynth_ProcessNote(noteIndices[i], noteSubEu2,
|
||||
&gAudioContext.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd,
|
||||
updateIndex);
|
||||
|
@ -662,43 +661,43 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisState* synthState, s16* aiBuf,
|
||||
s32 aiBufLen, Acmd* cmd, s32 updateIndex) {
|
||||
s32 pad1[3];
|
||||
AudioBankSample* audioBankSample;
|
||||
SoundFontSample* audioFontSample;
|
||||
AdpcmLoop* loopInfo;
|
||||
s32 samplesRemaining;
|
||||
s32 nSamplesUntilLoopEnd;
|
||||
s32 nSamplesInThisIteration;
|
||||
s32 noteFinished;
|
||||
s32 restart;
|
||||
s32 flags;
|
||||
u16 resamplingRateFixedPoint;
|
||||
s32 phi_s6;
|
||||
s32 phi_s7;
|
||||
s32 nSamplesInFirstFrame;
|
||||
s32 nTrailingSamplesToIgnore;
|
||||
s32 phi_a1_2;
|
||||
s32 temp_v1_5;
|
||||
s32 sp120;
|
||||
s32 frameIndex;
|
||||
s32 skipBytes;
|
||||
s32 temp_v1_6;
|
||||
void* buf;
|
||||
s32 phi_s0;
|
||||
s32 sampleAddr;
|
||||
s32 nSamplesToDecode;
|
||||
u32 sampleAddr;
|
||||
u32 samplesLenFixedPoint;
|
||||
s32 samplesLenAdjusted;
|
||||
s32 nAdpcmSamplesProcessed;
|
||||
s32 endPos;
|
||||
s32 nSamplesProcessed;
|
||||
s32 loopEndPos;
|
||||
s32 nSamplesToProcess;
|
||||
s32 phi_s4;
|
||||
s32 phi_s3;
|
||||
s32 nFirstFrameSamplesToIgnore;
|
||||
s32 pad2[7];
|
||||
s32 spD4;
|
||||
s32 phi_s1;
|
||||
s32 spCC;
|
||||
s32 spC8;
|
||||
u8* phi_a1;
|
||||
s32 frameSize;
|
||||
s32 nFramesToDecode;
|
||||
s32 skipInitialSamples;
|
||||
s32 sampleDataStart;
|
||||
u8* sampleData;
|
||||
s32 nParts;
|
||||
s32 curPart;
|
||||
s32 phi_t0;
|
||||
s32 sampleDataStartPad;
|
||||
s32 side;
|
||||
s32 resampledTempLen;
|
||||
u16 noteSamplesDmemAddrBeforeResampling;
|
||||
s32 temp_mult;
|
||||
s32 sampleDataOffset;
|
||||
s32 thing;
|
||||
s32 s5;
|
||||
Note* note;
|
||||
|
@ -712,12 +711,12 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
s16 addr;
|
||||
u16 unused;
|
||||
|
||||
bookOffset = noteSubEu->bitField1.s.bookOffset;
|
||||
finished = noteSubEu->bitField0.s.finished;
|
||||
bookOffset = noteSubEu->bitField1.bookOffset;
|
||||
finished = noteSubEu->bitField0.finished;
|
||||
note = &gAudioContext.notes[noteIndex];
|
||||
flags = A_CONTINUE;
|
||||
|
||||
if (noteSubEu->bitField0.s.needsInit == true) {
|
||||
if (noteSubEu->bitField0.needsInit == true) {
|
||||
flags = A_INIT;
|
||||
synthState->restart = 0;
|
||||
synthState->samplePosInt = note->unk_BC;
|
||||
|
@ -727,42 +726,40 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
synthState->prevHeadsetPanRight = 0;
|
||||
synthState->prevHeadsetPanLeft = 0;
|
||||
synthState->reverbVol = noteSubEu->reverbVol;
|
||||
synthState->numAdpcmParts = 0;
|
||||
synthState->numParts = 0;
|
||||
synthState->unk_1A = 1;
|
||||
note->noteSubEu.bitField0.s.finished = false;
|
||||
note->noteSubEu.bitField0.finished = false;
|
||||
finished = false;
|
||||
}
|
||||
|
||||
resamplingRateFixedPoint = noteSubEu->resamplingRateFixedPoint;
|
||||
nParts = noteSubEu->bitField1.s.hasTwoAdpcmParts + 1;
|
||||
nParts = noteSubEu->bitField1.hasTwoParts + 1;
|
||||
samplesLenFixedPoint = (resamplingRateFixedPoint * aiBufLen * 2) + synthState->samplePosFrac;
|
||||
nSamplesToLoad = samplesLenFixedPoint >> 16;
|
||||
synthState->samplePosFrac = samplesLenFixedPoint & 0xFFFF;
|
||||
|
||||
// Partially-optimized out no-op ifs required for matching. SM64 decomp
|
||||
// makes it clear that this is how it should look.
|
||||
if (synthState->numAdpcmParts == 1 && nParts == 2) {
|
||||
} else if (synthState->numAdpcmParts == 2 && nParts == 1) {
|
||||
if (synthState->numParts == 1 && nParts == 2) {
|
||||
} else if (synthState->numParts == 2 && nParts == 1) {
|
||||
} else {
|
||||
}
|
||||
|
||||
synthState->numAdpcmParts = nParts;
|
||||
synthState->numParts = nParts;
|
||||
|
||||
if (noteSubEu->bitField1.s.isSyntheticWave) {
|
||||
if (noteSubEu->bitField1.isSyntheticWave) {
|
||||
cmd = AudioSynth_LoadWaveSamples(cmd, noteSubEu, synthState, nSamplesToLoad);
|
||||
noteSamplesDmemAddrBeforeResampling = DMEM_UNCOMPRESSED_NOTE + (synthState->samplePosInt * 2);
|
||||
synthState->samplePosInt += nSamplesToLoad;
|
||||
} else {
|
||||
// ADPCM note
|
||||
audioBankSample = noteSubEu->sound.audioBankSound->sample;
|
||||
loopInfo = audioBankSample->loop;
|
||||
endPos = loopInfo->end;
|
||||
sampleAddr = audioBankSample->sampleAddr;
|
||||
audioFontSample = noteSubEu->sound.soundFontSound->sample;
|
||||
loopInfo = audioFontSample->loop;
|
||||
loopEndPos = loopInfo->end;
|
||||
sampleAddr = audioFontSample->sampleAddr;
|
||||
resampledTempLen = 0;
|
||||
|
||||
for (curPart = 0; curPart < nParts; curPart++) {
|
||||
// reordering in the loop prelude
|
||||
nAdpcmSamplesProcessed = 0;
|
||||
nSamplesProcessed = 0;
|
||||
s5 = 0;
|
||||
|
||||
if (nParts == 1) {
|
||||
|
@ -773,8 +770,8 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
samplesLenAdjusted = nSamplesToLoad;
|
||||
}
|
||||
|
||||
if (audioBankSample->codec == 0 || audioBankSample->codec == 3) {
|
||||
if (gAudioContext.curLoadedBook != (*audioBankSample->book).book) {
|
||||
if (audioFontSample->codec == CODEC_ADPCM || audioFontSample->codec == CODEC_SMALL_ADPCM) {
|
||||
if (gAudioContext.curLoadedBook != audioFontSample->book->book) {
|
||||
u32 nEntries;
|
||||
switch (bookOffset) {
|
||||
case 1:
|
||||
|
@ -783,43 +780,43 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
gAudioContext.curLoadedBook = (*audioBankSample->book).book;
|
||||
gAudioContext.curLoadedBook = audioFontSample->book->book;
|
||||
break;
|
||||
}
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
nEntries = 16 * audioBankSample->book->order * audioBankSample->book->npredictors;
|
||||
nEntries = 16 * audioFontSample->book->order * audioFontSample->book->npredictors;
|
||||
aLoadADPCM(cmd++, nEntries, gAudioContext.curLoadedBook);
|
||||
}
|
||||
}
|
||||
|
||||
while (nAdpcmSamplesProcessed != samplesLenAdjusted) {
|
||||
while (nSamplesProcessed != samplesLenAdjusted) {
|
||||
noteFinished = false;
|
||||
restart = false;
|
||||
phi_s4 = 0;
|
||||
|
||||
phi_s3 = synthState->samplePosInt & 0xF;
|
||||
samplesRemaining = endPos - synthState->samplePosInt;
|
||||
nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed;
|
||||
nFirstFrameSamplesToIgnore = synthState->samplePosInt & 0xF;
|
||||
nSamplesUntilLoopEnd = loopEndPos - synthState->samplePosInt;
|
||||
nSamplesToProcess = samplesLenAdjusted - nSamplesProcessed;
|
||||
|
||||
if (phi_s3 == 0 && synthState->restart == false) {
|
||||
phi_s3 = 16;
|
||||
if (nFirstFrameSamplesToIgnore == 0 && !synthState->restart) {
|
||||
nFirstFrameSamplesToIgnore = 16;
|
||||
}
|
||||
phi_s6 = 16 - phi_s3;
|
||||
nSamplesInFirstFrame = 16 - nFirstFrameSamplesToIgnore;
|
||||
|
||||
if (nSamplesToProcess < samplesRemaining) {
|
||||
phi_s1 = (s32)(nSamplesToProcess - phi_s6 + 15) / 16;
|
||||
phi_s0 = phi_s1 * 16;
|
||||
phi_s7 = phi_s6 + phi_s0 - nSamplesToProcess;
|
||||
if (nSamplesToProcess < nSamplesUntilLoopEnd) {
|
||||
nFramesToDecode = (s32)(nSamplesToProcess - nSamplesInFirstFrame + 15) / 16;
|
||||
nSamplesToDecode = nFramesToDecode * 16;
|
||||
nTrailingSamplesToIgnore = nSamplesInFirstFrame + nSamplesToDecode - nSamplesToProcess;
|
||||
} else {
|
||||
phi_s0 = samplesRemaining - phi_s6;
|
||||
phi_s7 = 0;
|
||||
if (phi_s0 <= 0) {
|
||||
phi_s0 = 0;
|
||||
phi_s6 = samplesRemaining;
|
||||
nSamplesToDecode = nSamplesUntilLoopEnd - nSamplesInFirstFrame;
|
||||
nTrailingSamplesToIgnore = 0;
|
||||
if (nSamplesToDecode <= 0) {
|
||||
nSamplesToDecode = 0;
|
||||
nSamplesInFirstFrame = nSamplesUntilLoopEnd;
|
||||
}
|
||||
phi_s1 = (phi_s0 + 15) / 16;
|
||||
nFramesToDecode = (nSamplesToDecode + 15) / 16;
|
||||
if (loopInfo->count != 0) {
|
||||
// Loop around and restart
|
||||
restart = true;
|
||||
|
@ -828,111 +825,114 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
}
|
||||
}
|
||||
|
||||
switch (audioBankSample->codec) {
|
||||
switch (audioFontSample->codec) {
|
||||
case CODEC_ADPCM:
|
||||
spD4 = 9;
|
||||
spCC = 0x10;
|
||||
spC8 = 0;
|
||||
frameSize = 9;
|
||||
skipInitialSamples = 16;
|
||||
sampleDataStart = 0;
|
||||
break;
|
||||
case 3:
|
||||
spD4 = 5;
|
||||
spCC = 0x10;
|
||||
spC8 = 0;
|
||||
case CODEC_SMALL_ADPCM:
|
||||
frameSize = 5;
|
||||
skipInitialSamples = 16;
|
||||
sampleDataStart = 0;
|
||||
break;
|
||||
case CODEC_S8:
|
||||
spD4 = 0x10;
|
||||
spCC = 0x10;
|
||||
spC8 = 0;
|
||||
frameSize = 16;
|
||||
skipInitialSamples = 16;
|
||||
sampleDataStart = 0;
|
||||
break;
|
||||
case 2:
|
||||
case CODEC_S16_INMEMORY:
|
||||
AudioSynth_ClearBuffer(cmd++, DMEM_UNCOMPRESSED_NOTE, (samplesLenAdjusted * 2) + 0x20);
|
||||
flags = A_CONTINUE;
|
||||
sp120 = 0;
|
||||
nAdpcmSamplesProcessed = samplesLenAdjusted;
|
||||
skipBytes = 0;
|
||||
nSamplesProcessed = samplesLenAdjusted;
|
||||
s5 = samplesLenAdjusted;
|
||||
goto skip;
|
||||
case 5:
|
||||
case CODEC_S16:
|
||||
AudioSynth_ClearBuffer(cmd++, DMEM_UNCOMPRESSED_NOTE, (samplesLenAdjusted * 2) + 0x20);
|
||||
flags = A_CONTINUE;
|
||||
sp120 = 0;
|
||||
nAdpcmSamplesProcessed = samplesLenAdjusted;
|
||||
skipBytes = 0;
|
||||
nSamplesProcessed = samplesLenAdjusted;
|
||||
s5 = samplesLenAdjusted;
|
||||
goto skip;
|
||||
case 4:
|
||||
case CODEC_REVERB:
|
||||
break;
|
||||
}
|
||||
|
||||
if (phi_s1 != 0) {
|
||||
temp_v1_5 = (synthState->samplePosInt + spCC - phi_s3) / 16;
|
||||
temp_mult = (temp_v1_5 * spD4);
|
||||
if (audioBankSample->medium == 0) {
|
||||
phi_a1 = spC8 + temp_mult + sampleAddr;
|
||||
} else if (audioBankSample->medium == 1) {
|
||||
if (nFramesToDecode != 0) {
|
||||
frameIndex = (synthState->samplePosInt + skipInitialSamples - nFirstFrameSamplesToIgnore) / 16;
|
||||
sampleDataOffset = frameIndex * frameSize;
|
||||
if (audioFontSample->medium == MEDIUM_RAM) {
|
||||
sampleData = (u8*)(sampleDataStart + sampleDataOffset + sampleAddr);
|
||||
} else if (audioFontSample->medium == MEDIUM_UNK) {
|
||||
return cmd;
|
||||
} else {
|
||||
phi_a1 =
|
||||
Audio_DmaSampleData((u32)(spC8 + temp_mult + sampleAddr), ALIGN16((phi_s1 * spD4) + 0x10),
|
||||
flags, &synthState->sampleDmaIndex, audioBankSample->medium);
|
||||
sampleData = AudioLoad_DmaSampleData(sampleDataStart + sampleDataOffset + sampleAddr,
|
||||
ALIGN16((nFramesToDecode * frameSize) + 0x10), flags,
|
||||
&synthState->sampleDmaIndex, audioFontSample->medium);
|
||||
}
|
||||
|
||||
if (phi_a1 == NULL) {
|
||||
if (sampleData == NULL) {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
phi_t0 = (u32)phi_a1 & 0xF;
|
||||
aligned = ALIGN16((phi_s1 * spD4) + 16);
|
||||
sampleDataStartPad = (u32)sampleData & 0xF;
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 16);
|
||||
addr = DMEM_COMPRESSED_ADPCM_DATA - aligned;
|
||||
aLoadBuffer(cmd++, phi_a1 - phi_t0, addr, aligned);
|
||||
aLoadBuffer(cmd++, sampleData - sampleDataStartPad, addr, aligned);
|
||||
} else {
|
||||
phi_s0 = 0;
|
||||
phi_t0 = 0;
|
||||
nSamplesToDecode = 0;
|
||||
sampleDataStartPad = 0;
|
||||
}
|
||||
|
||||
if (synthState->restart) {
|
||||
aSetLoop(cmd++, audioBankSample->loop->state);
|
||||
aSetLoop(cmd++, audioFontSample->loop->state);
|
||||
flags = A_LOOP;
|
||||
synthState->restart = false;
|
||||
}
|
||||
|
||||
nSamplesInThisIteration = phi_s0 + phi_s6 - phi_s7;
|
||||
if (nAdpcmSamplesProcessed == 0) {
|
||||
nSamplesInThisIteration = nSamplesToDecode + nSamplesInFirstFrame - nTrailingSamplesToIgnore;
|
||||
if (nSamplesProcessed == 0) {
|
||||
if (1) {}
|
||||
sp120 = phi_s3 * 2;
|
||||
skipBytes = nFirstFrameSamplesToIgnore * 2;
|
||||
} else {
|
||||
phi_s4 = ALIGN16(s5 + 16);
|
||||
}
|
||||
switch (audioBankSample->codec) {
|
||||
switch (audioFontSample->codec) {
|
||||
case CODEC_ADPCM:
|
||||
aligned = ALIGN16((phi_s1 * spD4) + 0x10);
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
|
||||
addr = DMEM_COMPRESSED_ADPCM_DATA - aligned;
|
||||
aSetBuffer(cmd++, 0, addr + phi_t0, DMEM_UNCOMPRESSED_NOTE + phi_s4, phi_s0 * 2);
|
||||
aSetBuffer(cmd++, 0, addr + sampleDataStartPad, DMEM_UNCOMPRESSED_NOTE + phi_s4,
|
||||
nSamplesToDecode * 2);
|
||||
aADPCMdec(cmd++, flags, synthState->synthesisBuffers->adpcmdecState);
|
||||
break;
|
||||
case 3:
|
||||
aligned = ALIGN16((phi_s1 * spD4) + 0x10);
|
||||
case CODEC_SMALL_ADPCM:
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
|
||||
addr = DMEM_COMPRESSED_ADPCM_DATA - aligned;
|
||||
aSetBuffer(cmd++, 0, addr + phi_t0, DMEM_UNCOMPRESSED_NOTE + phi_s4, phi_s0 * 2);
|
||||
aSetBuffer(cmd++, 0, addr + sampleDataStartPad, DMEM_UNCOMPRESSED_NOTE + phi_s4,
|
||||
nSamplesToDecode * 2);
|
||||
aADPCMdec(cmd++, flags | 4, synthState->synthesisBuffers->adpcmdecState);
|
||||
break;
|
||||
case CODEC_S8:
|
||||
aligned = ALIGN16((phi_s1 * spD4) + 0x10);
|
||||
aligned = ALIGN16((nFramesToDecode * frameSize) + 0x10);
|
||||
addr = DMEM_COMPRESSED_ADPCM_DATA - aligned;
|
||||
AudioSynth_SetBuffer(cmd++, 0, addr + phi_t0, DMEM_UNCOMPRESSED_NOTE + phi_s4, phi_s0 * 2);
|
||||
AudioSynth_SetBuffer(cmd++, 0, addr + sampleDataStartPad, DMEM_UNCOMPRESSED_NOTE + phi_s4,
|
||||
nSamplesToDecode * 2);
|
||||
AudioSynth_S8Dec(cmd++, flags, synthState->synthesisBuffers->adpcmdecState);
|
||||
break;
|
||||
}
|
||||
|
||||
if (nAdpcmSamplesProcessed != 0) {
|
||||
aDMEMMove(cmd++, DMEM_UNCOMPRESSED_NOTE + phi_s4 + (phi_s3 * 2), DMEM_UNCOMPRESSED_NOTE + s5,
|
||||
nSamplesInThisIteration * 2);
|
||||
if (nSamplesProcessed != 0) {
|
||||
aDMEMMove(cmd++, DMEM_UNCOMPRESSED_NOTE + phi_s4 + (nFirstFrameSamplesToIgnore * 2),
|
||||
DMEM_UNCOMPRESSED_NOTE + s5, nSamplesInThisIteration * 2);
|
||||
}
|
||||
|
||||
nAdpcmSamplesProcessed += nSamplesInThisIteration;
|
||||
nSamplesProcessed += nSamplesInThisIteration;
|
||||
|
||||
switch (flags) {
|
||||
case A_INIT:
|
||||
sp120 = 0x20;
|
||||
s5 = (phi_s0 + 0x10) * 2;
|
||||
skipBytes = 0x20;
|
||||
s5 = (nSamplesToDecode + 0x10) * 2;
|
||||
break;
|
||||
case A_LOOP:
|
||||
s5 = nSamplesInThisIteration * 2 + s5;
|
||||
|
@ -941,7 +941,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
if (s5 != 0) {
|
||||
s5 = nSamplesInThisIteration * 2 + s5;
|
||||
} else {
|
||||
s5 = (phi_s3 + nSamplesInThisIteration) * 2;
|
||||
s5 = (nFirstFrameSamplesToIgnore + nSamplesInThisIteration) * 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -951,9 +951,9 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
skip:
|
||||
if (noteFinished) {
|
||||
AudioSynth_ClearBuffer(cmd++, DMEM_UNCOMPRESSED_NOTE + s5,
|
||||
(samplesLenAdjusted - nAdpcmSamplesProcessed) * 2);
|
||||
(samplesLenAdjusted - nSamplesProcessed) * 2);
|
||||
finished = true;
|
||||
note->noteSubEu.bitField0.s.finished = true;
|
||||
note->noteSubEu.bitField0.finished = true;
|
||||
func_800DB2C0(updateIndex, noteIndex);
|
||||
break;
|
||||
} else {
|
||||
|
@ -968,12 +968,12 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
|
||||
switch (nParts) {
|
||||
case 1:
|
||||
noteSamplesDmemAddrBeforeResampling = DMEM_UNCOMPRESSED_NOTE + sp120;
|
||||
noteSamplesDmemAddrBeforeResampling = DMEM_UNCOMPRESSED_NOTE + skipBytes;
|
||||
break;
|
||||
case 2:
|
||||
switch (curPart) {
|
||||
case 0:
|
||||
AudioSynth_InterL(cmd++, DMEM_UNCOMPRESSED_NOTE + sp120, DMEM_TEMP + 0x20,
|
||||
AudioSynth_InterL(cmd++, DMEM_UNCOMPRESSED_NOTE + skipBytes, DMEM_TEMP + 0x20,
|
||||
((samplesLenAdjusted / 2) + 7) & ~7);
|
||||
resampledTempLen = samplesLenAdjusted;
|
||||
noteSamplesDmemAddrBeforeResampling = DMEM_TEMP + 0x20;
|
||||
|
@ -983,7 +983,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
AudioSynth_InterL(cmd++, DMEM_UNCOMPRESSED_NOTE + sp120,
|
||||
AudioSynth_InterL(cmd++, DMEM_UNCOMPRESSED_NOTE + skipBytes,
|
||||
DMEM_TEMP + 0x20 + resampledTempLen, ((samplesLenAdjusted / 2) + 7) & ~7);
|
||||
break;
|
||||
}
|
||||
|
@ -995,8 +995,8 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
}
|
||||
|
||||
flags = A_CONTINUE;
|
||||
if (noteSubEu->bitField0.s.needsInit == true) {
|
||||
noteSubEu->bitField0.s.needsInit = false;
|
||||
if (noteSubEu->bitField0.needsInit == true) {
|
||||
noteSubEu->bitField0.needsInit = false;
|
||||
flags = A_INIT;
|
||||
}
|
||||
|
||||
|
@ -1020,8 +1020,8 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
|
||||
filter = noteSubEu->filter;
|
||||
if (filter != 0) {
|
||||
AudioSynth_SetFilterCount(cmd++, aiBufLen * 2, filter);
|
||||
AudioSynth_SetFilter(cmd++, flags, DMEM_TEMP, synthState->synthesisBuffers->mixEnvelopeState);
|
||||
AudioSynth_LoadFilterCount(cmd++, aiBufLen * 2, filter);
|
||||
AudioSynth_LoadFilter(cmd++, flags, DMEM_TEMP, synthState->synthesisBuffers->mixEnvelopeState);
|
||||
}
|
||||
|
||||
unk7 = noteSubEu->unk_07;
|
||||
|
@ -1051,7 +1051,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
side = 0;
|
||||
}
|
||||
cmd = AudioSynth_ProcessEnvelope(cmd, noteSubEu, synthState, aiBufLen, DMEM_TEMP, side, flags);
|
||||
if (noteSubEu->bitField1.s.usesHeadsetPanEffects2) {
|
||||
if (noteSubEu->bitField1.usesHeadsetPanEffects2) {
|
||||
if (!(flags & A_INIT)) {
|
||||
flags = A_CONTINUE;
|
||||
}
|
||||
|
@ -1118,7 +1118,7 @@ Acmd* AudioSynth_ProcessEnvelope(Acmd* cmd, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
synthState->curVolLeft = curVolLeft + (rampLeft * (aiBufLen >> 3));
|
||||
synthState->curVolRight = curVolRight + (rampRight * (aiBufLen >> 3));
|
||||
|
||||
if (noteSubEu->bitField1.s.usesHeadsetPanEffects2) {
|
||||
if (noteSubEu->bitField1.usesHeadsetPanEffects2) {
|
||||
AudioSynth_ClearBuffer(cmd++, DMEM_NOTE_PAN_TEMP, DEFAULT_LEN_1CH);
|
||||
AudioSynth_EnvSetup1(cmd++, phi_t1 * 2, rampReverb, rampLeft, rampRight);
|
||||
AudioSynth_EnvSetup2(cmd++, curVolLeft, curVolRight);
|
||||
|
@ -1139,9 +1139,9 @@ Acmd* AudioSynth_ProcessEnvelope(Acmd* cmd, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
phi_a1 = D_801304AC;
|
||||
}
|
||||
|
||||
aEnvMixer(cmd++, inBuf, aiBufLen, (sourceReverbVol & 0x80) >> 7, noteSubEu->bitField0.s.stereoHeadsetEffects,
|
||||
noteSubEu->bitField0.s.usesHeadsetPanEffects, noteSubEu->bitField0.s.stereoStrongRight,
|
||||
noteSubEu->bitField0.s.stereoStrongLeft, phi_a1, D_801304A0);
|
||||
aEnvMixer(cmd++, inBuf, aiBufLen, (sourceReverbVol & 0x80) >> 7, noteSubEu->bitField0.stereoHeadsetEffects,
|
||||
noteSubEu->bitField0.usesHeadsetPanEffects, noteSubEu->bitField0.stereoStrongRight,
|
||||
noteSubEu->bitField0.stereoStrongLeft, phi_a1, D_801304A0);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ Acmd* AudioSynth_LoadWaveSamples(Acmd* cmd, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
s32 samplePosInt = synthState->samplePosInt;
|
||||
s32 repeats;
|
||||
|
||||
if (noteSubEu->bitField1.s.bookOffset != 0) {
|
||||
if (noteSubEu->bitField1.bookOffset != 0) {
|
||||
AudioSynth_LoadBuffer(cmd++, DMEM_UNCOMPRESSED_NOTE, ALIGN16(nSamplesToLoad * 2), gWaveSamples[8]);
|
||||
gWaveSamples[8] += nSamplesToLoad * 2;
|
||||
return cmd;
|
||||
|
|
|
@ -16,7 +16,7 @@ void func_8006BA30(GlobalContext* globalCtx) {
|
|||
for (i = 0; i < ARRAY_COUNT(globalCtx->soundSources); i++) {
|
||||
if (source->countdown != 0) {
|
||||
if (DECR(source->countdown) == 0) {
|
||||
func_800F89E8(&source->relativePos);
|
||||
Audio_StopSfxByPos(&source->relativePos);
|
||||
} else {
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->mf_11D60, &source->originPos, &source->relativePos);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* pos, s32 duratio
|
|||
|
||||
if (i >= ARRAY_COUNT(globalCtx->soundSources)) {
|
||||
source = backupSource;
|
||||
func_800F89E8(&source->relativePos);
|
||||
Audio_StopSfxByPos(&source->relativePos);
|
||||
}
|
||||
|
||||
source->originPos = *pos;
|
||||
|
|
|
@ -8,6 +8,6 @@ void func_800C3C20(void) {
|
|||
s32 i;
|
||||
|
||||
for (i = 0; (i < ARRAY_COUNT(D_8012D200)) & 0xFFFFFFFF; i++) {
|
||||
func_800F87A0(D_8012D200[i]);
|
||||
Audio_StopSfxByBank(D_8012D200[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,12 +107,12 @@ AudioTask* func_800E5000(void) {
|
|||
}
|
||||
|
||||
gAudioContext.curAudioFrameDmaCount = 0;
|
||||
func_800E11F0();
|
||||
Audio_ProcessLoads(gAudioContext.resetStatus);
|
||||
func_800E4F58();
|
||||
AudioLoad_DecreaseSampleDmaTtls();
|
||||
AudioLoad_ProcessLoads(gAudioContext.resetStatus);
|
||||
AudioLoad_ProcessScriptLoads();
|
||||
|
||||
if (gAudioContext.resetStatus != 0) {
|
||||
if (Audio_ResetStep() == 0) {
|
||||
if (AudioHeap_ResetStep() == 0) {
|
||||
if (gAudioContext.resetStatus == 0) {
|
||||
osSendMesg(gAudioContext.audioResetQueueP, gAudioContext.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
@ -217,19 +217,19 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
|
||||
switch (cmd->op) {
|
||||
case 0x81:
|
||||
func_800E1C18(cmd->arg1, cmd->arg2);
|
||||
AudioLoad_SyncLoadSeqParts(cmd->arg1, cmd->arg2);
|
||||
return;
|
||||
case 0x82:
|
||||
func_800E20D4(cmd->arg0, cmd->arg1, cmd->arg2);
|
||||
AudioLoad_SyncInitSeqPlayer(cmd->arg0, cmd->arg1, cmd->arg2);
|
||||
func_800E59AC(cmd->arg0, cmd->data);
|
||||
return;
|
||||
case 0x85:
|
||||
func_800E2124(cmd->arg0, cmd->arg1, cmd->data);
|
||||
AudioLoad_SyncInitSeqPlayerSkipTicks(cmd->arg0, cmd->arg1, cmd->data);
|
||||
return;
|
||||
case 0x83:
|
||||
if (gAudioContext.seqPlayers[cmd->arg0].enabled) {
|
||||
if (cmd->asInt == 0) {
|
||||
Audio_SequencePlayerDisableAsFinished(&gAudioContext.seqPlayers[cmd->arg0]);
|
||||
AudioSeq_SequencePlayerDisableAsFinished(&gAudioContext.seqPlayers[cmd->arg0]);
|
||||
} else {
|
||||
func_800E5958(cmd->arg0, cmd->asInt);
|
||||
}
|
||||
|
@ -247,12 +247,12 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
return;
|
||||
case 0xF2:
|
||||
if (cmd->asUInt == 1) {
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
Note* note = &gAudioContext.notes[i];
|
||||
NoteSubEu* subEu = ¬e->noteSubEu;
|
||||
if (subEu->bitField0.s.enabled && note->playbackState.unk_04 == 0) {
|
||||
if (note->playbackState.parentLayer->seqChannel->muteBehavior & 8) {
|
||||
subEu->bitField0.s.finished = 1;
|
||||
if (subEu->bitField0.enabled && note->playbackState.unk_04 == 0) {
|
||||
if (note->playbackState.parentLayer->channel->muteBehavior & 8) {
|
||||
subEu->bitField0.finished = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -266,19 +266,19 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
|
||||
return;
|
||||
case 0xF3:
|
||||
func_800E1D64(cmd->arg0, cmd->arg1, cmd->arg2);
|
||||
AudioLoad_SyncLoadInstrument(cmd->arg0, cmd->arg1, cmd->arg2);
|
||||
return;
|
||||
case 0xF4:
|
||||
Audio_AudioTableAsyncLoad(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.unk_1E20);
|
||||
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
return;
|
||||
case 0xF5:
|
||||
Audio_AudioBankAsyncLoad(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.unk_1E20);
|
||||
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
return;
|
||||
case 0xFC:
|
||||
Audio_AudioSeqAsyncLoad(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.unk_1E20);
|
||||
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
return;
|
||||
case 0xF6:
|
||||
func_800E1F7C(cmd->arg1);
|
||||
AudioLoad_DiscardSeqFonts(cmd->arg1);
|
||||
return;
|
||||
case 0x90:
|
||||
gAudioContext.unk_5BDC[cmd->arg0] = cmd->asUShort;
|
||||
|
@ -293,7 +293,7 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
case 0xE0:
|
||||
case 0xE1:
|
||||
case 0xE2:
|
||||
func_800E7744(cmd->op - 0xE0, cmd->arg0, cmd->arg1, cmd->data);
|
||||
Audio_SetFontInstrument(cmd->op - 0xE0, cmd->arg0, cmd->arg1, cmd->data);
|
||||
return;
|
||||
case 0xFE:
|
||||
temp_t7 = cmd->asUInt;
|
||||
|
@ -301,14 +301,14 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
|
||||
if (seqPlayer->enabled) {
|
||||
Audio_SequencePlayerDisableAsFinished(seqPlayer);
|
||||
AudioSeq_SequencePlayerDisableAsFinished(seqPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
func_800E66C0(temp_t7);
|
||||
return;
|
||||
case 0xE3:
|
||||
func_800DE4B0(cmd->asInt);
|
||||
AudioHeap_PopCache(cmd->asInt);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
|
@ -478,24 +478,24 @@ void Audio_ProcessCmds(u32 msg) {
|
|||
}
|
||||
}
|
||||
|
||||
u32 func_800E5E20(u32* arg0) {
|
||||
u32 func_800E5E20(u32* out) {
|
||||
u32 sp1C;
|
||||
|
||||
if (osRecvMesg(&gAudioContext.unk_1E20, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
|
||||
*arg0 = 0;
|
||||
if (osRecvMesg(&gAudioContext.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
|
||||
*out = 0;
|
||||
return 0;
|
||||
}
|
||||
*arg0 = sp1C & 0xFFFFFF;
|
||||
*out = sp1C & 0xFFFFFF;
|
||||
return sp1C >> 0x18;
|
||||
}
|
||||
|
||||
u8* func_800E5E84(s32 arg0, u32* arg1) {
|
||||
return func_800E1F38(arg0, arg1);
|
||||
return AudioLoad_GetFontsForSequence(arg0, arg1);
|
||||
}
|
||||
|
||||
void func_800E5EA4(s32 arg0, u32* arg1, u32* arg2) {
|
||||
*arg1 = gAudioContext.ctlEntries[arg0].unk_02;
|
||||
*arg2 = gAudioContext.ctlEntries[arg0].unk_03;
|
||||
*arg1 = gAudioContext.soundFonts[arg0].sampleBankId1;
|
||||
*arg2 = gAudioContext.soundFonts[arg0].sampleBankId2;
|
||||
}
|
||||
|
||||
s32 func_800E5EDC(void) {
|
||||
|
@ -563,15 +563,15 @@ s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
|
|||
}
|
||||
|
||||
s8 func_800E60C4(s32 arg0, s32 arg1) {
|
||||
return gAudioContext.seqPlayers[arg0].unk_158[arg1];
|
||||
return gAudioContext.seqPlayers[arg0].soundScriptIO[arg1];
|
||||
}
|
||||
|
||||
void func_800E60EC(void* memAddr, u32 size) {
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.unkPool, memAddr, size);
|
||||
void Audio_InitExternalPool(void* mem, u32 size) {
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.externalPool, mem, size);
|
||||
}
|
||||
|
||||
void func_800E611C(void) {
|
||||
gAudioContext.unkPool.start = NULL;
|
||||
void Audio_DestroyExternalPool(void) {
|
||||
gAudioContext.externalPool.start = NULL;
|
||||
}
|
||||
|
||||
void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
||||
|
@ -596,7 +596,7 @@ void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
|||
seqPlayer->transposition = cmd->asSbyte;
|
||||
return;
|
||||
case 0x46:
|
||||
seqPlayer->unk_158[cmd->arg2] = cmd->asSbyte;
|
||||
seqPlayer->soundScriptIO[cmd->arg2] = cmd->asSbyte;
|
||||
return;
|
||||
case 0x4A:
|
||||
fadeVolume = (s32)cmd->arg1 / 127.0f;
|
||||
|
@ -725,9 +725,9 @@ void Audio_WaitForAudioTask(void) {
|
|||
|
||||
s32 func_800E6590(s32 arg0, s32 arg1, s32 arg2) {
|
||||
SequencePlayer* seqPlayer;
|
||||
SequenceChannelLayer* layer;
|
||||
SequenceLayer* layer;
|
||||
Note* note;
|
||||
AudioBankSound* sound;
|
||||
SoundFontSound* sound;
|
||||
s32 loopEnd;
|
||||
s32 samplePos;
|
||||
|
||||
|
@ -749,7 +749,7 @@ s32 func_800E6590(s32 arg0, s32 arg1, s32 arg2) {
|
|||
|
||||
note = layer->note;
|
||||
if (layer == note->playbackState.parentLayer) {
|
||||
sound = note->noteSubEu.sound.audioBankSound;
|
||||
sound = note->noteSubEu.sound.soundFontSound;
|
||||
if (sound == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -777,21 +777,21 @@ s32 func_800E66C0(s32 arg0) {
|
|||
NoteSubEu* temp_a3;
|
||||
s32 i;
|
||||
Note* note;
|
||||
AudioBankSound* sound;
|
||||
SoundFontSound* sound;
|
||||
|
||||
phi_v1 = 0;
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
note = &gAudioContext.notes[i];
|
||||
temp_a2 = ¬e->playbackState;
|
||||
if (note->noteSubEu.bitField0.s.enabled) {
|
||||
if (note->noteSubEu.bitField0.enabled) {
|
||||
temp_a3 = ¬e->noteSubEu;
|
||||
if (temp_a2->adsr.action.s.state != 0) {
|
||||
if (arg0 >= 2) {
|
||||
sound = temp_a3->sound.audioBankSound;
|
||||
if (sound == NULL || temp_a3->bitField1.s.isSyntheticWave) {
|
||||
sound = temp_a3->sound.soundFontSound;
|
||||
if (sound == NULL || temp_a3->bitField1.isSyntheticWave) {
|
||||
continue;
|
||||
}
|
||||
if (sound->sample->medium == 0) {
|
||||
if (sound->sample->medium == MEDIUM_RAM) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,24 +5,24 @@
|
|||
typedef struct {
|
||||
/* 0x00 */ u16 sfxId;
|
||||
/* 0x04 */ Vec3f* pos;
|
||||
/* 0x08 */ u8 unk_8;
|
||||
/* 0x08 */ u8 token;
|
||||
/* 0x0C */ f32* freqScale;
|
||||
/* 0x10 */ f32* unk_10;
|
||||
/* 0x10 */ f32* vol;
|
||||
/* 0x14 */ s8* reverbAdd;
|
||||
} SoundRequest; // size = 0x18
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ f32 unk_0;
|
||||
/* 0x04 */ f32 unk_4;
|
||||
/* 0x08 */ f32 unk_8;
|
||||
/* 0x0C */ u16 unk_C;
|
||||
} Struct_800F8EA0; // size = 0x10
|
||||
/* 0x00 */ f32 value;
|
||||
/* 0x04 */ f32 target;
|
||||
/* 0x08 */ f32 step;
|
||||
/* 0x0C */ u16 remainingFrames;
|
||||
} UnusedBankLerp; // size = 0x10
|
||||
|
||||
// rodata for Audio_ProcessSoundRequest (this file)
|
||||
// (probably moved to .data due to -use_readwrite_const)
|
||||
char D_80133340[] = "SE";
|
||||
|
||||
// rodata for func_800F7CEC (this file)
|
||||
// rodata for Audio_ChooseActiveSounds (this file)
|
||||
char D_80133344[] = VT_COL(RED, WHITE) "<INAGAKI CHECK> dist over! flag:%04X ptr:%08X pos:%f-%f-%f" VT_RST "\n";
|
||||
|
||||
// file padding
|
||||
|
@ -32,6 +32,21 @@ s32 D_8013338C = 0;
|
|||
char D_80133390[] = "SEQ H";
|
||||
char D_80133398[] = " L";
|
||||
|
||||
// bss
|
||||
extern SoundRequest sSoundRequests[0x100];
|
||||
extern SoundBankEntry D_8016BAD0[9];
|
||||
extern SoundBankEntry D_8016BC80[12];
|
||||
extern SoundBankEntry D_8016BEC0[22];
|
||||
extern SoundBankEntry D_8016C2E0[20];
|
||||
extern SoundBankEntry D_8016C6A0[8];
|
||||
extern SoundBankEntry D_8016C820[3];
|
||||
extern SoundBankEntry D_8016C8B0[5];
|
||||
extern u8 sSoundBankListEnd[7];
|
||||
extern u8 sSoundBankFreeListStart[7];
|
||||
extern u8 sSoundBankUnused[7];
|
||||
extern u8 sCurSfxPlayerChannelIdx;
|
||||
extern UnusedBankLerp sUnusedBankLerp[7];
|
||||
|
||||
// data
|
||||
|
||||
// sSoundRequests ring buffer endpoints. read index <= write index, wrapping around mod 256.
|
||||
|
@ -58,7 +73,7 @@ u8 sBankSizes[ARRAY_COUNT(gSoundBanks)] = {
|
|||
ARRAY_COUNT(D_8016C6A0), ARRAY_COUNT(D_8016C820), ARRAY_COUNT(D_8016C8B0),
|
||||
};
|
||||
|
||||
u8 D_801333CC = 0;
|
||||
u8 gSfxChannelLayout = 0;
|
||||
|
||||
u16 D_801333D0 = 0;
|
||||
|
||||
|
@ -74,13 +89,10 @@ s32 D_801333EC = 0; // unused
|
|||
|
||||
u8 D_801333F0 = 0;
|
||||
|
||||
u8 gAudioSEFlagSwapOff = 0;
|
||||
u8 gAudioSfxSwapOff = 0;
|
||||
|
||||
u8 D_801333F8 = 0;
|
||||
|
||||
extern SoundRequest sSoundRequests[0x100];
|
||||
extern Struct_800F8EA0 D_8016E270[7];
|
||||
|
||||
void Audio_SetSoundBanksMute(u16 muteMask) {
|
||||
u8 bankId;
|
||||
|
||||
|
@ -94,38 +106,37 @@ void Audio_SetSoundBanksMute(u16 muteMask) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio_QueueSeqCmdMute(u8 arg0) {
|
||||
D_801333D0 |= (1 << arg0);
|
||||
void Audio_QueueSeqCmdMute(u8 channelIdx) {
|
||||
D_801333D0 |= (1 << channelIdx);
|
||||
Audio_SetVolScale(0, 2, 0x40, 0xF);
|
||||
Audio_SetVolScale(3, 2, 0x40, 0xF);
|
||||
}
|
||||
|
||||
void Audio_ClearBGMMute(u8 arg0) {
|
||||
D_801333D0 &= ((1 << arg0) ^ 0xFFFF);
|
||||
void Audio_ClearBGMMute(u8 channelIdx) {
|
||||
D_801333D0 &= ((1 << channelIdx) ^ 0xFFFF);
|
||||
if (D_801333D0 == 0) {
|
||||
Audio_SetVolScale(0, 2, 0x7F, 0xF);
|
||||
Audio_SetVolScale(3, 2, 0x7F, 0xF);
|
||||
}
|
||||
}
|
||||
|
||||
// a4 is often the same as freqScale. (u8)(*a4 * 127.0f) is sent to script on IO port 2
|
||||
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 a2, f32* freqScale, f32* a4, s8* reverbAdd) {
|
||||
void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* vol, s8* reverbAdd) {
|
||||
u8 i;
|
||||
SoundRequest* req;
|
||||
|
||||
if (!gSoundBankMuted[SFX_BANK_SHIFT(sfxId)]) {
|
||||
req = &sSoundRequests[sSoundRequestWriteIndex];
|
||||
if (!gAudioSEFlagSwapOff) {
|
||||
if (!gAudioSfxSwapOff) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (sfxId == gAudioSEFlagSwapSource[i]) {
|
||||
if (gAudioSEFlagSwapMode[i] == 0) { // "SWAP"
|
||||
sfxId = gAudioSEFlagSwapTarget[i];
|
||||
if (sfxId == gAudioSfxSwapSource[i]) {
|
||||
if (gAudioSfxSwapMode[i] == 0) { // "SWAP"
|
||||
sfxId = gAudioSfxSwapTarget[i];
|
||||
} else { // "ADD"
|
||||
req->sfxId = gAudioSEFlagSwapTarget[i];
|
||||
req->sfxId = gAudioSfxSwapTarget[i];
|
||||
req->pos = pos;
|
||||
req->unk_8 = a2;
|
||||
req->token = token;
|
||||
req->freqScale = freqScale;
|
||||
req->unk_10 = a4;
|
||||
req->vol = vol;
|
||||
req->reverbAdd = reverbAdd;
|
||||
sSoundRequestWriteIndex++;
|
||||
req = &sSoundRequests[sSoundRequestWriteIndex];
|
||||
|
@ -136,9 +147,9 @@ void Audio_PlaySoundGeneral(u16 sfxId, Vec3f* pos, u8 a2, f32* freqScale, f32* a
|
|||
}
|
||||
req->sfxId = sfxId;
|
||||
req->pos = pos;
|
||||
req->unk_8 = a2;
|
||||
req->token = token;
|
||||
req->freqScale = freqScale;
|
||||
req->unk_10 = a4;
|
||||
req->vol = vol;
|
||||
req->reverbAdd = reverbAdd;
|
||||
sSoundRequestWriteIndex++;
|
||||
}
|
||||
|
@ -174,7 +185,7 @@ void Audio_RemoveMatchingSoundRequests(u8 aspect, SoundBankEntry* cmp) {
|
|||
}
|
||||
break;
|
||||
case 4:
|
||||
if (req->unk_8 == cmp->unk_C && req->sfxId == cmp->sfxId) {
|
||||
if (req->token == cmp->token && req->sfxId == cmp->sfxId) {
|
||||
remove = true;
|
||||
}
|
||||
break;
|
||||
|
@ -221,7 +232,7 @@ void Audio_ProcessSoundRequest(void) {
|
|||
return;
|
||||
}
|
||||
if (gSoundBanks[bankId][index].sfxId == req->sfxId) {
|
||||
count = D_80130594[D_801333CC][bankId];
|
||||
count = gUsedChannelsPerBank[gSfxChannelLayout][bankId];
|
||||
} else {
|
||||
if (count == 0) {
|
||||
evictIndex = index;
|
||||
|
@ -233,7 +244,7 @@ void Audio_ProcessSoundRequest(void) {
|
|||
evictImportance = gSoundParams[SFX_BANK_SHIFT(sfxId)][SFX_INDEX(sfxId)].importance;
|
||||
}
|
||||
count++;
|
||||
if (count == D_80130594[D_801333CC][bankId]) {
|
||||
if (count == gUsedChannelsPerBank[gSfxChannelLayout][bankId]) {
|
||||
if (gSoundParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)].importance >= evictImportance) {
|
||||
index = evictIndex;
|
||||
} else {
|
||||
|
@ -241,23 +252,24 @@ void Audio_ProcessSoundRequest(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (count == D_80130594[D_801333CC][bankId]) {
|
||||
if (count == gUsedChannelsPerBank[gSfxChannelLayout][bankId]) {
|
||||
soundParams = &gSoundParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
|
||||
if ((req->sfxId & 0xC00) || (soundParams->params & 4) || (index == evictIndex)) {
|
||||
if ((gSoundBanks[bankId][index].sfxParams & 8) && gSoundBanks[bankId][index].unk_2A != 1) {
|
||||
Audio_ClearBGMMute(gSoundBanks[bankId][index].unk_2E);
|
||||
if ((gSoundBanks[bankId][index].sfxParams & 8) &&
|
||||
gSoundBanks[bankId][index].state != SFX_STATE_QUEUED) {
|
||||
Audio_ClearBGMMute(gSoundBanks[bankId][index].channelIdx);
|
||||
}
|
||||
gSoundBanks[bankId][index].unk_C = req->unk_8;
|
||||
gSoundBanks[bankId][index].token = req->token;
|
||||
gSoundBanks[bankId][index].sfxId = req->sfxId;
|
||||
gSoundBanks[bankId][index].unk_2A = 1;
|
||||
gSoundBanks[bankId][index].unk_2B = 2;
|
||||
gSoundBanks[bankId][index].state = SFX_STATE_QUEUED;
|
||||
gSoundBanks[bankId][index].freshness = 2;
|
||||
gSoundBanks[bankId][index].freqScale = req->freqScale;
|
||||
gSoundBanks[bankId][index].unk_14 = req->unk_10;
|
||||
gSoundBanks[bankId][index].vol = req->vol;
|
||||
gSoundBanks[bankId][index].reverbAdd = req->reverbAdd;
|
||||
gSoundBanks[bankId][index].sfxParams = soundParams->params;
|
||||
gSoundBanks[bankId][index].sfxImportance = soundParams->importance;
|
||||
} else if (gSoundBanks[bankId][index].unk_2A == 5) {
|
||||
gSoundBanks[bankId][index].unk_2A = 4;
|
||||
} else if (gSoundBanks[bankId][index].state == SFX_STATE_PLAYING_2) {
|
||||
gSoundBanks[bankId][index].state = SFX_STATE_PLAYING_1;
|
||||
}
|
||||
index = 0;
|
||||
}
|
||||
|
@ -266,93 +278,95 @@ void Audio_ProcessSoundRequest(void) {
|
|||
index = gSoundBanks[bankId][index].next;
|
||||
}
|
||||
}
|
||||
if (gSoundBanks[bankId][D_8016E1A8[bankId]].next != 0xFF && index != 0) {
|
||||
index = D_8016E1A8[bankId];
|
||||
if (gSoundBanks[bankId][sSoundBankFreeListStart[bankId]].next != 0xFF && index != 0) {
|
||||
index = sSoundBankFreeListStart[bankId];
|
||||
entry = &gSoundBanks[bankId][index];
|
||||
entry->posX = &req->pos->x;
|
||||
entry->posY = &req->pos->y;
|
||||
entry->posZ = &req->pos->z;
|
||||
entry->unk_C = req->unk_8;
|
||||
entry->token = req->token;
|
||||
entry->freqScale = req->freqScale;
|
||||
entry->unk_14 = req->unk_10;
|
||||
entry->vol = req->vol;
|
||||
entry->reverbAdd = req->reverbAdd;
|
||||
soundParams = &gSoundParams[SFX_BANK_SHIFT(req->sfxId)][SFX_INDEX(req->sfxId)];
|
||||
entry->sfxParams = soundParams->params;
|
||||
entry->sfxImportance = soundParams->importance;
|
||||
entry->sfxId = req->sfxId;
|
||||
entry->unk_2A = 1;
|
||||
entry->unk_2B = 2;
|
||||
entry->prev = D_8016E1A0[bankId];
|
||||
gSoundBanks[bankId][D_8016E1A0[bankId]].next = D_8016E1A8[bankId];
|
||||
D_8016E1A0[bankId] = D_8016E1A8[bankId];
|
||||
D_8016E1A8[bankId] = gSoundBanks[bankId][D_8016E1A8[bankId]].next;
|
||||
gSoundBanks[bankId][D_8016E1A8[bankId]].prev = 0xFF;
|
||||
entry->state = SFX_STATE_QUEUED;
|
||||
entry->freshness = 2;
|
||||
entry->prev = sSoundBankListEnd[bankId];
|
||||
gSoundBanks[bankId][sSoundBankListEnd[bankId]].next = sSoundBankFreeListStart[bankId];
|
||||
sSoundBankListEnd[bankId] = sSoundBankFreeListStart[bankId];
|
||||
sSoundBankFreeListStart[bankId] = gSoundBanks[bankId][sSoundBankFreeListStart[bankId]].next;
|
||||
gSoundBanks[bankId][sSoundBankFreeListStart[bankId]].prev = 0xFF;
|
||||
entry->next = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F7B54(u8 bankId, u8 bankIndex) {
|
||||
SoundBankEntry* entry = &gSoundBanks[bankId][bankIndex];
|
||||
void Audio_RemoveSoundBankEntry(u8 bankId, u8 entryIndex) {
|
||||
SoundBankEntry* entry = &gSoundBanks[bankId][entryIndex];
|
||||
u8 i;
|
||||
|
||||
if (entry->sfxParams & 8) {
|
||||
Audio_ClearBGMMute(entry->unk_2E);
|
||||
Audio_ClearBGMMute(entry->channelIdx);
|
||||
}
|
||||
if (bankIndex == D_8016E1A0[bankId]) {
|
||||
D_8016E1A0[bankId] = entry->prev;
|
||||
if (entryIndex == sSoundBankListEnd[bankId]) {
|
||||
sSoundBankListEnd[bankId] = entry->prev;
|
||||
} else {
|
||||
gSoundBanks[bankId][entry->next].prev = entry->prev;
|
||||
}
|
||||
gSoundBanks[bankId][entry->prev].next = entry->next;
|
||||
entry->next = D_8016E1A8[bankId];
|
||||
entry->next = sSoundBankFreeListStart[bankId];
|
||||
entry->prev = 0xFF;
|
||||
gSoundBanks[bankId][D_8016E1A8[bankId]].prev = bankIndex;
|
||||
D_8016E1A8[bankId] = bankIndex;
|
||||
entry->unk_2A = 0;
|
||||
gSoundBanks[bankId][sSoundBankFreeListStart[bankId]].prev = entryIndex;
|
||||
sSoundBankFreeListStart[bankId] = entryIndex;
|
||||
entry->state = SFX_STATE_EMPTY;
|
||||
|
||||
for (i = 0; i < D_80130578[D_801333CC][bankId]; i++) {
|
||||
if (D_8016E1B8[bankId][i].unk_4 == bankIndex) {
|
||||
D_8016E1B8[bankId][i].unk_4 = 0xFF;
|
||||
i = D_80130578[D_801333CC][bankId];
|
||||
for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) {
|
||||
if (gActiveSounds[bankId][i].entryIndex == entryIndex) {
|
||||
gActiveSounds[bankId][i].entryIndex = 0xFF;
|
||||
i = gChannelsPerBank[gSfxChannelLayout][bankId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F7CEC(u8 arg0) {
|
||||
u8 phi_s3;
|
||||
u8 spAE;
|
||||
u8 phi_s4;
|
||||
void Audio_ChooseActiveSounds(u8 bankId) {
|
||||
u8 numChosenSounds;
|
||||
u8 numChannels;
|
||||
u8 entryIndex;
|
||||
u8 i;
|
||||
u8 j;
|
||||
u8 phi_s0;
|
||||
u8 k;
|
||||
u8 sfxImportance;
|
||||
u8 phi_v1_5;
|
||||
u8 temp2;
|
||||
u8 needNewSound;
|
||||
u8 chosenEntryIndex;
|
||||
u16 temp3;
|
||||
f32 tempf1;
|
||||
SoundBankEntry* entry;
|
||||
Struct_800F7CEC sp84[3];
|
||||
Struct_800F7CEC* temp_s4_3;
|
||||
ActiveSound chosenSounds[MAX_CHANNELS_PER_BANK];
|
||||
ActiveSound* activeSound;
|
||||
s32 pad;
|
||||
|
||||
phi_s3 = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
sp84[i].priority = 0x7FFFFFFF;
|
||||
sp84[i].unk_4 = 0xFF;
|
||||
numChosenSounds = 0;
|
||||
for (i = 0; i < MAX_CHANNELS_PER_BANK; i++) {
|
||||
chosenSounds[i].priority = 0x7FFFFFFF;
|
||||
chosenSounds[i].entryIndex = 0xFF;
|
||||
}
|
||||
phi_s4 = gSoundBanks[arg0][0].next;
|
||||
phi_s0 = 0;
|
||||
while (phi_s4 != 0xFF) {
|
||||
if ((1 == gSoundBanks[arg0][phi_s4].unk_2A) && (gSoundBanks[arg0][phi_s4].sfxId & 0xC00)) {
|
||||
gSoundBanks[arg0][phi_s4].unk_2B--;
|
||||
} else if (!(gSoundBanks[arg0][phi_s4].sfxId & 0xC00) && (gSoundBanks[arg0][phi_s4].unk_2A == 5)) {
|
||||
Audio_QueueCmdS8((gSoundBanks[arg0][phi_s4].unk_2E << 8) | 0x6020000, 0);
|
||||
func_800F7B54(arg0, phi_s4);
|
||||
entryIndex = gSoundBanks[bankId][0].next;
|
||||
k = 0;
|
||||
while (entryIndex != 0xFF) {
|
||||
if ((gSoundBanks[bankId][entryIndex].state == SFX_STATE_QUEUED) &&
|
||||
(gSoundBanks[bankId][entryIndex].sfxId & 0xC00)) {
|
||||
gSoundBanks[bankId][entryIndex].freshness--;
|
||||
} else if (!(gSoundBanks[bankId][entryIndex].sfxId & 0xC00) &&
|
||||
(gSoundBanks[bankId][entryIndex].state == SFX_STATE_PLAYING_2)) {
|
||||
Audio_QueueCmdS8((gSoundBanks[bankId][entryIndex].channelIdx << 8) | 0x6020000, 0);
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
}
|
||||
if (gSoundBanks[arg0][phi_s4].unk_2B == 0) {
|
||||
func_800F7B54(arg0, phi_s4);
|
||||
} else if (gSoundBanks[arg0][phi_s4].unk_2A != 0) {
|
||||
entry = &gSoundBanks[arg0][phi_s4];
|
||||
if (gSoundBanks[bankId][entryIndex].freshness == 0) {
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
} else if (gSoundBanks[bankId][entryIndex].state != SFX_STATE_EMPTY) {
|
||||
entry = &gSoundBanks[bankId][entryIndex];
|
||||
|
||||
if (&D_801333D4.x == entry[0].posX) {
|
||||
entry->dist = 0.0f;
|
||||
|
@ -369,122 +383,124 @@ void func_800F7CEC(u8 arg0) {
|
|||
osSyncPrintf(D_80133344, entry->sfxId, entry->posX, entry->posZ, *entry->posX, *entry->posY,
|
||||
*entry->posZ);
|
||||
}
|
||||
temp3 = entry->sfxId;
|
||||
temp3 = entry->sfxId; // fake
|
||||
entry->priority = (u32)entry->dist + (SQ(0xFF - sfxImportance) * SQ(76)) + temp3 - temp3;
|
||||
if (*entry->posZ < 0.0f) {
|
||||
entry->priority += (s32)(-*entry->posZ * 6.0f);
|
||||
}
|
||||
}
|
||||
if (entry->dist > SQ(1e5f)) {
|
||||
if (entry->unk_2A == 4) {
|
||||
Audio_QueueCmdS8((entry->unk_2E << 8) | 0x6020000, 0);
|
||||
if (entry->state == SFX_STATE_PLAYING_1) {
|
||||
Audio_QueueCmdS8((entry->channelIdx << 8) | 0x6020000, 0);
|
||||
if (entry->sfxId & 0xC00) {
|
||||
func_800F7B54(arg0, phi_s4);
|
||||
phi_s4 = phi_s0;
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
entryIndex = k;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
spAE = D_80130578[D_801333CC][arg0];
|
||||
for (i = 0; i < spAE; i++) {
|
||||
if (sp84[i].priority >= entry->priority) {
|
||||
if (phi_s3 < D_80130578[D_801333CC][arg0]) {
|
||||
phi_s3++;
|
||||
numChannels = gChannelsPerBank[gSfxChannelLayout][bankId];
|
||||
for (i = 0; i < numChannels; i++) {
|
||||
if (chosenSounds[i].priority >= entry->priority) {
|
||||
if (numChosenSounds < gChannelsPerBank[gSfxChannelLayout][bankId]) {
|
||||
numChosenSounds++;
|
||||
}
|
||||
for (j = spAE - 1; j > i; j--) {
|
||||
sp84[j].priority = sp84[j - 1].priority;
|
||||
sp84[j].unk_4 = sp84[j - 1].unk_4;
|
||||
for (j = numChannels - 1; j > i; j--) {
|
||||
chosenSounds[j].priority = chosenSounds[j - 1].priority;
|
||||
chosenSounds[j].entryIndex = chosenSounds[j - 1].entryIndex;
|
||||
}
|
||||
sp84[i].priority = entry->priority;
|
||||
sp84[i].unk_4 = phi_s4;
|
||||
i = spAE; // "break;"
|
||||
chosenSounds[i].priority = entry->priority;
|
||||
chosenSounds[i].entryIndex = entryIndex;
|
||||
i = numChannels; // "break;"
|
||||
}
|
||||
}
|
||||
}
|
||||
phi_s0 = phi_s4;
|
||||
k = entryIndex;
|
||||
}
|
||||
phi_s4 = gSoundBanks[arg0][phi_s0].next;
|
||||
entryIndex = gSoundBanks[bankId][k].next;
|
||||
}
|
||||
for (i = 0; i < phi_s3; i++) {
|
||||
entry = &gSoundBanks[arg0][sp84[i].unk_4];
|
||||
if (entry->unk_2A == 1) {
|
||||
entry->unk_2A = 2;
|
||||
} else if (entry->unk_2A == 4) {
|
||||
entry->unk_2A = 3;
|
||||
for (i = 0; i < numChosenSounds; i++) {
|
||||
entry = &gSoundBanks[bankId][chosenSounds[i].entryIndex];
|
||||
if (entry->state == SFX_STATE_QUEUED) {
|
||||
entry->state = SFX_STATE_READY;
|
||||
} else if (entry->state == SFX_STATE_PLAYING_1) {
|
||||
entry->state = SFX_STATE_PLAYING_REFRESH;
|
||||
}
|
||||
}
|
||||
|
||||
spAE = D_80130578[D_801333CC][arg0];
|
||||
for (i = 0; i < spAE; i++) {
|
||||
phi_v1_5 = 0;
|
||||
temp_s4_3 = &D_8016E1B8[arg0][i];
|
||||
// Pick something to play for all channels.
|
||||
numChannels = gChannelsPerBank[gSfxChannelLayout][bankId];
|
||||
for (i = 0; i < numChannels; i++) {
|
||||
needNewSound = false;
|
||||
activeSound = &gActiveSounds[bankId][i];
|
||||
|
||||
if (temp_s4_3->unk_4 == 0xFF) {
|
||||
phi_v1_5 = 1;
|
||||
if (activeSound->entryIndex == 0xFF) {
|
||||
needNewSound = true;
|
||||
} else {
|
||||
entry = &gSoundBanks[arg0][temp_s4_3[0].unk_4];
|
||||
if (entry->unk_2A == 4) {
|
||||
entry = &gSoundBanks[bankId][activeSound[0].entryIndex];
|
||||
if (entry->state == SFX_STATE_PLAYING_1) {
|
||||
if (entry->sfxId & 0xC00) {
|
||||
func_800F7B54(arg0, temp_s4_3->unk_4);
|
||||
Audio_RemoveSoundBankEntry(bankId, activeSound->entryIndex);
|
||||
} else {
|
||||
entry->unk_2A = 1;
|
||||
entry->state = SFX_STATE_QUEUED;
|
||||
}
|
||||
phi_v1_5 = 1;
|
||||
} else if (entry->unk_2A == 0) {
|
||||
temp_s4_3->unk_4 = 0xFF;
|
||||
phi_v1_5 = 1;
|
||||
needNewSound = true;
|
||||
} else if (entry->state == SFX_STATE_EMPTY) {
|
||||
activeSound->entryIndex = 0xFF;
|
||||
needNewSound = true;
|
||||
} else {
|
||||
for (j = 0; j < spAE; j++) {
|
||||
if (temp_s4_3->unk_4 == sp84[j].unk_4) {
|
||||
sp84[j].unk_4 = 0xFF;
|
||||
j = spAE;
|
||||
// Sound is already playing as it should, nothing to do.
|
||||
for (j = 0; j < numChannels; j++) {
|
||||
if (activeSound->entryIndex == chosenSounds[j].entryIndex) {
|
||||
chosenSounds[j].entryIndex = 0xFF;
|
||||
j = numChannels;
|
||||
}
|
||||
}
|
||||
phi_s3--;
|
||||
numChosenSounds--;
|
||||
}
|
||||
}
|
||||
|
||||
if (phi_v1_5 == 1) {
|
||||
for (j = 0; j < spAE; j++) {
|
||||
temp2 = sp84[j].unk_4;
|
||||
if ((temp2 != 0xFF) && (gSoundBanks[arg0][temp2].unk_2A != 3)) {
|
||||
for (phi_s0 = 0; phi_s0 < spAE; phi_s0++) {
|
||||
if (temp2 == D_8016E1B8[arg0][phi_s0].unk_4) {
|
||||
phi_v1_5 = 0;
|
||||
phi_s0 = spAE;
|
||||
if (needNewSound == true) {
|
||||
for (j = 0; j < numChannels; j++) {
|
||||
chosenEntryIndex = chosenSounds[j].entryIndex;
|
||||
if ((chosenEntryIndex != 0xFF) &&
|
||||
(gSoundBanks[bankId][chosenEntryIndex].state != SFX_STATE_PLAYING_REFRESH)) {
|
||||
for (k = 0; k < numChannels; k++) {
|
||||
if (chosenEntryIndex == gActiveSounds[bankId][k].entryIndex) {
|
||||
needNewSound = false;
|
||||
k = numChannels; // "break;"
|
||||
}
|
||||
}
|
||||
if (phi_v1_5 == 1) {
|
||||
temp_s4_3->unk_4 = temp2;
|
||||
|
||||
sp84[j].unk_4 = 0xFF;
|
||||
|
||||
j = spAE + 1;
|
||||
phi_s3--;
|
||||
if (needNewSound == true) {
|
||||
activeSound->entryIndex = chosenEntryIndex;
|
||||
chosenSounds[j].entryIndex = 0xFF;
|
||||
j = numChannels + 1;
|
||||
numChosenSounds--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j == spAE) {
|
||||
temp_s4_3->unk_4 = 0xFF;
|
||||
if (j == numChannels) {
|
||||
// nothing found
|
||||
activeSound->entryIndex = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F8480(u8 bankId) {
|
||||
u8 bankIndex;
|
||||
SequenceChannel* seqChannel;
|
||||
void Audio_PlayActiveSounds(u8 bankId) {
|
||||
u8 entryIndex;
|
||||
SequenceChannel* channel;
|
||||
SoundBankEntry* entry;
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < D_80130578[D_801333CC][bankId]; i++) {
|
||||
bankIndex = D_8016E1B8[bankId][i].unk_4;
|
||||
if (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[bankId][bankIndex];
|
||||
seqChannel = gAudioContext.seqPlayers[2].channels[D_8016E260];
|
||||
if (entry->unk_2A == 2) {
|
||||
entry->unk_2E = D_8016E260;
|
||||
for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) {
|
||||
entryIndex = gActiveSounds[bankId][i].entryIndex;
|
||||
if (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[bankId][entryIndex];
|
||||
channel = gAudioContext.seqPlayers[2].channels[sCurSfxPlayerChannelIdx];
|
||||
if (entry->state == SFX_STATE_READY) {
|
||||
entry->channelIdx = sCurSfxPlayerChannelIdx;
|
||||
if (entry->sfxParams & 8) {
|
||||
Audio_QueueSeqCmdMute(D_8016E260);
|
||||
Audio_QueueSeqCmdMute(sCurSfxPlayerChannelIdx);
|
||||
}
|
||||
if (entry->sfxParams & 0xC0) {
|
||||
switch (entry->sfxParams & 0xC0) {
|
||||
|
@ -502,47 +518,48 @@ void func_800F8480(u8 bankId) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
Audio_SetSoundProperties(bankId, bankIndex, D_8016E260);
|
||||
Audio_QueueCmdS8(0x06020000 | ((D_8016E260 & 0xFF) << 8), 1);
|
||||
Audio_QueueCmdS8(0x06020000 | ((D_8016E260 & 0xFF) << 8) | 4, entry->sfxId & 0xFF);
|
||||
if (D_80130570[bankId] != 0) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((D_8016E260 & 0xFF) << 8) | 5, (entry->sfxId & 0x100) >> 8);
|
||||
Audio_SetSoundProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
|
||||
Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8), 1);
|
||||
Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 4, entry->sfxId & 0xFF);
|
||||
if (gIsLargeSoundBank[bankId]) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 5,
|
||||
(entry->sfxId & 0x100) >> 8);
|
||||
}
|
||||
if (entry->sfxId & 0xC00) {
|
||||
entry->unk_2A = 4;
|
||||
entry->state = SFX_STATE_PLAYING_1;
|
||||
} else {
|
||||
entry->unk_2A = 5;
|
||||
entry->state = SFX_STATE_PLAYING_2;
|
||||
}
|
||||
} else if ((u8)seqChannel->soundScriptIO[1] == 0xFF) {
|
||||
func_800F7B54(bankId, bankIndex);
|
||||
} else if (entry->unk_2A == 3) {
|
||||
Audio_SetSoundProperties(bankId, bankIndex, D_8016E260);
|
||||
} else if ((u8)channel->soundScriptIO[1] == 0xFF) {
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_SetSoundProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
|
||||
if (entry->sfxId & 0xC00) {
|
||||
entry->unk_2A = 4;
|
||||
entry->state = SFX_STATE_PLAYING_1;
|
||||
} else {
|
||||
entry->unk_2A = 5;
|
||||
entry->state = SFX_STATE_PLAYING_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
D_8016E260++;
|
||||
sCurSfxPlayerChannelIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F87A0(u8 bankId) {
|
||||
void Audio_StopSfxByBank(u8 bankId) {
|
||||
SoundBankEntry* entry;
|
||||
s32 pad;
|
||||
SoundBankEntry cmp;
|
||||
u8 bankIndex = gSoundBanks[bankId][0].next;
|
||||
u8 entryIndex = gSoundBanks[bankId][0].next;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[bankId][bankIndex];
|
||||
if (entry->unk_2A >= 3) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->unk_2E & 0xFF) << 8), 0);
|
||||
while (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[bankId][entryIndex];
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->unk_2A != 0) {
|
||||
func_800F7B54(bankId, bankIndex);
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
}
|
||||
bankIndex = gSoundBanks[bankId][0].next;
|
||||
entryIndex = gSoundBanks[bankId][0].next;
|
||||
}
|
||||
cmp.sfxId = bankId << 12;
|
||||
Audio_RemoveMatchingSoundRequests(0, &cmp);
|
||||
|
@ -550,26 +567,26 @@ void func_800F87A0(u8 bankId) {
|
|||
|
||||
void func_800F8884(u8 bankId, Vec3f* pos) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[bankId][0].next;
|
||||
u8 bankIndex2 = 0;
|
||||
u8 entryIndex = gSoundBanks[bankId][0].next;
|
||||
u8 prevEntryIndex = 0;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[bankId][bankIndex];
|
||||
while (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[bankId][entryIndex];
|
||||
if (entry->posX == &pos->x) {
|
||||
if (entry->unk_2A >= 3) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->unk_2E & 0xFF) << 8), 0);
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->unk_2A != 0) {
|
||||
func_800F7B54(bankId, bankIndex);
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(bankId, entryIndex);
|
||||
}
|
||||
} else {
|
||||
bankIndex2 = bankIndex;
|
||||
prevEntryIndex = entryIndex;
|
||||
}
|
||||
bankIndex = gSoundBanks[bankId][bankIndex2].next;
|
||||
entryIndex = gSoundBanks[bankId][prevEntryIndex].next;
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F89A0(u8 bankId, Vec3f* pos) {
|
||||
void Audio_StopSfxByPosAndBank(u8 bankId, Vec3f* pos) {
|
||||
SoundBankEntry cmp;
|
||||
|
||||
func_800F8884(bankId, pos);
|
||||
|
@ -578,7 +595,7 @@ void func_800F89A0(u8 bankId, Vec3f* pos) {
|
|||
Audio_RemoveMatchingSoundRequests(1, &cmp);
|
||||
}
|
||||
|
||||
void func_800F89E8(Vec3f* pos) {
|
||||
void Audio_StopSfxByPos(Vec3f* pos) {
|
||||
u8 i;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
|
@ -589,27 +606,27 @@ void func_800F89E8(Vec3f* pos) {
|
|||
Audio_RemoveMatchingSoundRequests(2, &cmp);
|
||||
}
|
||||
|
||||
void func_800F8A44(Vec3f* pos, u16 sfxId) {
|
||||
void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 bankIndex2 = 0;
|
||||
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 prevEntryIndex = 0;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
|
||||
while (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
|
||||
if (entry->posX == &pos->x && entry->sfxId == sfxId) {
|
||||
if (entry->unk_2A >= 3) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->unk_2E & 0xFF) << 8), 0);
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->unk_2A != 0) {
|
||||
func_800F7B54(SFX_BANK(sfxId), bankIndex);
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
|
||||
}
|
||||
bankIndex = 0xFF;
|
||||
entryIndex = 0xFF;
|
||||
} else {
|
||||
bankIndex2 = bankIndex;
|
||||
prevEntryIndex = entryIndex;
|
||||
}
|
||||
if (bankIndex != 0xFF) {
|
||||
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
|
||||
if (entryIndex != 0xFF) {
|
||||
entryIndex = gSoundBanks[SFX_BANK(sfxId)][prevEntryIndex].next;
|
||||
}
|
||||
}
|
||||
cmp.posX = &pos->x;
|
||||
|
@ -617,52 +634,52 @@ void func_800F8A44(Vec3f* pos, u16 sfxId) {
|
|||
Audio_RemoveMatchingSoundRequests(3, &cmp);
|
||||
}
|
||||
|
||||
void func_800F8BA0(u8 arg0, u16 sfxId) {
|
||||
void Audio_StopSfxByTokenAndId(u8 token, u16 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 bankIndex2 = 0;
|
||||
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 prevEntryIndex = 0;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
|
||||
if (entry->unk_C == arg0 && entry->sfxId == sfxId) {
|
||||
if (entry->unk_2A >= 3) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->unk_2E & 0xFF) << 8), 0);
|
||||
while (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
|
||||
if (entry->token == token && entry->sfxId == sfxId) {
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->unk_2A != 0) {
|
||||
func_800F7B54(SFX_BANK(sfxId), bankIndex);
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
|
||||
}
|
||||
} else {
|
||||
bankIndex2 = bankIndex;
|
||||
prevEntryIndex = entryIndex;
|
||||
}
|
||||
if (bankIndex != 0xFF) {
|
||||
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
|
||||
if (entryIndex != 0xFF) {
|
||||
entryIndex = gSoundBanks[SFX_BANK(sfxId)][prevEntryIndex].next;
|
||||
}
|
||||
}
|
||||
cmp.unk_C = arg0;
|
||||
cmp.token = token;
|
||||
cmp.sfxId = sfxId;
|
||||
Audio_RemoveMatchingSoundRequests(4, &cmp);
|
||||
}
|
||||
|
||||
void Audio_StopSfx(u32 sfxId) {
|
||||
void Audio_StopSfxById(u32 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 bankIndex2 = 0;
|
||||
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 prevEntryIndex = 0;
|
||||
SoundBankEntry cmp;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
|
||||
while (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
|
||||
if (entry->sfxId == sfxId) {
|
||||
if (entry->unk_2A >= 3) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->unk_2E & 0xFF) << 8), 0);
|
||||
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
|
||||
}
|
||||
if (entry->unk_2A != 0) {
|
||||
func_800F7B54(SFX_BANK(sfxId), bankIndex);
|
||||
if (entry->state != SFX_STATE_EMPTY) {
|
||||
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
|
||||
}
|
||||
} else {
|
||||
bankIndex2 = bankIndex;
|
||||
prevEntryIndex = entryIndex;
|
||||
}
|
||||
bankIndex = gSoundBanks[SFX_BANK(sfxId)][bankIndex2].next;
|
||||
entryIndex = gSoundBanks[SFX_BANK(sfxId)][prevEntryIndex].next;
|
||||
}
|
||||
cmp.sfxId = sfxId;
|
||||
Audio_RemoveMatchingSoundRequests(5, &cmp);
|
||||
|
@ -675,72 +692,72 @@ void Audio_ProcessSoundRequests(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_800F8EA0(u8 arg0, u8 arg1, u16 arg2) {
|
||||
if (arg2 == 0) {
|
||||
arg2++;
|
||||
void Audio_SetUnusedBankLerp(u8 bankId, u8 target, u16 delay) {
|
||||
if (delay == 0) {
|
||||
delay++;
|
||||
}
|
||||
D_8016E270[arg0].unk_4 = arg1 / 127.0f;
|
||||
D_8016E270[arg0].unk_C = arg2;
|
||||
D_8016E270[arg0].unk_8 = ((D_8016E270[arg0].unk_0 - D_8016E270[arg0].unk_4) / arg2);
|
||||
sUnusedBankLerp[bankId].target = target / 127.0f;
|
||||
sUnusedBankLerp[bankId].remainingFrames = delay;
|
||||
sUnusedBankLerp[bankId].step = ((sUnusedBankLerp[bankId].value - sUnusedBankLerp[bankId].target) / delay);
|
||||
}
|
||||
|
||||
void func_800F8F34(u8 arg0) {
|
||||
if (D_8016E270[arg0].unk_C != 0) {
|
||||
D_8016E270[arg0].unk_C--;
|
||||
if (D_8016E270[arg0].unk_C != 0) {
|
||||
D_8016E270[arg0].unk_0 -= D_8016E270[arg0].unk_8;
|
||||
void Audio_StepUnusedBankLerp(u8 bankId) {
|
||||
if (sUnusedBankLerp[bankId].remainingFrames != 0) {
|
||||
sUnusedBankLerp[bankId].remainingFrames--;
|
||||
if (sUnusedBankLerp[bankId].remainingFrames != 0) {
|
||||
sUnusedBankLerp[bankId].value -= sUnusedBankLerp[bankId].step;
|
||||
} else {
|
||||
D_8016E270[arg0].unk_0 = D_8016E270[arg0].unk_4;
|
||||
sUnusedBankLerp[bankId].value = sUnusedBankLerp[bankId].target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800F8F88(void) {
|
||||
u8 i;
|
||||
u8 bankId;
|
||||
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[2].channels[0])) {
|
||||
D_8016E260 = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(gSoundBanks); i++) {
|
||||
func_800F7CEC(i);
|
||||
func_800F8480(i);
|
||||
func_800F8F34(i);
|
||||
sCurSfxPlayerChannelIdx = 0;
|
||||
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
|
||||
Audio_ChooseActiveSounds(bankId);
|
||||
Audio_PlayActiveSounds(bankId);
|
||||
Audio_StepUnusedBankLerp(bankId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u8 Audio_IsSfxPlaying(u32 sfxId) {
|
||||
SoundBankEntry* entry;
|
||||
u8 bankIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next;
|
||||
|
||||
while (bankIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][bankIndex];
|
||||
while (entryIndex != 0xFF) {
|
||||
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
|
||||
if (entry->sfxId == sfxId) {
|
||||
return true;
|
||||
}
|
||||
bankIndex = entry->next;
|
||||
entryIndex = entry->next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void func_800F905C(void) {
|
||||
void Audio_ResetSounds(void) {
|
||||
u8 bankId;
|
||||
u8 i;
|
||||
u8 bankIndex;
|
||||
u8 entryIndex;
|
||||
|
||||
sSoundRequestWriteIndex = 0;
|
||||
sSoundRequestReadIndex = 0;
|
||||
D_801333D0 = 0;
|
||||
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
|
||||
D_8016E1A0[bankId] = 0;
|
||||
D_8016E1A8[bankId] = 1;
|
||||
D_8016E1B0[bankId] = 0;
|
||||
sSoundBankListEnd[bankId] = 0;
|
||||
sSoundBankFreeListStart[bankId] = 1;
|
||||
sSoundBankUnused[bankId] = 0;
|
||||
gSoundBankMuted[bankId] = false;
|
||||
D_8016E270[bankId].unk_0 = 1.0f;
|
||||
D_8016E270[bankId].unk_C = 0;
|
||||
sUnusedBankLerp[bankId].value = 1.0f;
|
||||
sUnusedBankLerp[bankId].remainingFrames = 0;
|
||||
}
|
||||
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
D_8016E1B8[bankId][i].unk_4 = 0xFF;
|
||||
for (i = 0; i < MAX_CHANNELS_PER_BANK; i++) {
|
||||
gActiveSounds[bankId][i].entryIndex = 0xFF;
|
||||
}
|
||||
}
|
||||
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
|
||||
|
@ -755,9 +772,9 @@ void func_800F905C(void) {
|
|||
}
|
||||
if (D_801333F8 == 0) {
|
||||
for (bankId = 0; bankId < 10; bankId++) {
|
||||
gAudioSEFlagSwapSource[bankId] = 0;
|
||||
gAudioSEFlagSwapTarget[bankId] = 0;
|
||||
gAudioSEFlagSwapMode[bankId] = 0;
|
||||
gAudioSfxSwapSource[bankId] = 0;
|
||||
gAudioSfxSwapTarget[bankId] = 0;
|
||||
gAudioSfxSwapMode[bankId] = 0;
|
||||
}
|
||||
D_801333F8++;
|
||||
}
|
||||
|
|
|
@ -9,56 +9,55 @@ extern u8 sSeqCmdRdPos;
|
|||
extern u8 sSeqCmdWrPos;
|
||||
extern u8 D_80133408;
|
||||
extern u8 D_80133418;
|
||||
extern u8 D_801333CC;
|
||||
extern u8 D_80133410[];
|
||||
|
||||
// TODO: clean up these macros. They are similar to ones in code_800EC960.c but without casts.
|
||||
#define Audio_StartSeq(seqIdx, fadeTimer, seqId) \
|
||||
Audio_QueueSeqCmd(0x00000000 | ((seqIdx) << 24) | ((fadeTimer) << 16) | (seqId))
|
||||
#define Audio_SeqCmdA(seqIdx, a) Audio_QueueSeqCmd(0xA0000000 | ((seqIdx) << 24) | (a))
|
||||
#define Audio_SeqCmdB30(seqIdx, a, b) Audio_QueueSeqCmd(0xB0003000 | ((seqIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmdB40(seqIdx, a, b) Audio_QueueSeqCmd(0xB0004000 | ((seqIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmd3(seqIdx, a) Audio_QueueSeqCmd(0x30000000 | ((seqIdx) << 24) | (a))
|
||||
#define Audio_SeqCmd5(seqIdx, a, b) Audio_QueueSeqCmd(0x50000000 | ((seqIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmd4(seqIdx, a, b) Audio_QueueSeqCmd(0x40000000 | ((seqIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SetVolScaleNow(seqIdx, volFadeTimer, volScale) \
|
||||
Audio_ProcessSeqCmd(0x40000000 | ((u8)seqIdx << 24) | ((u8)volFadeTimer << 16) | ((u8)(volScale * 127.0f)));
|
||||
#define Audio_StartSeq(playerIdx, fadeTimer, seqId) \
|
||||
Audio_QueueSeqCmd(0x00000000 | ((playerIdx) << 24) | ((fadeTimer) << 16) | (seqId))
|
||||
#define Audio_SeqCmdA(playerIdx, a) Audio_QueueSeqCmd(0xA0000000 | ((playerIdx) << 24) | (a))
|
||||
#define Audio_SeqCmdB30(playerIdx, a, b) Audio_QueueSeqCmd(0xB0003000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmdB40(playerIdx, a, b) Audio_QueueSeqCmd(0xB0004000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmd3(playerIdx, a) Audio_QueueSeqCmd(0x30000000 | ((playerIdx) << 24) | (a))
|
||||
#define Audio_SeqCmd5(playerIdx, a, b) Audio_QueueSeqCmd(0x50000000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SeqCmd4(playerIdx, a, b) Audio_QueueSeqCmd(0x40000000 | ((playerIdx) << 24) | ((a) << 16) | (b))
|
||||
#define Audio_SetVolScaleNow(playerIdx, volFadeTimer, volScale) \
|
||||
Audio_ProcessSeqCmd(0x40000000 | ((u8)playerIdx << 24) | ((u8)volFadeTimer << 16) | ((u8)(volScale * 127.0f)));
|
||||
|
||||
void func_800F9280(u8 seqIdx, u8 seqId, u8 arg2, u16 fadeTimer) {
|
||||
void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer) {
|
||||
u8 i;
|
||||
u16 dur;
|
||||
s32 pad;
|
||||
|
||||
if (D_80133408 == 0 || seqIdx == 2) {
|
||||
if (D_80133408 == 0 || playerIdx == 2) {
|
||||
arg2 &= 0x7F;
|
||||
if (arg2 == 0x7F) {
|
||||
dur = (fadeTimer >> 3) * 60 * gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
Audio_QueueCmdS32(0x85000000 | _SHIFTL(seqIdx, 16, 8) | _SHIFTL(seqId, 8, 8), dur);
|
||||
Audio_QueueCmdS32(0x85000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(seqId, 8, 8), dur);
|
||||
} else {
|
||||
Audio_QueueCmdS32(0x82000000 | _SHIFTL(seqIdx, 16, 8) | _SHIFTL(seqId, 8, 8),
|
||||
Audio_QueueCmdS32(0x82000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(seqId, 8, 8),
|
||||
(fadeTimer * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4);
|
||||
}
|
||||
|
||||
D_8016E750[seqIdx].unk_254 = seqId | (arg2 << 8);
|
||||
D_8016E750[seqIdx].unk_256 = seqId | (arg2 << 8);
|
||||
D_8016E750[playerIdx].unk_254 = seqId | (arg2 << 8);
|
||||
D_8016E750[playerIdx].unk_256 = seqId | (arg2 << 8);
|
||||
|
||||
if (D_8016E750[seqIdx].volCur != 1.0f) {
|
||||
Audio_QueueCmdF32(0x41000000 | _SHIFTL(seqIdx, 16, 8), D_8016E750[seqIdx].volCur);
|
||||
if (D_8016E750[playerIdx].volCur != 1.0f) {
|
||||
Audio_QueueCmdF32(0x41000000 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].volCur);
|
||||
}
|
||||
|
||||
D_8016E750[seqIdx].unk_28 = 0;
|
||||
D_8016E750[seqIdx].unk_18 = 0;
|
||||
D_8016E750[seqIdx].unk_14 = 0;
|
||||
D_8016E750[playerIdx].unk_28 = 0;
|
||||
D_8016E750[playerIdx].unk_18 = 0;
|
||||
D_8016E750[playerIdx].unk_14 = 0;
|
||||
|
||||
for (i = 0; i < 0x10; i++) {
|
||||
D_8016E750[seqIdx].unk_50[i].unk_00 = 1.0f;
|
||||
D_8016E750[seqIdx].unk_50[i].unk_0C = 0;
|
||||
D_8016E750[seqIdx].unk_50[i].unk_10 = 1.0f;
|
||||
D_8016E750[seqIdx].unk_50[i].unk_1C = 0;
|
||||
D_8016E750[playerIdx].unk_50[i].unk_00 = 1.0f;
|
||||
D_8016E750[playerIdx].unk_50[i].unk_0C = 0;
|
||||
D_8016E750[playerIdx].unk_50[i].unk_10 = 1.0f;
|
||||
D_8016E750[playerIdx].unk_50[i].unk_1C = 0;
|
||||
}
|
||||
|
||||
D_8016E750[seqIdx].unk_250 = 0;
|
||||
D_8016E750[seqIdx].unk_252 = 0;
|
||||
D_8016E750[playerIdx].unk_250 = 0;
|
||||
D_8016E750[playerIdx].unk_252 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +101,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
u8 spec;
|
||||
u8 op;
|
||||
u8 subOp;
|
||||
u8 seqIdx;
|
||||
u8 playerIdx;
|
||||
u8 seqId;
|
||||
u8 seqArgs;
|
||||
u8 found;
|
||||
|
@ -119,7 +118,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
|
||||
op = cmd >> 28;
|
||||
seqIdx = (cmd & 0xF000000) >> 24;
|
||||
playerIdx = (cmd & 0xF000000) >> 24;
|
||||
|
||||
switch (op) {
|
||||
case 0x0:
|
||||
|
@ -127,15 +126,15 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
seqId = cmd & 0xFF;
|
||||
seqArgs = (cmd & 0xFF00) >> 8;
|
||||
fadeTimer = (cmd & 0xFF0000) >> 13;
|
||||
if ((D_8016E750[seqIdx].unk_260 == 0) && (seqArgs < 0x80)) {
|
||||
func_800F9280(seqIdx, seqId, seqArgs, fadeTimer);
|
||||
if ((D_8016E750[playerIdx].unk_260 == 0) && (seqArgs < 0x80)) {
|
||||
func_800F9280(playerIdx, seqId, seqArgs, fadeTimer);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x1:
|
||||
// disable seq player
|
||||
fadeTimer = (cmd & 0xFF0000) >> 13;
|
||||
func_800F9474(seqIdx, fadeTimer);
|
||||
func_800F9474(playerIdx, fadeTimer);
|
||||
break;
|
||||
|
||||
case 0x2:
|
||||
|
@ -144,35 +143,35 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
seqArgs = (cmd & 0xFF00) >> 8;
|
||||
fadeTimer = (cmd & 0xFF0000) >> 13;
|
||||
new_var = seqArgs;
|
||||
for (i = 0; i < D_8016E348[seqIdx]; i++) {
|
||||
if (D_8016E320[seqIdx][i].unk_0 == seqId) {
|
||||
for (i = 0; i < D_8016E348[playerIdx]; i++) {
|
||||
if (D_8016E320[playerIdx][i].unk_0 == seqId) {
|
||||
if (i == 0) {
|
||||
func_800F9280(seqIdx, seqId, seqArgs, fadeTimer);
|
||||
func_800F9280(playerIdx, seqId, seqArgs, fadeTimer);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
found = D_8016E348[seqIdx];
|
||||
for (i = 0; i < D_8016E348[seqIdx]; i++) {
|
||||
if (D_8016E320[seqIdx][i].unk_1 <= new_var) {
|
||||
found = D_8016E348[playerIdx];
|
||||
for (i = 0; i < D_8016E348[playerIdx]; i++) {
|
||||
if (D_8016E320[playerIdx][i].unk_1 <= new_var) {
|
||||
found = i;
|
||||
i = D_8016E348[seqIdx]; // "break;"
|
||||
i = D_8016E348[playerIdx]; // "break;"
|
||||
}
|
||||
}
|
||||
|
||||
if (D_8016E348[seqIdx] < 5) {
|
||||
D_8016E348[seqIdx]++;
|
||||
if (D_8016E348[playerIdx] < 5) {
|
||||
D_8016E348[playerIdx]++;
|
||||
}
|
||||
for (i = D_8016E348[seqIdx] - 1; i != found; i--) {
|
||||
D_8016E320[seqIdx][i].unk_1 = D_8016E320[seqIdx][i - 1].unk_1;
|
||||
D_8016E320[seqIdx][i].unk_0 = D_8016E320[seqIdx][i - 1].unk_0;
|
||||
for (i = D_8016E348[playerIdx] - 1; i != found; i--) {
|
||||
D_8016E320[playerIdx][i].unk_1 = D_8016E320[playerIdx][i - 1].unk_1;
|
||||
D_8016E320[playerIdx][i].unk_0 = D_8016E320[playerIdx][i - 1].unk_0;
|
||||
}
|
||||
D_8016E320[seqIdx][found].unk_1 = seqArgs;
|
||||
D_8016E320[seqIdx][found].unk_0 = seqId;
|
||||
D_8016E320[playerIdx][found].unk_1 = seqArgs;
|
||||
D_8016E320[playerIdx][found].unk_0 = seqId;
|
||||
|
||||
if (found == 0) {
|
||||
func_800F9280(seqIdx, seqId, seqArgs, fadeTimer);
|
||||
func_800F9280(playerIdx, seqId, seqArgs, fadeTimer);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -181,26 +180,26 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
seqId = cmd & 0xFF;
|
||||
fadeTimer = (cmd & 0xFF0000) >> 13;
|
||||
|
||||
found = D_8016E348[seqIdx];
|
||||
for (i = 0; i < D_8016E348[seqIdx]; i++) {
|
||||
if (D_8016E320[seqIdx][i].unk_0 == seqId) {
|
||||
found = D_8016E348[playerIdx];
|
||||
for (i = 0; i < D_8016E348[playerIdx]; i++) {
|
||||
if (D_8016E320[playerIdx][i].unk_0 == seqId) {
|
||||
found = i;
|
||||
i = D_8016E348[seqIdx]; // "break;"
|
||||
i = D_8016E348[playerIdx]; // "break;"
|
||||
}
|
||||
}
|
||||
|
||||
if (found != D_8016E348[seqIdx]) {
|
||||
for (i = found; i < D_8016E348[seqIdx] - 1; i++) {
|
||||
D_8016E320[seqIdx][i].unk_1 = D_8016E320[seqIdx][i + 1].unk_1;
|
||||
D_8016E320[seqIdx][i].unk_0 = D_8016E320[seqIdx][i + 1].unk_0;
|
||||
if (found != D_8016E348[playerIdx]) {
|
||||
for (i = found; i < D_8016E348[playerIdx] - 1; i++) {
|
||||
D_8016E320[playerIdx][i].unk_1 = D_8016E320[playerIdx][i + 1].unk_1;
|
||||
D_8016E320[playerIdx][i].unk_0 = D_8016E320[playerIdx][i + 1].unk_0;
|
||||
}
|
||||
D_8016E348[seqIdx]--;
|
||||
D_8016E348[playerIdx]--;
|
||||
}
|
||||
|
||||
if (found == 0) {
|
||||
func_800F9474(seqIdx, fadeTimer);
|
||||
if (D_8016E348[seqIdx] != 0) {
|
||||
func_800F9280(seqIdx, D_8016E320[seqIdx][0].unk_0, D_8016E320[seqIdx][0].unk_1, fadeTimer);
|
||||
func_800F9474(playerIdx, fadeTimer);
|
||||
if (D_8016E348[playerIdx] != 0) {
|
||||
func_800F9280(playerIdx, D_8016E320[playerIdx][0].unk_0, D_8016E320[playerIdx][0].unk_1, fadeTimer);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -212,10 +211,11 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
if (duration == 0) {
|
||||
duration++;
|
||||
}
|
||||
D_8016E750[seqIdx].volTarget = (f32)val / 127.0f;
|
||||
if (D_8016E750[seqIdx].volCur != D_8016E750[seqIdx].volTarget) {
|
||||
D_8016E750[seqIdx].unk_08 = (D_8016E750[seqIdx].volCur - D_8016E750[seqIdx].volTarget) / (f32)duration;
|
||||
D_8016E750[seqIdx].unk_0C = duration;
|
||||
D_8016E750[playerIdx].volTarget = (f32)val / 127.0f;
|
||||
if (D_8016E750[playerIdx].volCur != D_8016E750[playerIdx].volTarget) {
|
||||
D_8016E750[playerIdx].unk_08 =
|
||||
(D_8016E750[playerIdx].volCur - D_8016E750[playerIdx].volTarget) / (f32)duration;
|
||||
D_8016E750[playerIdx].unk_0C = duration;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -228,11 +228,12 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
}
|
||||
freqScale = (f32)val / 1000.0f;
|
||||
for (i = 0; i < 16; i++) {
|
||||
D_8016E750[seqIdx].unk_50[i].unk_14 = freqScale;
|
||||
D_8016E750[seqIdx].unk_50[i].unk_1C = duration;
|
||||
D_8016E750[seqIdx].unk_50[i].unk_18 = (D_8016E750[seqIdx].unk_50[i].unk_10 - freqScale) / (f32)duration;
|
||||
D_8016E750[playerIdx].unk_50[i].unk_14 = freqScale;
|
||||
D_8016E750[playerIdx].unk_50[i].unk_1C = duration;
|
||||
D_8016E750[playerIdx].unk_50[i].unk_18 =
|
||||
(D_8016E750[playerIdx].unk_50[i].unk_10 - freqScale) / (f32)duration;
|
||||
}
|
||||
D_8016E750[seqIdx].unk_250 = 0xFFFF;
|
||||
D_8016E750[playerIdx].unk_250 = 0xFFFF;
|
||||
break;
|
||||
|
||||
case 0xD:
|
||||
|
@ -244,11 +245,11 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
duration++;
|
||||
}
|
||||
freqScale = (f32)val / 1000.0f;
|
||||
D_8016E750[seqIdx].unk_50[chanIdx].unk_14 = freqScale;
|
||||
D_8016E750[seqIdx].unk_50[chanIdx].unk_18 =
|
||||
(D_8016E750[seqIdx].unk_50[chanIdx].unk_10 - freqScale) / (f32)duration;
|
||||
D_8016E750[seqIdx].unk_50[chanIdx].unk_1C = duration;
|
||||
D_8016E750[seqIdx].unk_250 |= 1 << chanIdx;
|
||||
D_8016E750[playerIdx].unk_50[chanIdx].unk_14 = freqScale;
|
||||
D_8016E750[playerIdx].unk_50[chanIdx].unk_18 =
|
||||
(D_8016E750[playerIdx].unk_50[chanIdx].unk_10 - freqScale) / (f32)duration;
|
||||
D_8016E750[playerIdx].unk_50[chanIdx].unk_1C = duration;
|
||||
D_8016E750[playerIdx].unk_250 |= 1 << chanIdx;
|
||||
break;
|
||||
|
||||
case 0x6:
|
||||
|
@ -259,13 +260,13 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
if (duration == 0) {
|
||||
duration++;
|
||||
}
|
||||
D_8016E750[seqIdx].unk_50[chanIdx].unk_04 = (f32)val / 127.0f;
|
||||
if (D_8016E750[seqIdx].unk_50[chanIdx].unk_00 != D_8016E750[seqIdx].unk_50[chanIdx].unk_04) {
|
||||
D_8016E750[seqIdx].unk_50[chanIdx].unk_08 =
|
||||
(D_8016E750[seqIdx].unk_50[chanIdx].unk_00 - D_8016E750[seqIdx].unk_50[chanIdx].unk_04) /
|
||||
D_8016E750[playerIdx].unk_50[chanIdx].unk_04 = (f32)val / 127.0f;
|
||||
if (D_8016E750[playerIdx].unk_50[chanIdx].unk_00 != D_8016E750[playerIdx].unk_50[chanIdx].unk_04) {
|
||||
D_8016E750[playerIdx].unk_50[chanIdx].unk_08 =
|
||||
(D_8016E750[playerIdx].unk_50[chanIdx].unk_00 - D_8016E750[playerIdx].unk_50[chanIdx].unk_04) /
|
||||
(f32)duration;
|
||||
D_8016E750[seqIdx].unk_50[chanIdx].unk_0C = duration;
|
||||
D_8016E750[seqIdx].unk_252 |= 1 << chanIdx;
|
||||
D_8016E750[playerIdx].unk_50[chanIdx].unk_0C = duration;
|
||||
D_8016E750[playerIdx].unk_252 |= 1 << chanIdx;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -273,7 +274,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
// set global io port
|
||||
port = (cmd & 0xFF0000) >> 16;
|
||||
val = cmd & 0xFF;
|
||||
Audio_QueueCmdS8(0x46000000 | _SHIFTL(seqIdx, 16, 8) | _SHIFTL(port, 0, 8), val);
|
||||
Audio_QueueCmdS8(0x46000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(port, 0, 8), val);
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
|
@ -281,15 +282,15 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
chanIdx = (cmd & 0xF00) >> 8;
|
||||
port = (cmd & 0xFF0000) >> 16;
|
||||
val = cmd & 0xFF;
|
||||
if ((D_8016E750[seqIdx].unk_258 & (1 << chanIdx)) == 0) {
|
||||
Audio_QueueCmdS8(0x06000000 | _SHIFTL(seqIdx, 16, 8) | _SHIFTL(chanIdx, 8, 8) | _SHIFTL(port, 0, 8),
|
||||
if ((D_8016E750[playerIdx].unk_258 & (1 << chanIdx)) == 0) {
|
||||
Audio_QueueCmdS8(0x06000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(chanIdx, 8, 8) | _SHIFTL(port, 0, 8),
|
||||
val);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x9:
|
||||
// set channel mask for command 0x8
|
||||
D_8016E750[seqIdx].unk_258 = cmd & 0xFFFF;
|
||||
D_8016E750[playerIdx].unk_258 = cmd & 0xFFFF;
|
||||
break;
|
||||
|
||||
case 0xA:
|
||||
|
@ -297,36 +298,36 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
channelMask = cmd & 0xFFFF;
|
||||
if (channelMask != 0) {
|
||||
// with channel mask channelMask...
|
||||
Audio_QueueCmdU16(0x90000000 | _SHIFTL(seqIdx, 16, 8), channelMask);
|
||||
Audio_QueueCmdU16(0x90000000 | _SHIFTL(playerIdx, 16, 8), channelMask);
|
||||
// stop channels
|
||||
Audio_QueueCmdS8(0x08000000 | _SHIFTL(seqIdx, 16, 8) | 0xFF00, 1);
|
||||
Audio_QueueCmdS8(0x08000000 | _SHIFTL(playerIdx, 16, 8) | 0xFF00, 1);
|
||||
}
|
||||
if ((channelMask ^ 0xFFFF) != 0) {
|
||||
// with channel mask ~channelMask...
|
||||
Audio_QueueCmdU16(0x90000000 | _SHIFTL(seqIdx, 16, 8), (channelMask ^ 0xFFFF));
|
||||
Audio_QueueCmdU16(0x90000000 | _SHIFTL(playerIdx, 16, 8), (channelMask ^ 0xFFFF));
|
||||
// unstop channels
|
||||
Audio_QueueCmdS8(0x08000000 | _SHIFTL(seqIdx, 16, 8) | 0xFF00, 0);
|
||||
Audio_QueueCmdS8(0x08000000 | _SHIFTL(playerIdx, 16, 8) | 0xFF00, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xB:
|
||||
// update tempo
|
||||
D_8016E750[seqIdx].unk_14 = cmd;
|
||||
D_8016E750[playerIdx].unk_14 = cmd;
|
||||
break;
|
||||
|
||||
case 0xC:
|
||||
// start sequence with setup commands
|
||||
subOp = (cmd & 0xF00000) >> 20;
|
||||
if (subOp != 0xF) {
|
||||
if (D_8016E750[seqIdx].unk_4D < 7) {
|
||||
found = D_8016E750[seqIdx].unk_4D++;
|
||||
if (D_8016E750[playerIdx].unk_4D < 7) {
|
||||
found = D_8016E750[playerIdx].unk_4D++;
|
||||
if (found < 8) {
|
||||
D_8016E750[seqIdx].unk_2C[found] = cmd;
|
||||
D_8016E750[seqIdx].unk_4C = 2;
|
||||
D_8016E750[playerIdx].unk_2C[found] = cmd;
|
||||
D_8016E750[playerIdx].unk_4C = 2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
D_8016E750[seqIdx].unk_4D = 0;
|
||||
D_8016E750[playerIdx].unk_4D = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -348,7 +349,7 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
|||
case 0xF:
|
||||
// change spec
|
||||
spec = cmd & 0xFF;
|
||||
D_801333CC = (cmd & 0xFF00) >> 8;
|
||||
gSfxChannelLayout = (cmd & 0xFF00) >> 8;
|
||||
oldSpec = gAudioSpecId;
|
||||
gAudioSpecId = spec;
|
||||
func_800E5F88(spec);
|
||||
|
@ -403,21 +404,21 @@ void func_800FA18C(u8 arg0, u8 arg1) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio_SetVolScale(u8 seqIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTimer) {
|
||||
void Audio_SetVolScale(u8 playerIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTimer) {
|
||||
f32 volScale;
|
||||
u8 i;
|
||||
|
||||
D_8016E750[seqIdx].volScales[scaleIdx] = targetVol & 0x7F;
|
||||
D_8016E750[playerIdx].volScales[scaleIdx] = targetVol & 0x7F;
|
||||
|
||||
if (volFadeTimer != 0) {
|
||||
D_8016E750[seqIdx].fadeVolUpdate = 1;
|
||||
D_8016E750[seqIdx].volFadeTimer = volFadeTimer;
|
||||
D_8016E750[playerIdx].fadeVolUpdate = 1;
|
||||
D_8016E750[playerIdx].volFadeTimer = volFadeTimer;
|
||||
} else {
|
||||
for (i = 0, volScale = 1.0f; i < 4; i++) {
|
||||
volScale *= D_8016E750[seqIdx].volScales[i] / 127.0f;
|
||||
volScale *= D_8016E750[playerIdx].volScales[i] / 127.0f;
|
||||
}
|
||||
|
||||
Audio_SetVolScaleNow(seqIdx, volFadeTimer, volScale);
|
||||
Audio_SetVolScaleNow(playerIdx, volFadeTimer, volScale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +433,7 @@ void func_800FA3DC(void) {
|
|||
u8 temp_s0_3;
|
||||
u8 temp_a3_3;
|
||||
s32 pad[3];
|
||||
u32 sp70;
|
||||
u32 dummy;
|
||||
f32 phi_f0;
|
||||
u8 phi_t0;
|
||||
u8 i;
|
||||
|
@ -441,7 +442,7 @@ void func_800FA3DC(void) {
|
|||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (D_8016E750[i].unk_260 != 0) {
|
||||
switch (func_800E5E20(&sp70)) {
|
||||
switch (func_800E5E20(&dummy)) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
|
@ -624,13 +625,13 @@ void func_800FA3DC(void) {
|
|||
break;
|
||||
case 14:
|
||||
if (temp_a3_3 & 1) {
|
||||
Audio_QueueCmdS32(0xE3000000, 0);
|
||||
Audio_QueueCmdS32(0xE3000000, SEQUENCE_TABLE);
|
||||
}
|
||||
if (temp_a3_3 & 2) {
|
||||
Audio_QueueCmdS32(0xE3000000, 1);
|
||||
Audio_QueueCmdS32(0xE3000000, FONT_TABLE);
|
||||
}
|
||||
if (temp_a3_3 & 4) {
|
||||
Audio_QueueCmdS32(0xE3000000, 2);
|
||||
Audio_QueueCmdS32(0xE3000000, SAMPLE_TABLE);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
|
@ -653,13 +654,13 @@ u8 func_800FAD34(void) {
|
|||
if (D_80133418 == 1) {
|
||||
if (func_800E5EDC() == 1) {
|
||||
D_80133418 = 0;
|
||||
Audio_QueueCmdS8(0x46020000, D_801333CC);
|
||||
Audio_QueueCmdS8(0x46020000, gSfxChannelLayout);
|
||||
func_800F7170();
|
||||
}
|
||||
} else if (D_80133418 == 2) {
|
||||
while (func_800E5EDC() != 1) {}
|
||||
D_80133418 = 0;
|
||||
Audio_QueueCmdS8(0x46020000, D_801333CC);
|
||||
Audio_QueueCmdS8(0x46020000, gSfxChannelLayout);
|
||||
func_800F7170();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ void Fault_ClientProcessThread(void* arg) {
|
|||
}
|
||||
|
||||
if (ctx->queue != NULL) {
|
||||
osSendMesg(ctx->queue, ctx->msg, 1);
|
||||
osSendMesg(ctx->queue, ctx->msg, OS_MESG_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void Fault_ProcessClientContext(FaultClientContext* ctx) {
|
|||
|
||||
while (true) {
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(1000000), 0, &queue, (OSMesg)timerMsgVal);
|
||||
osRecvMesg(&queue, &recMsg, 1);
|
||||
osRecvMesg(&queue, &recMsg, OS_MESG_BLOCK);
|
||||
|
||||
if (recMsg != (OSMesg)666) {
|
||||
break;
|
||||
|
@ -957,7 +957,7 @@ void Fault_ThreadEntry(void* arg) {
|
|||
|
||||
while (true) {
|
||||
do {
|
||||
osRecvMesg(&sFaultStructPtr->queue, &msg, 1);
|
||||
osRecvMesg(&sFaultStructPtr->queue, &msg, OS_MESG_BLOCK);
|
||||
|
||||
if (msg == (OSMesg)1) {
|
||||
sFaultStructPtr->msgId = 1;
|
||||
|
|
|
@ -87,7 +87,7 @@ void Sched_HandleReset(SchedContext* sc) {
|
|||
if (sc->curRDPTask != NULL) {
|
||||
LOG_TIME("(((u64)(now - rdp_start_time)*(1000000LL/15625LL))/((62500000LL*3/4)/15625LL))",
|
||||
OS_CYCLES_TO_USEC(now - sRDPStartTime), "../sched.c", 431);
|
||||
osSendMesg(&sc->interruptQ, RDP_DONE_MSG, 0);
|
||||
osSendMesg(&sc->interruptQ, RDP_DONE_MSG, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2837,7 +2837,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC
|
|||
actorCtx->targetCtx.unk_90 = NULL;
|
||||
}
|
||||
|
||||
func_800F89E8(&actor->projectedPos);
|
||||
Audio_StopSfxByPos(&actor->projectedPos);
|
||||
Actor_Destroy(actor, globalCtx);
|
||||
|
||||
newHead = Actor_RemoveFromCategory(globalCtx, actorCtx, actor);
|
||||
|
|
|
@ -7129,7 +7129,7 @@ s32 Camera_CheckWater(Camera* camera) {
|
|||
camera->unk_150 = 0x50;
|
||||
}
|
||||
|
||||
func_800F6828(0x20);
|
||||
Audio_SetExtraFilter(0x20);
|
||||
|
||||
if (PREG(81)) {
|
||||
Quake_RemoveFromIdx(*quakeId);
|
||||
|
@ -7164,7 +7164,7 @@ s32 Camera_CheckWater(Camera* camera) {
|
|||
camera->unk_150 = 0;
|
||||
camera->unk_152 = 0;
|
||||
}
|
||||
func_800F6828(0);
|
||||
Audio_SetExtraFilter(0);
|
||||
}
|
||||
//! @bug: doesn't always return a value, but sometimes does.
|
||||
}
|
||||
|
|
|
@ -62,11 +62,11 @@ void EffectSs_ClearAll(GlobalContext* globalCtx) {
|
|||
|
||||
void EffectSs_Delete(EffectSs* effectSs) {
|
||||
if (effectSs->flags & 2) {
|
||||
func_800F89E8(&effectSs->pos);
|
||||
Audio_StopSfxByPos(&effectSs->pos);
|
||||
}
|
||||
|
||||
if (effectSs->flags & 4) {
|
||||
func_800F89E8(&effectSs->vec);
|
||||
Audio_StopSfxByPos(&effectSs->vec);
|
||||
}
|
||||
|
||||
EffectSs_Reset(effectSs);
|
||||
|
|
|
@ -205,7 +205,7 @@ void Gameplay_Init(GameState* thisx) {
|
|||
GameState_Realloc(&globalCtx->state, 0x1D4790);
|
||||
KaleidoManager_Init(globalCtx);
|
||||
View_Init(&globalCtx->view, gfxCtx);
|
||||
func_800F6828(0);
|
||||
Audio_SetExtraFilter(0);
|
||||
Quake_Init();
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
@ -402,7 +402,7 @@ void Gameplay_Init(GameState* thisx) {
|
|||
if (dREG(95) != 0) {
|
||||
D_8012D1F0 = D_801614D0;
|
||||
osSyncPrintf("\nkawauso_data=[%x]", D_8012D1F0);
|
||||
DmaMgr_DMARomToRam(0x03FEB000, (u32)D_8012D1F0, sizeof(D_801614D0));
|
||||
DmaMgr_DmaRomToRam(0x03FEB000, (u32)D_8012D1F0, sizeof(D_801614D0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void BgHakaShip_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
BgHakaShip* this = THIS;
|
||||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
func_800F89E8(&this->bellSoundPos);
|
||||
Audio_StopSfxByPos(&this->bellSoundPos);
|
||||
}
|
||||
|
||||
void BgHakaShip_ChildUpdatePosition(BgHakaShip* this, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -200,7 +200,7 @@ void BgHakaTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Collider_DestroyCylinder(globalCtx, &this->colliderCylinder);
|
||||
}
|
||||
|
||||
func_800F89E8(&this->unk_16C);
|
||||
Audio_StopSfxByPos(&this->unk_16C);
|
||||
}
|
||||
|
||||
void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -112,7 +112,7 @@ void BgHidanRock_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
func_800F89E8(&this->unk_170);
|
||||
Audio_StopSfxByPos(&this->unk_170);
|
||||
}
|
||||
|
||||
void func_8088B24C(BgHidanRock* this) {
|
||||
|
|
|
@ -335,7 +335,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) {
|
|||
if (this->unk16C > 3.0f) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WEB_VIBRATION);
|
||||
} else {
|
||||
Audio_StopSfx(NA_SE_EV_WEB_VIBRATION);
|
||||
Audio_StopSfxById(NA_SE_EV_WEB_VIBRATION);
|
||||
}
|
||||
}
|
||||
BgYdanSp_UpdateFloorWebCollision(this);
|
||||
|
|
|
@ -688,7 +688,7 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) {
|
|||
if ((this->work[FD2_HOLE_COUNTER] == 1) || (this->work[FD2_HOLE_COUNTER] == 40)) {
|
||||
this->work[FD2_SCREAM_TIMER] = 20;
|
||||
if (this->work[FD2_HOLE_COUNTER] == 40) {
|
||||
Audio_StopSfx(NA_SE_EN_VALVAISA_DEAD);
|
||||
Audio_StopSfxById(NA_SE_EN_VALVAISA_DEAD);
|
||||
}
|
||||
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_VALVAISA_DAMAGE2);
|
||||
|
|
|
@ -1022,11 +1022,11 @@ void func_808FFCFC(BossGanon2* this, GlobalContext* globalCtx) {
|
|||
ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x2800) {
|
||||
this->unk_311 = false;
|
||||
func_80900580(this, globalCtx);
|
||||
Audio_StopSfx(NA_SE_EN_MGANON_UNARI);
|
||||
Audio_StopSfxById(NA_SE_EN_MGANON_UNARI);
|
||||
} else if ((this->actor.bgCheckFlags & 8) && func_808FFA24(this, globalCtx)) {
|
||||
this->unk_311 = false;
|
||||
func_80900580(this, globalCtx);
|
||||
Audio_StopSfx(NA_SE_EN_MGANON_UNARI);
|
||||
Audio_StopSfxById(NA_SE_EN_MGANON_UNARI);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1889,12 +1889,12 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) {
|
|||
func_809000A0(this, globalCtx);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_HIT_THUNDER);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_DAMAGE);
|
||||
Audio_StopSfx(NA_SE_EN_MGANON_UNARI);
|
||||
Audio_StopSfxById(NA_SE_EN_MGANON_UNARI);
|
||||
} else if ((this->actionFunc == func_80900890) && (acHitInfo->toucher.dmgFlags & 0x9000200)) {
|
||||
this->unk_316 = 60;
|
||||
this->unk_342 = 5;
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_DAMAGE);
|
||||
Audio_StopSfx(NA_SE_EN_MGANON_UNARI);
|
||||
Audio_StopSfxById(NA_SE_EN_MGANON_UNARI);
|
||||
this->actor.colChkInfo.health -= 2;
|
||||
temp_v0_4 = this->actor.colChkInfo.health;
|
||||
if (temp_v0_4 < 0x15 && this->unk_334 == 0) {
|
||||
|
@ -1920,7 +1920,7 @@ void func_80902524(BossGanon2* this, GlobalContext* globalCtx) {
|
|||
this->unk_344 = 0x32;
|
||||
this->unk_342 = 5;
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_DAMAGE);
|
||||
Audio_StopSfx(NA_SE_EN_MGANON_UNARI);
|
||||
Audio_StopSfxById(NA_SE_EN_MGANON_UNARI);
|
||||
phi_v1_2 = 1;
|
||||
if (acHitInfo->toucher.dmgFlags & 0x9000200) {
|
||||
if (acHitInfo->toucher.dmgFlags & 0x8000000) {
|
||||
|
|
|
@ -1837,7 +1837,7 @@ void BossGoma_UpdateHit(BossGoma* this, GlobalContext* globalCtx) {
|
|||
} else if (this->actionFunc != BossGoma_FloorStunned && this->patienceTimer != 0 &&
|
||||
(acHitInfo->toucher.dmgFlags & 0x00000005)) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_DAM2);
|
||||
Audio_StopSfx(NA_SE_EN_GOMA_CRY1);
|
||||
Audio_StopSfxById(NA_SE_EN_GOMA_CRY1);
|
||||
this->invincibilityFrames = 10;
|
||||
BossGoma_SetupFloorStunned(this);
|
||||
this->sfxFaintTimer = 100;
|
||||
|
|
|
@ -2262,7 +2262,7 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->actor.draw = NULL;
|
||||
if (this->tent2KillTimer > 20) {
|
||||
Actor_Kill(&this->actor);
|
||||
func_800F89E8(&this->tentTipPos);
|
||||
Audio_StopSfxByPos(&this->tentTipPos);
|
||||
sMorphaTent2 = NULL;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -342,7 +342,7 @@ void BossSst_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
Collider_DestroyJntSph(globalCtx, &this->colliderJntSph);
|
||||
Collider_DestroyCylinder(globalCtx, &this->colliderCyl);
|
||||
func_800F89E8(&this->center);
|
||||
Audio_StopSfxByPos(&this->center);
|
||||
}
|
||||
|
||||
void BossSst_HeadSetupLurk(BossSst* this) {
|
||||
|
|
|
@ -338,7 +338,7 @@ void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx)
|
|||
void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) {
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
if (func_800C0DB4(globalCtx, &this->actor.projectedPos)) {
|
||||
func_800F6828(0);
|
||||
Audio_SetExtraFilter(0);
|
||||
}
|
||||
if (this->subCamId != 0) {
|
||||
Math_ApproachF(&this->camEye.x, this->unk_2D0.x, this->unk_2DC.x, this->unk_2E8.x * this->unk_318);
|
||||
|
|
|
@ -244,7 +244,7 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) {
|
|||
scorePos.y = this->actor.world.pos.y + 20.0f;
|
||||
scorePos.z = this->actor.world.pos.z;
|
||||
EffectSsExtra_Spawn(globalCtx, &scorePos, &scoreVel, &scoreAccel, 4, 2);
|
||||
Audio_StopSfx(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
Audio_StopSfxById(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
// "Big hit"
|
||||
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 大当り ☆☆☆☆☆ %d\n" VT_RST, this->hitCounter);
|
||||
|
|
|
@ -838,7 +838,7 @@ void EnGeldB_SetupSlash(EnGeldB* this) {
|
|||
this->action = GELDB_SLASH;
|
||||
this->spinAttackState = 0;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_GERUDOFT_BREATH);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_GERUDOFT_BREATH);
|
||||
EnGeldB_SetupAction(this, EnGeldB_Slash);
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.colChkInfo.damageEffect != GELDB_DMG_UNK_6) {
|
||||
this->damageEffect = this->actor.colChkInfo.damageEffect;
|
||||
Actor_SetDropFlag(&this->actor, &this->bodyCollider.info, 1);
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_GERUDOFT_BREATH);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_GERUDOFT_BREATH);
|
||||
if ((this->actor.colChkInfo.damageEffect == GELDB_DMG_STUN) ||
|
||||
(this->actor.colChkInfo.damageEffect == GELDB_DMG_FREEZE)) {
|
||||
if (this->action != GELDB_STUNNED) {
|
||||
|
|
|
@ -506,12 +506,12 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
|
|||
if (globalCtx->msgCtx.choiceIndex == 0) {
|
||||
this->actor.textId = gSaveContext.infTable[16] & 0x800 ? 0x3033 : 0x3035;
|
||||
if (this->actor.textId == 0x3035) {
|
||||
Audio_StopSfx(0x39EB);
|
||||
Audio_StopSfxById(NA_SE_EN_GOLON_CRY);
|
||||
}
|
||||
} else {
|
||||
this->actor.textId = gSaveContext.infTable[16] & 0x800 ? 0x3036 : 0x3033;
|
||||
if (this->actor.textId == 0x3036) {
|
||||
Audio_StopSfx(0x39EB);
|
||||
Audio_StopSfxById(NA_SE_EN_GOLON_CRY);
|
||||
}
|
||||
}
|
||||
func_8010B720(globalCtx, this->actor.textId);
|
||||
|
|
|
@ -899,7 +899,7 @@ void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
EnHorse* this = THIS;
|
||||
|
||||
if (this->stateFlags & ENHORSE_DRAW) {
|
||||
func_800F89E8(&this->unk_21C);
|
||||
Audio_StopSfxByPos(&this->unk_21C);
|
||||
}
|
||||
func_800A6888(globalCtx, &this->skin);
|
||||
Collider_DestroyCylinder(globalCtx, &this->cyl1);
|
||||
|
|
|
@ -699,7 +699,7 @@ void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
if (func_8010BDBC(&globalCtx->msgCtx) == 4) {
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG);
|
||||
if (globalCtx->msgCtx.choiceIndex == 0) {
|
||||
if (Inventory_HasEmptyBottle()) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_BIG_GET);
|
||||
|
|
|
@ -443,7 +443,7 @@ void EnPoh_Talk(EnPoh* this, GlobalContext* globalCtx) {
|
|||
|
||||
void func_80ADE950(EnPoh* this, s32 arg1) {
|
||||
if (arg1) {
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG);
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH);
|
||||
}
|
||||
this->actionFunc = func_80AE009C;
|
||||
|
@ -816,7 +816,7 @@ void EnPoh_TalkRegular(EnPoh* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
if (func_8010BDBC(&globalCtx->msgCtx) == 4) {
|
||||
if (func_80106BC8(globalCtx) != 0) {
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_PO_BIG_CRY - SFX_FLAG);
|
||||
if (globalCtx->msgCtx.choiceIndex == 0) {
|
||||
if (Inventory_HasEmptyBottle()) {
|
||||
this->actor.textId = 0x5008;
|
||||
|
|
|
@ -894,7 +894,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) {
|
|||
|
||||
void EnTest_SetupSlashDown(EnTest* this) {
|
||||
Animation_PlayOnce(&this->skelAnime, &gStalfosDownSlashAnim);
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU);
|
||||
this->swordCollider.base.atFlags &= ~AT_BOUNCED;
|
||||
this->unk_7C8 = 0x10;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
|
@ -1076,7 +1076,7 @@ void EnTest_JumpBack(EnTest* this, GlobalContext* globalCtx) {
|
|||
|
||||
void EnTest_SetupJumpslash(EnTest* this) {
|
||||
Animation_PlayOnce(&this->skelAnime, &gStalfosJumpAnim);
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU);
|
||||
this->timer = 0;
|
||||
this->unk_7C8 = 0x17;
|
||||
this->actor.velocity.y = 10.0f;
|
||||
|
@ -1669,7 +1669,7 @@ void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) {
|
|||
this->unk_7DC = player->unk_845;
|
||||
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
|
||||
Actor_SetDropFlag(&this->actor, &this->bodyCollider.info, false);
|
||||
func_800F8A44(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU);
|
||||
Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU);
|
||||
|
||||
if ((this->actor.colChkInfo.damageEffect == STALFOS_DMGEFF_STUN) ||
|
||||
(this->actor.colChkInfo.damageEffect == STALFOS_DMGEFF_FREEZE) ||
|
||||
|
|
|
@ -404,7 +404,7 @@ void EnViewer_UpdateImpl(EnViewer* this, GlobalContext* globalCtx) {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
func_800F67A0(0);
|
||||
Audio_SetBaseFilter(0);
|
||||
switch (this->state) {
|
||||
case 0:
|
||||
Animation_PlayLoopSetSpeed(&this->skin.skelAnime, &object_opening_demo1_Anim_00504C, 1.0f);
|
||||
|
|
|
@ -307,7 +307,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) {
|
|||
|
||||
if ((player->stateFlags1 & 0x100000) || (player->stateFlags1 & 0x8000000) || !(player->actor.bgCheckFlags & 1) ||
|
||||
((this->actor.params == 1) && (320.0f < Math_Vec3f_DistXZ(&this->actor.home.pos, playerPos)))) {
|
||||
Audio_StopSfx(NA_SE_EN_FALL_AIM);
|
||||
Audio_StopSfxById(NA_SE_EN_FALL_AIM);
|
||||
this->timer = 0x82;
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ void func_80B42F74(EnYabusameMark* this, GlobalContext* globalCtx) {
|
|||
func_800F5C64(NA_BGM_ITEM_GET | 0x900);
|
||||
}
|
||||
if (scoreIndex == 1) {
|
||||
Audio_StopSfx(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
Audio_StopSfxById(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
|
||||
}
|
||||
if (scoreIndex == 0) {
|
||||
|
|
|
@ -1292,7 +1292,7 @@ void func_808326F0(Player* this) {
|
|||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
Audio_StopSfx((u16)(*entry + this->ageProperties->unk_92));
|
||||
Audio_StopSfxById((u16)(*entry + this->ageProperties->unk_92));
|
||||
entry++;
|
||||
}
|
||||
}
|
||||
|
@ -5540,10 +5540,10 @@ void func_8083D36C(GlobalContext* globalCtx, Player* this) {
|
|||
|
||||
void func_8083D53C(GlobalContext* globalCtx, Player* this) {
|
||||
if (this->actor.yDistToWater < this->ageProperties->unk_2C) {
|
||||
func_800F67A0(0);
|
||||
Audio_SetBaseFilter(0);
|
||||
this->unk_840 = 0;
|
||||
} else {
|
||||
func_800F67A0(32);
|
||||
Audio_SetBaseFilter(0x20);
|
||||
if (this->unk_840 < 300) {
|
||||
this->unk_840++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue