diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index aa953c96..aaa2e8fb 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -25703,13 +25703,13 @@ UpdateMoveValue__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480870; // type:func UpdateParam__Q44nw4r3snd6detail9StrmSoundFv = .text:0x804808F0; // type:function size:0xE0 SetTrackVolume__Q44nw4r3snd6detail9StrmSoundFUlfi = .text:0x804809D0; // type:function size:0x144 Shutdown__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480B20; // type:function size:0x9C -__dt__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480BC0; // type:function size:0x5C +__dt__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480BC0; // type:function size:0x5C scope:weak OnUpdatePlayerPriority__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480C20; // type:function size:0xE4 IsAttachedTempSpecialHandle__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480D10; // type:function size:0x14 DetachTempSpecialHandle__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480D30; // type:function size:0x8 -GetBasicPlayer__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480D40; // type:function size:0x8 -GetBasicPlayer__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D50; // type:function size:0x8 -IsPrepared__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D60; // type:function size:0x8 +GetBasicPlayer__Q44nw4r3snd6detail9StrmSoundFv = .text:0x80480D40; // type:function size:0x8 scope:weak +GetBasicPlayer__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D50; // type:function size:0x8 scope:weak +IsPrepared__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D60; // type:function size:0x8 scope:weak GetRuntimeTypeInfo__Q44nw4r3snd6detail9StrmSoundCFv = .text:0x80480D70; // type:function size:0x8 scope:weak __sinit_\snd_StrmSound_cpp = .text:0x80480D80; // type:function size:0xC scope:local __ct__Q34nw4r3snd15StrmSoundHandleFPQ34nw4r3snd11SoundHandle = .text:0x80480D90; // type:function size:0xF4 @@ -38622,7 +38622,7 @@ __vt__Q34nw4r3snd9SoundHeap = .data:0x8056E200; // type:object size:0x10 __vt__Q44nw4r3snd6detail10StrmPlayer = .data:0x8056E258; // type:object size:0x48 __vt__Q54nw4r3snd6detail10StrmPlayer16StrmDataLoadTask = .data:0x8056E2A0; // type:object size:0x18 __vt__Q54nw4r3snd6detail10StrmPlayer18StrmHeaderLoadTask = .data:0x8056E2B8; // type:object size:0x18 -lbl_8056E2D0 = .data:0x8056E2D0; // type:object size:0x38 +__vt__Q44nw4r3snd6detail9StrmSound = .data:0x8056E2D0; // type:object size:0x38 @5068 = .data:0x8056E308; // type:object size:0x24 scope:local __vt__Q44nw4r3snd6detail5Voice = .data:0x8056E32C; // type:object size:0x14 PanTableTable__Q44nw4r3snd6detail4Util = .data:0x8056E340; // type:object size:0xC @@ -42436,7 +42436,7 @@ sInitialized__Q34nw4r3snd29@unnamed@snd_SoundSystem_cpp@ = .sbss:0x805766B8; // sMaxVoices__Q34nw4r3snd11SoundSystem = .sbss:0x805766BC; // type:object size:0x4 data:4byte @GUARD@GetInstance__Q44nw4r3snd6detail11SoundThreadFv@instance = .sbss:0x805766C0; // type:object size:0x1 scope:weak data:byte sStaticInitFlag__Q44nw4r3snd6detail10StrmPlayer = .sbss:0x805766C8; // type:object size:0x1 data:byte -lbl_805766D0 = .sbss:0x805766D0; // type:object size:0x8 data:4byte +typeInfo__Q44nw4r3snd6detail9StrmSound = .sbss:0x805766D0; // type:object size:0x4 data:4byte @GUARD@GetInstance__Q44nw4r3snd6detail11TaskManagerFv@instance = .sbss:0x805766D8; // type:object size:0x1 scope:weak data:byte @GUARD@GetInstance__Q44nw4r3snd6detail12VoiceManagerFv@instance = .sbss:0x805766E0; // type:object size:0x1 scope:weak data:byte typeInfo__Q44nw4r3snd6detail9WaveSound = .sbss:0x805766E8; // type:object size:0x4 data:4byte @@ -49755,9 +49755,9 @@ lbl_8057F140 = .sdata2:0x8057F140; // type:object size:0x8 align:8 data:double @5492 = .sdata2:0x8057F168; // type:object size:0x4 scope:local align:4 data:float @5765 = .sdata2:0x8057F16C; // type:object size:0x4 scope:local align:4 data:float @5766 = .sdata2:0x8057F170; // type:object size:0x4 scope:local align:4 data:float -lbl_8057F178 = .sdata2:0x8057F178; // type:object size:0x4 align:4 data:float -lbl_8057F17C = .sdata2:0x8057F17C; // type:object size:0x4 align:4 data:float -lbl_8057F180 = .sdata2:0x8057F180; // type:object size:0x8 align:8 data:double +@2698 = .sdata2:0x8057F178; // type:object size:0x4 scope:local align:4 data:float +@2727 = .sdata2:0x8057F17C; // type:object size:0x4 scope:local align:4 data:float +@2730 = .sdata2:0x8057F180; // type:object size:0x8 scope:local align:8 data:double @4083 = .sdata2:0x8057F188; // type:object size:0x4 scope:local align:4 data:float @4084 = .sdata2:0x8057F18C; // type:object size:0x4 scope:local align:4 data:float @4815 = .sdata2:0x8057F190; // type:object size:0x4 scope:local align:4 data:float diff --git a/configure.py b/configure.py index d8072128..c6ce4377 100644 --- a/configure.py +++ b/configure.py @@ -1071,7 +1071,7 @@ config.libs = [ Object(Matching, "nw4r/snd/snd_StrmChannel.cpp"), Object(Matching, "nw4r/snd/snd_StrmFile.cpp"), Object(Matching, "nw4r/snd/snd_StrmPlayer.cpp"), - Object(NonMatching, "nw4r/snd/snd_StrmSound.cpp"), + Object(Matching, "nw4r/snd/snd_StrmSound.cpp"), Object(NonMatching, "nw4r/snd/snd_StrmSoundHandle.cpp"), Object(Matching, "nw4r/snd/snd_Task.cpp"), Object(Matching, "nw4r/snd/snd_TaskManager.cpp"), diff --git a/include/nw4r/snd/snd_StrmSound.h b/include/nw4r/snd/snd_StrmSound.h index db0d52d1..240659ea 100644 --- a/include/nw4r/snd/snd_StrmSound.h +++ b/include/nw4r/snd/snd_StrmSound.h @@ -80,6 +80,8 @@ namespace nw4r { namespace snd { namespace detail bool Prepare(StrmPlayer::StartOffsetType startOffsetType, s32 offset, ut::FileStream *fileStream); + + void SetTrackVolume(u32 trackFlags, f32 volume, int fadeFrames); static DebugSoundType GetSoundType() { diff --git a/src/nw4r/snd/snd_StrmSound.cpp b/src/nw4r/snd/snd_StrmSound.cpp index 480e0957..25ea0a38 100644 --- a/src/nw4r/snd/snd_StrmSound.cpp +++ b/src/nw4r/snd/snd_StrmSound.cpp @@ -17,6 +17,7 @@ #include "nw4r/snd/snd_StrmSoundHandle.h" #include "nw4r/snd/snd_MoveValue.h" +#include "nw4r/ut/ut_Lock.h" #include "nw4r/ut/ut_RuntimeTypeInfo.h" #include "nw4r/NW4RAssert.hpp" @@ -116,6 +117,22 @@ void StrmSound::UpdateParam() } } +void StrmSound::SetTrackVolume(u32 trackFlags, f32 volume, int fadeFrames) +{ + ut::AutoInterruptLock lock; + for (int trackNo = 0; trackNo < (int)ARRAY_LENGTH(mTrackVolume) && trackFlags != 0; trackNo++, trackFlags >>= 1) + { + StrmPlayer::StrmTrack *track = mStrmPlayer.GetPlayerTrack(trackNo); + if (track != NULL && ((trackFlags & 1) != 0)) + { + if (volume < 0.0f) + volume = 0.0f; + + mTrackVolume[trackNo].SetTarget(volume, fadeFrames); + } + } +} + void StrmSound::Shutdown() { BasicSound::Shutdown();