diff options
| author | robojumper <robojumper@gmail.com> | 2025-05-27 22:26:16 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-05-27 22:26:16 +0200 |
| commit | 5bbbf093479390ea98f8324ca849f186b0948c95 (patch) | |
| tree | b7735da9a5276e892c978d90e1e25f566bc950e9 | |
| parent | 6e38f7ad9076030730b1d311933501a72a1c88c5 (diff) | |
snd_SoundStartable OK
| -rw-r--r-- | configure.py | 2 | ||||
| -rw-r--r-- | include/nw4r/snd/snd_SoundStartable.h | 19 | ||||
| -rw-r--r-- | src/nw4r/snd/snd_SoundStartable.cpp | 38 |
3 files changed, 58 insertions, 1 deletions
diff --git a/configure.py b/configure.py index 6771f437..dcbcd67d 100644 --- a/configure.py +++ b/configure.py @@ -1065,7 +1065,7 @@ config.libs = [ Object(Matching, "nw4r/snd/snd_SoundHandle.cpp"), Object(Matching, "nw4r/snd/snd_SoundHeap.cpp"), Object(Matching, "nw4r/snd/snd_SoundPlayer.cpp"), - Object(NonMatching, "nw4r/snd/snd_SoundStartable.cpp"), + Object(Matching, "nw4r/snd/snd_SoundStartable.cpp"), Object(Matching, "nw4r/snd/snd_SoundSystem.cpp"), Object(Matching, "nw4r/snd/snd_SoundThread.cpp"), Object(Matching, "nw4r/snd/snd_StrmChannel.cpp"), diff --git a/include/nw4r/snd/snd_SoundStartable.h b/include/nw4r/snd/snd_SoundStartable.h index c438be45..5f0a70df 100644 --- a/include/nw4r/snd/snd_SoundStartable.h +++ b/include/nw4r/snd/snd_SoundStartable.h @@ -108,6 +108,11 @@ namespace nw4r { namespace snd SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo ); StartResult detail_StartSound( + SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo + ); + + // TODO: Remove + StartResult detail_StartSound( SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo, detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo ); @@ -115,17 +120,31 @@ namespace nw4r { namespace snd StartResult detail_HoldSound( SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo ); + StartResult detail_HoldSound( + SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo + ); + // TODO: Remove StartResult detail_HoldSound( SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo, detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo ); + // TODO: Remove StartResult detail_PrepareSound( SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo, detail::ExternalSoundPlayer *pPlayer, const StartInfo *pStartInfo ); + StartResult detail_PrepareSound( + SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo + ); + StartResult detail_PrepareSound( + SoundHandle *pHandle, const char *label, + const StartInfo *pStartInfo + ); + + // TODO: Fix after removal of above functions bool StartSound(SoundHandle *pHandle, u32 id) { return detail_StartSound(pHandle, id, NULL, NULL, NULL) == START_SUCCESS; } diff --git a/src/nw4r/snd/snd_SoundStartable.cpp b/src/nw4r/snd/snd_SoundStartable.cpp index 4488ef60..f098d1d8 100644 --- a/src/nw4r/snd/snd_SoundStartable.cpp +++ b/src/nw4r/snd/snd_SoundStartable.cpp @@ -31,6 +31,16 @@ SoundStartable::StartResult SoundStartable::detail_StartSound( return START_SUCCESS; } +SoundStartable::StartResult SoundStartable::detail_StartSound( + SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo) +{ + u32 soundId = detail_ConvertLabelStringToSoundId(label); + if (soundId == -1) + return START_ERR_INVALID_LABEL_STRING; + + return detail_StartSound(pHandle, soundId, pStartInfo); +} + SoundStartable::StartResult SoundStartable::detail_HoldSound( SoundHandle *handle, u32 soundId, StartInfo const *startInfo) { @@ -49,4 +59,32 @@ SoundStartable::StartResult SoundStartable::detail_HoldSound( return START_SUCCESS; } +SoundStartable::StartResult SoundStartable::detail_HoldSound( + SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo) +{ + u32 soundId = detail_ConvertLabelStringToSoundId(label); + if (soundId == -1) + return START_ERR_INVALID_LABEL_STRING; + + return detail_HoldSound(pHandle, soundId, pStartInfo); +} + +SoundStartable::StartResult SoundStartable::detail_PrepareSound( + SoundHandle *pHandle, u32 id, + const StartInfo *pStartInfo) +{ + return detail_SetupSound(pHandle, id, false, pStartInfo); +} + +SoundStartable::StartResult SoundStartable::detail_PrepareSound( + SoundHandle *pHandle, const char *label, + const StartInfo *pStartInfo) +{ + u32 soundId = detail_ConvertLabelStringToSoundId(label); + if (soundId == -1) + return START_ERR_INVALID_LABEL_STRING; + + return detail_PrepareSound(pHandle, soundId, pStartInfo); +} + }} // namespace nw4r::snd |
