diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index eeb8d588..28275ab0 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -3140,6 +3140,8 @@ nw4r/snd/snd_WsdFile.cpp: nw4r/snd/snd_WsdPlayer.cpp: .text start:0x80485830 end:0x804869D8 align:16 + .data start:0x8056E388 end:0x8056E3E8 + .sdata2 start:0x8057F1F8 end:0x8057F220 nw4r/snd/snd_adpcm.cpp: .text start:0x804869E0 end:0x80486A6C align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 15dee1a5..e2399f25 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -25836,18 +25836,18 @@ Update__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x80486000; // type:function size StartChannel__Q44nw4r3snd6detail9WsdPlayerFPCQ54nw4r3snd6detail9WsdPlayer11WsdCallbackUl = .text:0x804862B0; // type:function size:0x1B8 UpdateChannel__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x80486470; // type:function size:0x404 ChannelCallbackFunc__Q44nw4r3snd6detail9WsdPlayerFPQ44nw4r3snd6detail7ChannelQ54nw4r3snd6detail7Channel21ChannelCallbackStatusUl = .text:0x80486880; // type:function size:0x70 -OnUpdateFrameSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804868F0; // type:function size:0x4 -OnShutdownSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x80486900; // type:function size:0x10 -InvalidateWaveData__Q44nw4r3snd6detail9WsdPlayerFPCvPCv = .text:0x80486910; // type:function size:0x4 -IsPause__Q44nw4r3snd6detail9WsdPlayerCFv = .text:0x80486920; // type:function size:0x14 -IsStarted__Q44nw4r3snd6detail9WsdPlayerCFv = .text:0x80486940; // type:function size:0x14 -IsActive__Q44nw4r3snd6detail9WsdPlayerCFv = .text:0x80486960; // type:function size:0x14 -@180@InvalidateWaveData__Q44nw4r3snd6detail9WsdPlayerFPCvPCv = .text:0x80486980; // type:function size:0x8 -@180@InvalidateData__Q44nw4r3snd6detail9WsdPlayerFPCvPCv = .text:0x80486990; // type:function size:0x8 -@180@__dt__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869A0; // type:function size:0x8 -@192@OnShutdownSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869B0; // type:function size:0x8 -@192@OnUpdateFrameSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869C0; // type:function size:0x8 -@192@__dt__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869D0; // type:function size:0x8 +OnUpdateFrameSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804868F0; // type:function size:0x4 scope:weak +OnShutdownSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x80486900; // type:function size:0x10 scope:weak +InvalidateWaveData__Q44nw4r3snd6detail9WsdPlayerFPCvPCv = .text:0x80486910; // type:function size:0x4 scope:weak +IsPause__Q44nw4r3snd6detail9WsdPlayerCFv = .text:0x80486920; // type:function size:0x14 scope:weak +IsStarted__Q44nw4r3snd6detail9WsdPlayerCFv = .text:0x80486940; // type:function size:0x14 scope:weak +IsActive__Q44nw4r3snd6detail9WsdPlayerCFv = .text:0x80486960; // type:function size:0x14 scope:weak +@180@InvalidateWaveData__Q44nw4r3snd6detail9WsdPlayerFPCvPCv = .text:0x80486980; // type:function size:0x8 scope:weak +@180@InvalidateData__Q44nw4r3snd6detail9WsdPlayerFPCvPCv = .text:0x80486990; // type:function size:0x8 scope:weak +@180@__dt__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869A0; // type:function size:0x8 scope:weak +@192@OnShutdownSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869B0; // type:function size:0x8 scope:weak +@192@OnUpdateFrameSoundThread__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869C0; // type:function size:0x8 scope:weak +@192@__dt__Q44nw4r3snd6detail9WsdPlayerFv = .text:0x804869D0; // type:function size:0x8 scope:weak DecodeDspAdpcm__Q34nw4r3snd6detailFP10_AXPBADPCMUc = .text:0x804869E0; // type:function size:0x8C LytInit__Q24nw4r3lytFv = .text:0x80486A70; // type:function size:0x54 __ct__Q34nw4r3lyt4PaneFPCQ44nw4r3lyt3res4Pane = .text:0x80486AD0; // type:function size:0x128 @@ -38627,7 +38627,7 @@ jumptable_8056E308 = .data:0x8056E308; // type:object size:0x24 scope:local lbl_8056E32C = .data:0x8056E32C; // type:object size:0x14 PanTableTable__Q44nw4r3snd6detail4Util = .data:0x8056E340; // type:object size:0xC __vt__Q44nw4r3snd6detail9WaveSound = .data:0x8056E350; // type:object size:0x38 -lbl_8056E388 = .data:0x8056E388; // type:object size:0x60 +__vt__Q44nw4r3snd6detail9WsdPlayer = .data:0x8056E388; // type:object size:0x60 @324 = .data:0x8056E3E8; // type:object size:0x46 scope:local data:string __vt__Q34nw4r3lyt4Pane = .data:0x8056E430; // type:object size:0x74 __vt__Q34nw4r3lyt5Group = .data:0x8056E4A8; // type:object size:0xC @@ -49784,13 +49784,13 @@ lbl_8057F1B8 = .sdata2:0x8057F1B8; // type:object size:0x4 align:4 data:float @410 = .sdata2:0x8057F1E8; // type:object size:0x4 scope:local align:4 data:float @411 = .sdata2:0x8057F1EC; // type:object size:0x4 scope:local align:4 data:float @1628 = .sdata2:0x8057F1F0; // type:object size:0x4 scope:local align:4 data:float -lbl_8057F1F8 = .sdata2:0x8057F1F8; // type:object size:0x4 align:4 data:float -lbl_8057F1FC = .sdata2:0x8057F1FC; // type:object size:0x4 align:4 data:float -lbl_8057F200 = .sdata2:0x8057F200; // type:object size:0x4 align:4 data:float -lbl_8057F204 = .sdata2:0x8057F204; // type:object size:0x4 align:4 data:float -lbl_8057F208 = .sdata2:0x8057F208; // type:object size:0x4 align:4 data:float -lbl_8057F210 = .sdata2:0x8057F210; // type:object size:0x8 align:8 data:double -lbl_8057F218 = .sdata2:0x8057F218; // type:object size:0x8 align:8 data:double +@2739 = .sdata2:0x8057F1F8; // type:object size:0x4 scope:local align:4 data:float +@3148 = .sdata2:0x8057F1FC; // type:object size:0x4 scope:local align:4 data:float +@3149 = .sdata2:0x8057F200; // type:object size:0x4 scope:local align:4 data:float +@3150 = .sdata2:0x8057F204; // type:object size:0x4 scope:local align:4 data:float +@3151 = .sdata2:0x8057F208; // type:object size:0x4 scope:local align:4 data:float +@3155 = .sdata2:0x8057F210; // type:object size:0x8 scope:local align:8 data:double +@3156 = .sdata2:0x8057F218; // type:object size:0x8 scope:local align:8 data:double @5330 = .sdata2:0x8057F220; // type:object size:0x4 scope:local align:4 data:float @5331 = .sdata2:0x8057F224; // type:object size:0x4 scope:local align:4 data:float @5589 = .sdata2:0x8057F228; // type:object size:0x4 scope:local align:4 data:float diff --git a/configure.py b/configure.py index ce7ab97b..92bf7d63 100644 --- a/configure.py +++ b/configure.py @@ -1084,7 +1084,7 @@ config.libs = [ Object(Matching, "nw4r/snd/snd_WaveSound.cpp"), Object(Matching, "nw4r/snd/snd_WaveSoundHandle.cpp"), Object(Matching, "nw4r/snd/snd_WsdFile.cpp"), - Object(NonMatching, "nw4r/snd/snd_WsdPlayer.cpp"), + Object(Matching, "nw4r/snd/snd_WsdPlayer.cpp"), Object(Matching, "nw4r/snd/snd_adpcm.cpp"), ], mw_version="Wii/1.6", diff --git a/include/nw4r/snd/snd_WsdPlayer.h b/include/nw4r/snd/snd_WsdPlayer.h index 6116cf0e..5cf90b48 100644 --- a/include/nw4r/snd/snd_WsdPlayer.h +++ b/include/nw4r/snd/snd_WsdPlayer.h @@ -18,7 +18,16 @@ * classes and functions */ -namespace nw4r { namespace snd { namespace detail +namespace nw4r { namespace snd { + +struct WsdDataInfo { + /* 0x00 */ bool loopFlag; + /* 0x04 */ int sampleRate; + /* 0x08 */ u32 loopStart; + /* 0x0C */ u32 loopEnd; +}; + +namespace detail { // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x30b74 class WsdPlayer : public BasicPlayer, @@ -98,6 +107,7 @@ namespace nw4r { namespace snd { namespace detail { return mChannel != nullptr && mChannel->IsActive(); } + bool ReadWsdDataInfo(WsdDataInfo*) const; u32 GetPlaySamplePosition() const; private: diff --git a/src/nw4r/snd/snd_WsdPlayer.cpp b/src/nw4r/snd/snd_WsdPlayer.cpp index c7f60adc..2b4734c6 100644 --- a/src/nw4r/snd/snd_WsdPlayer.cpp +++ b/src/nw4r/snd/snd_WsdPlayer.cpp @@ -141,6 +141,23 @@ void WsdPlayer::InvalidateData(void const *start, void const *end) } } +bool WsdPlayer::ReadWsdDataInfo(WsdDataInfo *info) const +{ + SoundThread::AutoLock lock; + + WaveSoundInfo wsInfo; + WaveSoundNoteInfo wsNoteInfo; + WaveInfo waveInfo; + bool result = mCallback->GetWaveSoundData(&wsInfo, &wsNoteInfo, &waveInfo, mWsdData, mWsdIndex, 0, mCallbackData); + if (result) { + info->loopFlag = waveInfo.loopFlag != false; + info->sampleRate = waveInfo.sampleRate; + info->loopStart = waveInfo.loopStart; + info->loopEnd = waveInfo.loopEnd; + } + return result; +} + void WsdPlayer::FinishPlayer() { SoundThread::AutoLock lock; @@ -349,6 +366,9 @@ void WsdPlayer::UpdateChannel() mChannel->SetFxSend(bus, fxSend[i]); } + for (int i = 0; i < 4; i++) + mChannel->SetRemoteOutVolume(i, GetRemoteOutVolume(i)); + for (int i = 0; i < mVoiceOutCount; i++) mChannel->SetVoiceOutParam(i, GetVoiceOutParam(i));