diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 221b808a..b5d17241 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -25377,9 +25377,9 @@ Update__Q44nw4r3snd6detail9SeqPlayerFv = .text:0x80472180; // type:function size UpdateTick__Q44nw4r3snd6detail9SeqPlayerFi = .text:0x80472290; // type:function size:0x264 SkipTick__Q44nw4r3snd6detail9SeqPlayerFv = .text:0x80472500; // type:function size:0x294 NoteOn__Q44nw4r3snd6detail9SeqPlayerFiRCQ44nw4r3snd6detail10NoteOnInfo = .text:0x804727A0; // type:function size:0x28 -ChannelCallback__Q44nw4r3snd6detail9SeqPlayerFPQ44nw4r3snd6detail7Channel = .text:0x804727D0; // type:function size:0x4 -@180@__dt__Q44nw4r3snd6detail9SeqPlayerFv = .text:0x804727E0; // type:function size:0x8 -@192@__dt__Q44nw4r3snd6detail9SeqPlayerFv = .text:0x804727F0; // type:function size:0x8 +ChannelCallback__Q44nw4r3snd6detail9SeqPlayerFPQ44nw4r3snd6detail7Channel = .text:0x804727D0; // type:function size:0x4 scope:weak +@180@__dt__Q44nw4r3snd6detail9SeqPlayerFv = .text:0x804727E0; // type:function size:0x8 scope:weak +@192@__dt__Q44nw4r3snd6detail9SeqPlayerFv = .text:0x804727F0; // type:function size:0x8 scope:weak __ct__Q44nw4r3snd6detail8SeqSoundFPQ44nw4r3snd6detail49SoundInstanceManagerii = .text:0x80472800; // type:function size:0x9C __dt__Q54nw4r3snd6detail8SeqSound11SeqLoadTaskFv = .text:0x804728A0; // type:function size:0x58 InitParam__Q44nw4r3snd6detail8SeqSoundFv = .text:0x80472900; // type:function size:0x34 @@ -38602,10 +38602,10 @@ __vt__Q44nw4r3snd6detail20MmlSeqTrackAllocator = .data:0x8056DF58; // type:objec lbl_8056DF70 = .data:0x8056DF70; // type:object size:0x60 lbl_8056DFD0 = .data:0x8056DFD0; // type:object size:0x20 __vt__Q44nw4r3snd6detail10PlayerHeap = .data:0x8056DFF0; // type:object size:0x10 -lbl_8056E000 = .data:0x8056E000; // type:object size:0xC data:4byte -lbl_8056E00C = .data:0x8056E00C; // type:object size:0xC data:4byte -lbl_8056E018 = .data:0x8056E018; // type:object size:0xC data:4byte -lbl_8056E024 = .data:0x8056E024; // type:object size:0x64 +@4081 = .data:0x8056E000; // type:object size:0xC scope:local data:4byte +@4096 = .data:0x8056E00C; // type:object size:0xC scope:local data:4byte +@4111 = .data:0x8056E018; // type:object size:0xC scope:local data:4byte +__vt__Q44nw4r3snd6detail9SeqPlayer = .data:0x8056E024; // type:object size:0x64 lbl_8056E088 = .data:0x8056E088; // type:object size:0x38 lbl_8056E0C0 = .data:0x8056E0C0; // type:object size:0x18 __vt__Q44nw4r3snd6detail8SeqTrack = .data:0x8056E0D8; // type:object size:0x10 @@ -49704,10 +49704,10 @@ lbl_8057F014 = .sdata2:0x8057F014; // type:object size:0x4 align:4 data:float @3182 = .sdata2:0x8057F054; // type:object size:0x4 scope:local align:4 data:float @3191 = .sdata2:0x8057F058; // type:object size:0x8 scope:local align:8 data:double @3192 = .sdata2:0x8057F060; // type:object size:0x8 scope:local align:8 data:double -lbl_8057F068 = .sdata2:0x8057F068; // type:object size:0x4 align:4 data:float -lbl_8057F06C = .sdata2:0x8057F06C; // type:object size:0x4 align:4 data:float -lbl_8057F070 = .sdata2:0x8057F070; // type:object size:0x8 align:8 data:double -lbl_8057F078 = .sdata2:0x8057F078; // type:object size:0x4 align:4 data:float +@3811 = .sdata2:0x8057F068; // type:object size:0x4 scope:local align:4 data:float +@3812 = .sdata2:0x8057F06C; // type:object size:0x4 scope:local align:4 data:float +@4051 = .sdata2:0x8057F070; // type:object size:0x8 scope:local align:8 data:double +@4321 = .sdata2:0x8057F078; // type:object size:0x4 scope:local align:4 data:float @2980 = .sdata2:0x8057F080; // type:object size:0x4 scope:local align:4 data:float @2981 = .sdata2:0x8057F084; // type:object size:0x4 scope:local align:4 data:float @3311 = .sdata2:0x8057F088; // type:object size:0x4 scope:local align:4 data:float @@ -51939,7 +51939,7 @@ sBiquadFilterCallbackTable__Q44nw4r3snd6detail9AxManager = .bss:0x80659080; // t @781 = .bss:0x806593F8; // type:object size:0xC scope:local @LOCAL@GetInstance__Q44nw4r3snd6detail22DisposeCallbackManagerFv@instance = .bss:0x80659404; // type:object size:0xC scope:weak data:4byte @LOCAL@GetInstance__Q44nw4r3snd6detail20RemoteSpeakerManagerFv@instance = .bss:0x80659410; // type:object size:0x2D8 scope:weak data:byte -lbl_806596E8 = .bss:0x806596E8; // type:object size:0x20 data:2byte +mGlobalVariable__Q44nw4r3snd6detail9SeqPlayer = .bss:0x806596E8; // type:object size:0x20 data:2byte lbl_80659708 = .bss:0x80659708; // type:object size:0x18 @1420 = .bss:0x80659720; // type:object size:0xC scope:local @LOCAL@detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFv@tmplist = .bss:0x80659730; // type:object size:0x600 scope:weak data:4byte diff --git a/configure.py b/configure.py index 72238d19..3157afb0 100644 --- a/configure.py +++ b/configure.py @@ -1048,7 +1048,7 @@ config.libs = [ Object(Matching, "nw4r/snd/snd_RemoteSpeaker.cpp"), Object(Matching, "nw4r/snd/snd_RemoteSpeakerManager.cpp"), Object(Matching, "nw4r/snd/snd_SeqFile.cpp"), - Object(NonMatching, "nw4r/snd/snd_SeqPlayer.cpp"), + Object(Matching, "nw4r/snd/snd_SeqPlayer.cpp"), Object(NonMatching, "nw4r/snd/snd_SeqSound.cpp"), Object(NonMatching, "nw4r/snd/snd_SeqSoundHandle.cpp"), Object(Matching, "nw4r/snd/snd_SeqTrack.cpp"), diff --git a/include/nw4r/snd/snd_SeqPlayer.h b/include/nw4r/snd/snd_SeqPlayer.h index 50467dfa..cb4c1a52 100644 --- a/include/nw4r/snd/snd_SeqPlayer.h +++ b/include/nw4r/snd/snd_SeqPlayer.h @@ -9,7 +9,9 @@ #include "nw4r/snd/snd_BasicPlayer.h" #include "nw4r/snd/snd_DisposeCallbackManager.h" // DisposeCallback +#include "nw4r/snd/snd_SeqTrack.h" #include "nw4r/snd/snd_SoundThread.h" +#include "nw4r/ut/ut_Lock.h" /******************************************************************************* * types @@ -128,6 +130,10 @@ namespace nw4r { namespace snd { namespace detail SeqTrack *GetPlayerTrack(int trackNo); s16 volatile *GetVariablePtr(int varNo); + s16 GetLocalVariable(int varNo) const; + void SetLocalVariable(int varNo, s16 value); + static void SetGlobalVariable(int varNo, s16 value); + void SetTempoRatio(f32 tempo); void SetReleasePriorityFix(bool fix); void SetChannelPriority(int priority); @@ -148,6 +154,10 @@ namespace nw4r { namespace snd { namespace detail void CallSeqUserprocCallback(u16 procId, SeqTrack *track); Channel *NoteOn(int bankNo, NoteOnInfo const ¬eOnInfo); + void SetTrackMute(u32 trackFlags, SeqMute mute); + void SetTrackSilence(u32 trackFlags, bool silence, int fadeFrames); + void SetTrackVolume(u32 trackFlags, f32 volume); + static void InitSeqPlayer(); private: @@ -162,6 +172,40 @@ namespace nw4r { namespace snd { namespace detail void UpdateTick(int msec); void SkipTick(); + template + void SetTrackParam(u32 trackFlags, void (SeqTrack::*pSetter)(T), T param) { + ut::AutoInterruptLock lock; + + for (int i = 0; i < TRACK_NUM && trackFlags != 0; + trackFlags >>= 1, i++) { + + if (trackFlags & 1) { + SeqTrack* pTrack = GetPlayerTrack(i); + + if (pTrack != NULL) { + (pTrack->*pSetter)(param); + } + } + } + } + + template + void SetTrackParam(u32 trackFlags, void (SeqTrack::*pSetter)(T, U), T param, U param2) { + ut::AutoInterruptLock lock; + + for (int i = 0; i < TRACK_NUM && trackFlags != 0; + trackFlags >>= 1, i++) { + + if (trackFlags & 1) { + SeqTrack* pTrack = GetPlayerTrack(i); + + if (pTrack != NULL) { + (pTrack->*pSetter)(param, param2); + } + } + } + } + // static members public: static int const MAX_SKIP_TICK_PER_FRAME = 768; @@ -172,6 +216,8 @@ namespace nw4r { namespace snd { namespace detail static int const GLOBAL_VARIABLE_NUM = 16; static int const PLAYER_VARIABLE_NUM = 16; + static const int TRACK_NUM = 16; + private: static s16 mGlobalVariable[GLOBAL_VARIABLE_NUM]; diff --git a/src/nw4r/snd/snd_SeqPlayer.cpp b/src/nw4r/snd/snd_SeqPlayer.cpp index 481c9e6b..ed40614c 100644 --- a/src/nw4r/snd/snd_SeqPlayer.cpp +++ b/src/nw4r/snd/snd_SeqPlayer.cpp @@ -286,6 +286,30 @@ void SeqPlayer::CallSeqUserprocCallback(u16 procId, SeqTrack *track) trackParam.cmpFlag = param.cmpFlag; } +s16 SeqPlayer::GetLocalVariable(int varNo) const { + return mLocalVariable[varNo]; +} + +void SeqPlayer::SetLocalVariable(int varNo, s16 value) { + mLocalVariable[varNo] = value; +} + +void SeqPlayer::SetGlobalVariable(int varNo, s16 value) { + mGlobalVariable[varNo] = value; +} + +void SeqPlayer::SetTrackMute(u32 trackFlags, SeqMute mute) { + SetTrackParam(trackFlags, &SeqTrack::SetMute, mute); +} + +void SeqPlayer::SetTrackSilence(u32 trackFlags, bool silence, int fadeFrames) { + SetTrackParam(trackFlags, &SeqTrack::SetSilence, silence, fadeFrames); +} + +void SeqPlayer::SetTrackVolume(u32 trackFlags, f32 volume) { + SetTrackParam(trackFlags, &SeqTrack::SetVolume, volume); +} + #if 0 // SeqPlayer::GetLocalVariable? maybe all of them? DECOMP_FORCE(NW4RAssertHeaderClampedLValue_String(varNo));