From bfdcb7c73ada51dcb35f57b1d70e12d643e1ced4 Mon Sep 17 00:00:00 2001 From: robojumper Date: Tue, 27 May 2025 20:51:47 +0200 Subject: [PATCH] snd_ExternalSoundPlayer OK --- configure.py | 2 +- include/nw4r/snd/snd_ExternalSoundPlayer.h | 5 ++++ src/nw4r/snd/snd_ExternalSoundPlayer.cpp | 27 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 4f2054bc..72238d19 100644 --- a/configure.py +++ b/configure.py @@ -1027,7 +1027,7 @@ config.libs = [ Object(NonMatching, "nw4r/snd/snd_debug.cpp"), Object(Matching, "nw4r/snd/snd_DvdSoundArchive.cpp"), Object(Matching, "nw4r/snd/snd_EnvGenerator.cpp"), - Object(NonMatching, "nw4r/snd/snd_ExternalSoundPlayer.cpp"), + Object(Matching, "nw4r/snd/snd_ExternalSoundPlayer.cpp"), Object(Matching, "nw4r/snd/snd_FrameHeap.cpp"), Object(NonMatching, "nw4r/snd/snd_FxBase.cpp"), Object(NonMatching, "nw4r/snd/snd_FxChorus.cpp"), diff --git a/include/nw4r/snd/snd_ExternalSoundPlayer.h b/include/nw4r/snd/snd_ExternalSoundPlayer.h index 1fd2a9ba..4da73373 100644 --- a/include/nw4r/snd/snd_ExternalSoundPlayer.h +++ b/include/nw4r/snd/snd_ExternalSoundPlayer.h @@ -11,6 +11,8 @@ * classes and functions */ +namespace nw4r { namespace snd { class SoundActor; }} + namespace nw4r { namespace snd { namespace detail { // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27049 @@ -24,6 +26,9 @@ namespace nw4r { namespace snd { namespace detail int GetPlayingSoundCount() const { return mSoundList.GetSize(); } int GetPlayableSoundCount() const { return mPlayableCount; } void SetPlayableSoundCount(int count); + void StopAllSound(int fadeFrames); + void PauseAllSound(bool flag, int fadeFrames); + void DetachSoundActorAll(SoundActor *sound); bool AppendSound(BasicSound *sound); void RemoveSound(BasicSound *sound); diff --git a/src/nw4r/snd/snd_ExternalSoundPlayer.cpp b/src/nw4r/snd/snd_ExternalSoundPlayer.cpp index 2cd0c7e7..7f0b1d5a 100644 --- a/src/nw4r/snd/snd_ExternalSoundPlayer.cpp +++ b/src/nw4r/snd/snd_ExternalSoundPlayer.cpp @@ -42,10 +42,37 @@ ExternalSoundPlayer::~ExternalSoundPlayer() { } } +#if 0 // not sure which one uses this exactly, maybe StopAllSound? DECOMP_FORCE_CLASS_METHOD( BasicSound::ExtSoundPlayerPlayLinkList, GetPointerFromNode(static_cast(nullptr))); +#endif + +void ExternalSoundPlayer::StopAllSound(int fadeFrames) +{ + NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList) + { + it++->Stop(fadeFrames); + } +} + +void ExternalSoundPlayer::PauseAllSound(bool flag, int fadeFrames) +{ + NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList) + { + it++->Pause(flag, fadeFrames); + } +} + +void ExternalSoundPlayer::DetachSoundActorAll(SoundActor *sound) +{ + NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList) + { + it++->DetachSoundActor(sound); + } +} + bool ExternalSoundPlayer::AppendSound(BasicSound *sound) {