From cb438c5fc6fcda31d1d783e3445cd7a3cf9ecc3b Mon Sep 17 00:00:00 2001 From: robojumper Date: Mon, 26 May 2025 22:16:08 +0200 Subject: [PATCH] snd_SoundPlayer OK --- config/SOUE01/splits.txt | 3 +++ config/SOUE01/symbols.txt | 20 ++++++++++---------- configure.py | 2 +- include/nw4r/snd/snd_SoundPlayer.h | 4 ++++ src/nw4r/snd/snd_SoundPlayer.cpp | 29 +++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index f98e1429..ec39f061 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -3069,6 +3069,9 @@ nw4r/snd/snd_SoundHeap.cpp: nw4r/snd/snd_SoundPlayer.cpp: .text start:0x8047B420 end:0x8047C050 align:16 + .sbss start:0x805766B0 end:0x805766B8 + .sdata2 start:0x8057F148 end:0x8057F150 + .bss start:0x80659720 end:0x80659D40 nw4r/snd/snd_SoundStartable.cpp: .text start:0x8047C050 end:0x8047C3AC align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 4e7dae7f..586bc28d 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -25594,19 +25594,19 @@ SaveState__Q34nw4r3snd9SoundHeapFv = .text:0x8047B2D0; // type:function size:0x5 LoadState__Q34nw4r3snd9SoundHeapFi = .text:0x8047B330; // type:function size:0x74 DisposeCallbackFunc__Q34nw4r3snd9SoundHeapFPvUlPv = .text:0x8047B3B0; // type:function size:0x68 __ct__Q34nw4r3snd11SoundPlayerFv = .text:0x8047B420; // type:function size:0x8C -__ct__Q34nw4r2ut44LinkListFv = .text:0x8047B4B0; // type:function size:0x18 -__dt__Q34nw4r2ut44LinkListFv = .text:0x8047B4D0; // type:function size:0x58 +__ct__Q34nw4r2ut44LinkListFv = .text:0x8047B4B0; // type:function size:0x18 scope:weak +__dt__Q34nw4r2ut44LinkListFv = .text:0x8047B4D0; // type:function size:0x58 scope:weak __dt__Q34nw4r3snd11SoundPlayerFv = .text:0x8047B530; // type:function size:0xD4 Update__Q34nw4r3snd11SoundPlayerFv = .text:0x8047B610; // type:function size:0x7C StopAllSound__Q34nw4r3snd11SoundPlayerFi = .text:0x8047B690; // type:function size:0x78 PauseAllSound__Q34nw4r3snd11SoundPlayerFbi = .text:0x8047B710; // type:function size:0x88 -nw4r__snd__SoundPlayer__SetMainOutVolume = .text:0x8047B7A0; // type:function size:0x18 -SetDefaultOutputLine__Q34nw4r3snd11SoundPlayerFi = .text:0x8047B7C0; // type:function size:0x8 +SetVolume__Q34nw4r3snd11SoundPlayerFf = .text:0x8047B7A0; // type:function size:0x18 +SetLpfFreq__Q34nw4r3snd11SoundPlayerFf = .text:0x8047B7C0; // type:function size:0x8 GetRemoteOutVolume__Q34nw4r3snd11SoundPlayerCFi = .text:0x8047B7D0; // type:function size:0x10 SetFxSend__Q34nw4r3snd11SoundPlayerFQ34nw4r3snd6AuxBusf = .text:0x8047B7E0; // type:function size:0x10 detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047B7F0; // type:function size:0xF8 detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFv = .text:0x8047B8F0; // type:function size:0x184 -__arraydtor$1018 = .text:0x8047BA80; // type:function size:0x1C +__arraydtor$1419 = .text:0x8047BA80; // type:function size:0x1C scope:local detail_AppendSound__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047BAA0; // type:function size:0x1DC detail_RemoveSound__Q34nw4r3snd11SoundPlayerFPQ44nw4r3snd6detail10BasicSound = .text:0x8047BC80; // type:function size:0x88 SetPlayableSoundCount__Q34nw4r3snd11SoundPlayerFi = .text:0x8047BD10; // type:function size:0x90 @@ -42431,7 +42431,7 @@ lbl_80576698 = .sbss:0x80576698; // type:object size:0x4 data:4byte lbl_8057669C = .sbss:0x8057669C; // type:object size:0x1 data:byte @GUARD@GetInstance__Q44nw4r3snd6detail20RemoteSpeakerManagerFv@instance = .sbss:0x805766A0; // type:object size:0x1 scope:weak data:byte lbl_805766A8 = .sbss:0x805766A8; // type:object size:0x8 data:4byte -lbl_805766B0 = .sbss:0x805766B0; // type:object size:0x8 data:byte +@GUARD@detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFv@tmplist = .sbss:0x805766B0; // type:object size:0x1 scope:weak data:byte sInitialized__Q34nw4r3snd29@unnamed@snd_SoundSystem_cpp@ = .sbss:0x805766B8; // type:object size:0x1 scope:local data:byte sMaxVoices__Q34nw4r3snd11SoundSystem = .sbss:0x805766BC; // type:object size:0x4 data:4byte @GUARD@GetInstance__Q44nw4r3snd6detail11SoundThreadFv@instance = .sbss:0x805766C0; // type:object size:0x1 scope:weak data:byte @@ -49747,8 +49747,8 @@ lbl_8057F130 = .sdata2:0x8057F130; // type:object size:0x4 align:4 data:float lbl_8057F134 = .sdata2:0x8057F134; // type:object size:0x4 align:4 data:float lbl_8057F138 = .sdata2:0x8057F138; // type:object size:0x4 align:4 data:float lbl_8057F140 = .sdata2:0x8057F140; // type:object size:0x8 align:8 data:double -lbl_8057F148 = .sdata2:0x8057F148; // type:object size:0x4 align:4 data:float -lbl_8057F14C = .sdata2:0x8057F14C; // type:object size:0x4 align:4 data:float +@2452 = .sdata2:0x8057F148; // type:object size:0x4 scope:local align:4 data:float +@2453 = .sdata2:0x8057F14C; // type:object size:0x4 scope:local align:4 data:float @5421 = .sdata2:0x8057F150; // type:object size:0x4 scope:local align:4 data:float @5423 = .sdata2:0x8057F158; // type:object size:0x8 scope:local align:8 data:double @5425 = .sdata2:0x8057F160; // type:object size:0x8 scope:local align:8 data:double @@ -51941,8 +51941,8 @@ sBiquadFilterCallbackTable__Q44nw4r3snd6detail9AxManager = .bss:0x80659080; // t @LOCAL@GetInstance__Q44nw4r3snd6detail20RemoteSpeakerManagerFv@instance = .bss:0x80659410; // type:object size:0x2D8 scope:weak data:byte lbl_806596E8 = .bss:0x806596E8; // type:object size:0x20 data:2byte lbl_80659708 = .bss:0x80659708; // type:object size:0x18 -lbl_80659720 = .bss:0x80659720; // type:object size:0x10 -lbl_80659730 = .bss:0x80659730; // type:object size:0x610 data:4byte +@1420 = .bss:0x80659720; // type:object size:0xC scope:local +@LOCAL@detail_SortPriorityList__Q34nw4r3snd11SoundPlayerFv@tmplist = .bss:0x80659730; // type:object size:0x600 scope:weak data:4byte @2786 = .bss:0x80659D40; // type:object size:0xC scope:local sTaskThread__Q34nw4r3snd11SoundSystem = .bss:0x80659D50; // type:object size:0x320 @LOCAL@InitSoundSystem__Q34nw4r3snd11SoundSystemFll@defaultSoundSystemWork@0 = .bss:0x8065A080; // type:object size:0x155E0 scope:weak diff --git a/configure.py b/configure.py index 28aa9f98..00633161 100644 --- a/configure.py +++ b/configure.py @@ -1064,7 +1064,7 @@ config.libs = [ Object(NonMatching, "nw4r/snd/snd_SoundArchivePlayer.cpp"), Object(Matching, "nw4r/snd/snd_SoundHandle.cpp"), Object(Matching, "nw4r/snd/snd_SoundHeap.cpp"), - Object(NonMatching, "nw4r/snd/snd_SoundPlayer.cpp"), + Object(Matching, "nw4r/snd/snd_SoundPlayer.cpp"), Object(NonMatching, "nw4r/snd/snd_SoundStartable.cpp"), Object(Matching, "nw4r/snd/snd_SoundSystem.cpp"), Object(Matching, "nw4r/snd/snd_SoundThread.cpp"), diff --git a/include/nw4r/snd/snd_SoundPlayer.h b/include/nw4r/snd/snd_SoundPlayer.h index 45da6493..dfdcded2 100644 --- a/include/nw4r/snd/snd_SoundPlayer.h +++ b/include/nw4r/snd/snd_SoundPlayer.h @@ -30,13 +30,16 @@ namespace nw4r { namespace snd // methods int GetPlayableSoundCount() const { return mPlayableCount; } f32 GetVolume() const { return mVolume; } + void SetVolume(f32 volume); f32 GetLpfFreq() const { return mLpfFreq; } + void SetLpfFreq(f32 freq); int GetDefaultOutputLine() const { return mOutputLineFlag; } f32 GetMainOutVolume() const { return mMainOutVolume; } int GetBiquadFilterType() const { return mBiquadType; } f32 GetBiquadFilterValue() const { return mBiquadValue; } f32 GetMainSend() const { return mMainSend; } f32 GetFxSend(int index) const { return mFxSend[index]; } + void SetFxSend(AuxBus, f32); void SetPlayableSoundCount(int count); f32 GetRemoteOutVolume(int remote) const; @@ -79,6 +82,7 @@ namespace nw4r { namespace snd f32 mMainOutVolume; // size 0x04, offset 0x38 int mBiquadType; // size 0x04, offset 0x3c f32 mBiquadValue; // size 0x04, offset 0x40 + f32 mRemoteOutVolume[4]; f32 mMainSend; // size 0x04, offset 0x44 f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0x48 }; // size 0x54 diff --git a/src/nw4r/snd/snd_SoundPlayer.cpp b/src/nw4r/snd/snd_SoundPlayer.cpp index 81e1f800..112135ec 100644 --- a/src/nw4r/snd/snd_SoundPlayer.cpp +++ b/src/nw4r/snd/snd_SoundPlayer.cpp @@ -40,8 +40,12 @@ SoundPlayer::SoundPlayer() : mBiquadValue (0.0f), mMainSend (0.0f) { + for (int i = 0; i < 4; i++) + mRemoteOutVolume[i] = 1.0f; + for (int i = 0; i < AUX_BUS_NUM; i++) mFxSend[i] = 0.0f; + } SoundPlayer::~SoundPlayer() @@ -87,6 +91,30 @@ void SoundPlayer::PauseAllSound(bool flag, int fadeFrames) } } +void SoundPlayer::SetVolume(f32 volume) +{ + if (volume < 0.0f) + volume = 0.0f; + + mVolume = volume; +} + +void SoundPlayer::SetLpfFreq(f32 freq) +{ + mLpfFreq = freq; +} + +f32 SoundPlayer::GetRemoteOutVolume(int remote) const +{ + return mRemoteOutVolume[remote]; +} + +void SoundPlayer::SetFxSend(AuxBus bus, f32 send) +{ + mFxSend[bus] = send; +} + +#if 0 // SoundPlayer::SetVolume ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14397) /* also __FILE__ because this is the first assert in the file so it needs to * reference that first as well @@ -96,6 +124,7 @@ DECOMP_FORCE(NW4RAssert_String(volume >= 0.0f)); // SoundPlayer::SetFxSend ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14405) DECOMP_FORCE(NW4RAssertHeaderClampedLValue_String(bus)); +#endif void SoundPlayer::RemoveSoundList(detail::BasicSound *sound) {