diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index aaa2e8fb..a42c2e35 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -25013,23 +25013,23 @@ __ct__Q44nw4r3snd6detail13AnimSoundImplFRQ34nw4r3snd14SoundStartablePQ44nw4r3snd __dt__Q44nw4r3snd6detail13AnimSoundImplFv = .text:0x80461780; // type:function size:0xC8 Setup__Q44nw4r3snd6detail13AnimSoundImplFPCv = .text:0x80461850; // type:function size:0xE8 Shutdown__Q44nw4r3snd6detail13AnimSoundImplFv = .text:0x80461940; // type:function size:0xA0 -FUN_804619e0 = .text:0x804619E0; // type:function size:0x1C -FUN_80461a00 = .text:0x80461A00; // type:function size:0x14C -FUN_80461b50 = .text:0x80461B50; // type:function size:0x220 -FUN_80461d70 = .text:0x80461D70; // type:function size:0x284 -FUN_80462000 = .text:0x80462000; // type:function size:0x2B0 -FUN_804622b0 = .text:0x804622B0; // type:function size:0x30C -FUN_804625c0 = .text:0x804625C0; // type:function size:0x30C -FUN_804628d0 = .text:0x804628D0; // type:function size:0x2B8 -nw4r__snd__detail__shdAnimSoundImpl__HoldEvent = .text:0x80462B90; // type:function size:0x2E0 -nw4r__snd__detail__shdAnimEventPlayer____ct = .text:0x80462E70; // type:function size:0x14 -nw4r__snd__detail__shdAnimEventPlayer____dt = .text:0x80462E90; // type:function size:0x88 -nw4r__snd__detail__AnimSoundFileReader__AnimSoundFileReader = .text:0x80462F20; // type:function size:0xC -nw4r__snd__detail__AnimSoundFileReader__Setup = .text:0x80462F30; // type:function size:0x6C -nw4r__snd__detail__AnimSoundFileReader__Shutdown = .text:0x80462FA0; // type:function size:0x10 -nw4r__snd__detail__AnimSoundFileReader__GetEventCount = .text:0x80462FB0; // type:function size:0x44 -nw4r__snd__detail__AnimSoundFileReader__GetEventRef = .text:0x80463000; // type:function size:0x58 -nw4r__snd__detail__AnimSoundFileReader__GetEvent = .text:0x80463060; // type:function size:0x74 +ResetFrame__Q44nw4r3snd6detail13AnimSoundImplFfi = .text:0x804619E0; // type:function size:0x1C +UpdateFrame__Q44nw4r3snd6detail13AnimSoundImplFfQ54nw4r3snd6detail13AnimSoundImpl13PlayDirection = .text:0x80461A00; // type:function size:0x14C +UpdateForward__Q44nw4r3snd6detail13AnimSoundImplFf = .text:0x80461B50; // type:function size:0x220 +UpdateBackward__Q44nw4r3snd6detail13AnimSoundImplFf = .text:0x80461D70; // type:function size:0x284 +UpdateTrigger__Q44nw4r3snd6detail13AnimSoundImplFPCQ44nw4r3snd6detail12AnimEventReflQ54nw4r3snd6detail13AnimSoundImpl13PlayDirection = .text:0x80462000; // type:function size:0x2B0 +UpdateForwardRange__Q44nw4r3snd6detail13AnimSoundImplFPCQ44nw4r3snd6detail12AnimEventRefl = .text:0x804622B0; // type:function size:0x30C +UpdateBackwardRange__Q44nw4r3snd6detail13AnimSoundImplFPCQ44nw4r3snd6detail12AnimEventRefl = .text:0x804625C0; // type:function size:0x30C +StartEvent__Q44nw4r3snd6detail13AnimSoundImplFPCQ44nw4r3snd6detail9AnimEventb = .text:0x804628D0; // type:function size:0x2B8 +HoldEvent__Q44nw4r3snd6detail13AnimSoundImplFPCQ44nw4r3snd6detail9AnimEventb = .text:0x80462B90; // type:function size:0x2E0 +__ct__Q44nw4r3snd6detail15AnimEventPlayerFv = .text:0x80462E70; // type:function size:0x14 +__dt__Q44nw4r3snd6detail15AnimEventPlayerFv = .text:0x80462E90; // type:function size:0x88 +__ct__Q44nw4r3snd6detail19AnimSoundFileReaderFv = .text:0x80462F20; // type:function size:0xC +Setup__Q44nw4r3snd6detail19AnimSoundFileReaderFPCv = .text:0x80462F30; // type:function size:0x6C +Shutdown__Q44nw4r3snd6detail19AnimSoundFileReaderFv = .text:0x80462FA0; // type:function size:0x10 +GetEventCount__Q44nw4r3snd6detail19AnimSoundFileReaderCFv = .text:0x80462FB0; // type:function size:0x44 +GetEventRef__Q44nw4r3snd6detail19AnimSoundFileReaderCFUl = .text:0x80463000; // type:function size:0x58 +GetEvent__Q44nw4r3snd6detail19AnimSoundFileReaderCFPCQ44nw4r3snd6detail12AnimEventRef = .text:0x80463060; // type:function size:0x74 __ct__Q44nw4r3snd6detail9AxManagerFv = .text:0x804630E0; // type:function size:0x218 __ct__Q34nw4r2ut30LinkListFv = .text:0x80463300; // type:function size:0x18 scope:weak __dt__Q34nw4r2ut30LinkListFv = .text:0x80463320; // type:function size:0x58 scope:weak @@ -25483,7 +25483,7 @@ SetupSound__Q34nw4r3snd10SoundActorFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14So detail_SetupSoundWithAmbientInfo__Q34nw4r3snd10SoundActorFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfoPQ54nw4r3snd6detail10BasicSound11AmbientInfoPv = .text:0x804761F0; // type:function size:0x1C detail_SetupSound__Q34nw4r3snd10SoundActorFPQ34nw4r3snd11SoundHandleUlbPCQ44nw4r3snd14SoundStartable9StartInfo = .text:0x80476210; // type:function size:0x38 detail_ConvertLabelStringToSoundId__Q34nw4r3snd10SoundActorFPCc = .text:0x80476250; // type:function size:0x14 -detail_ConvertLabelStringToSoundId__Q34nw4r3snd18SoundArchivePlayerFPCc = .text:0x80476270; // type:function size:0x8 +detail_ConvertLabelStringToSoundId__Q34nw4r3snd18SoundArchivePlayerFPCc = .text:0x80476270; // type:function size:0x8 scope:weak __ct__Q34nw4r3snd12SoundArchiveFv = .text:0x80476280; // type:function size:0x24 __dt__Q34nw4r3snd12SoundArchiveFv = .text:0x804762B0; // type:function size:0x40 IsAvailable__Q34nw4r3snd12SoundArchiveCFv = .text:0x804762F0; // type:function size:0x14 @@ -38612,7 +38612,7 @@ __vt__Q44nw4r3snd6detail8SeqTrack = .data:0x8056E0D8; // type:object size:0x10 lbl_8056E0E8 = .data:0x8056E0E8; // type:object size:0x30 lbl_8056E118 = .data:0x8056E118; // type:object size:0x20 lbl_8056E138 = .data:0x8056E138; // type:object size:0x38 -lbl_8056E170 = .data:0x8056E170; // type:object size:0x20 +__vt__Q34nw4r3snd10SoundActor = .data:0x8056E170; // type:object size:0x1C __vt__Q34nw4r3snd12SoundArchive = .data:0x8056E190; // type:object size:0x20 lbl_8056E1B0 = .data:0x8056E1B0; // type:object size:0x30 WSDCallback = .data:0x8056E1E0; // type:object size:0x10 @@ -49743,8 +49743,8 @@ lbl_8057F11C = .sdata2:0x8057F11C; // type:object size:0x4 align:4 data:float lbl_8057F120 = .sdata2:0x8057F120; // type:object size:0x4 align:4 data:float lbl_8057F128 = .sdata2:0x8057F128; // type:object size:0x4 align:4 data:float lbl_8057F12C = .sdata2:0x8057F12C; // type:object size:0x4 align:4 data:float -lbl_8057F130 = .sdata2:0x8057F130; // type:object size:0x4 align:4 data:float -lbl_8057F134 = .sdata2:0x8057F134; // type:object size:0x4 align:4 data:float +@3454 = .sdata2:0x8057F130; // type:object size:0x4 scope:local align:4 data:float +@3455 = .sdata2:0x8057F134; // type:object size:0x4 scope:local 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 @2452 = .sdata2:0x8057F148; // type:object size:0x4 scope:local align:4 data:float diff --git a/configure.py b/configure.py index dcbcd67d..7c129f6d 100644 --- a/configure.py +++ b/configure.py @@ -1057,7 +1057,7 @@ config.libs = [ Object(NonMatching, "nw4r/snd/snd_Sound3DEngine.cpp"), Object(NonMatching, "nw4r/snd/snd_Sound3DListener.cpp"), Object(NonMatching, "nw4r/snd/snd_Sound3DManager.cpp"), - Object(NonMatching, "nw4r/snd/snd_SoundActor.cpp"), + Object(Matching, "nw4r/snd/snd_SoundActor.cpp"), Object(Matching, "nw4r/snd/snd_SoundArchive.cpp"), Object(NonMatching, "nw4r/snd/snd_SoundArchiveFile.cpp"), Object(NonMatching, "nw4r/snd/snd_SoundArchiveLoader.cpp"), diff --git a/include/nw4r/snd/snd_SoundActor.h b/include/nw4r/snd/snd_SoundActor.h index eeb1941d..1a608e2e 100644 --- a/include/nw4r/snd/snd_SoundActor.h +++ b/include/nw4r/snd/snd_SoundActor.h @@ -30,8 +30,17 @@ namespace nw4r { namespace snd // methods public: // cdtors - SoundActor(); + SoundActor(SoundArchivePlayer &player); + virtual ~SoundActor(); + virtual u32 detail_ConvertLabelStringToSoundId(const char* label) override; + virtual StartResult detail_SetupSound(SoundHandle *pHandle, u32 soundId, bool holdFlag, const StartInfo *pStartInfo) override; + + + virtual StartResult SetupSound(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void*); + virtual StartResult detail_SetupSoundWithAmbientInfo(SoundHandle*, u32, const StartInfo*, detail::BasicSound::AmbientInfo*, void*); + + // methods detail::ExternalSoundPlayer *detail_GetActorPlayer(int actorPlayerId) { @@ -46,6 +55,10 @@ namespace nw4r { namespace snd return mActorParam; } + void StopAllSound(int fadeFrames); + void PauseAllSound(bool flag, int fadeFrames); + int GetPlayingSoundCount(int playerId) const; + // static members public: static int const ACTOR_PLAYER_COUNT = 4; diff --git a/include/nw4r/snd/snd_SoundArchivePlayer.h b/include/nw4r/snd/snd_SoundArchivePlayer.h index f8126d73..8724fde1 100644 --- a/include/nw4r/snd/snd_SoundArchivePlayer.h +++ b/include/nw4r/snd/snd_SoundArchivePlayer.h @@ -222,6 +222,11 @@ namespace nw4r { namespace snd void UpdateCommonSoundParam(detail::BasicSound *sound, SoundArchive::SoundInfo const *commonInfo); + SoundStartable::StartResult detail_SetupSoundImpl( + SoundHandle *handle, u32 soundId, + detail::BasicSound::AmbientInfo *ambientArgInfo, SoundActor *actor, + bool holdFlag, SoundStartable::StartInfo const *startInfo); + private: template Sound *AllocSound( @@ -229,10 +234,6 @@ namespace nw4r { namespace snd int priority, int ambientPriority, detail::BasicSound::AmbientInfo *ambientArgInfo); - SoundStartable::StartResult detail_SetupSoundImpl( - SoundHandle *handle, u32 soundId, - detail::BasicSound::AmbientInfo *ambientArgInfo, SoundActor *actor, - bool holdFlag, SoundStartable::StartInfo const *startInfo); SoundStartable::StartResult PrepareSeqImpl( detail::SeqSound *sound, SoundArchive::SoundInfo const *commonInfo, SoundArchive::SeqSoundInfo const *info, diff --git a/src/nw4r/snd/snd_SoundActor.cpp b/src/nw4r/snd/snd_SoundActor.cpp index c390dc15..6c286dc9 100644 --- a/src/nw4r/snd/snd_SoundActor.cpp +++ b/src/nw4r/snd/snd_SoundActor.cpp @@ -8,9 +8,65 @@ #include "nw4r/snd/snd_SoundArchivePlayer.h" -nw4r::snd::SoundActor::SoundActor() : - mSoundArchivePlayer (*new SoundArchivePlayer) +namespace nw4r { namespace snd { + +SoundActor::SoundActor(SoundArchivePlayer &player) : + mSoundArchivePlayer (player) { - // DECOMP_FORCE_CLASS_METHOD - (void)mSoundArchivePlayer.detail_ConvertLabelStringToSoundId(nullptr); + + for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) + { + mActorPlayer[i].SetPlayableSoundCount(i == 0 ? INT_MAX : 1); + } } + +SoundActor::~SoundActor() +{ + for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) + { + mActorPlayer[i].DetachSoundActorAll(this); + } +} + +void SoundActor::StopAllSound(int fadeFrames) +{ + for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) + { + mActorPlayer[i].StopAllSound(fadeFrames); + } +} + +void SoundActor::PauseAllSound(bool flag, int fadeFrames) +{ + for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) + { + mActorPlayer[i].PauseAllSound(flag, fadeFrames); + } +} + +int SoundActor::GetPlayingSoundCount(int playerId) const +{ + return mActorPlayer[playerId].GetPlayingSoundCount(); +} + +SoundStartable::StartResult SoundActor::SetupSound(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void* arg) +{ + return mSoundArchivePlayer.detail_SetupSoundImpl(pHandle, soundId, nullptr, this, *(bool*)arg, pStartInfo); +} + +SoundStartable::StartResult SoundActor::detail_SetupSoundWithAmbientInfo(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, detail::BasicSound::AmbientInfo *pAmbientInfo, void* arg) +{ + return mSoundArchivePlayer.detail_SetupSoundImpl(pHandle, soundId, pAmbientInfo, this, *(bool*)arg, pStartInfo); +} + +SoundStartable::StartResult SoundActor::detail_SetupSound(SoundHandle *pHandle, u32 soundId, bool holdFlag, const StartInfo *pStartInfo) +{ + return SetupSound(pHandle, soundId, pStartInfo, &holdFlag); +} + +u32 SoundActor::detail_ConvertLabelStringToSoundId(const char* label) +{ + return mSoundArchivePlayer.detail_ConvertLabelStringToSoundId(label); +} + +}}