diff options
| author | robojumper <robojumper@gmail.com> | 2025-05-25 16:29:42 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-05-25 16:32:47 +0200 |
| commit | f7884242c7e31b516d56ba4d9f4ac5ce2155f13d (patch) | |
| tree | c17d3ce6204353d27d1d9e152cf9a1fca035dc47 /src/nw4r/snd/snd_SoundSystem.cpp | |
| parent | b5c3d85ea29678b73ac5140015f16ecc542bb060 (diff) | |
Import of more nw4r::snd from https://github.com/kiwi515/ogws
Co-authored-by: kiwi515 <49212064+kiwi515@users.noreply.github.com>
Diffstat (limited to 'src/nw4r/snd/snd_SoundSystem.cpp')
| -rw-r--r-- | src/nw4r/snd/snd_SoundSystem.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nw4r/snd/snd_SoundSystem.cpp b/src/nw4r/snd/snd_SoundSystem.cpp index 01afc6d4..ef27f5a5 100644 --- a/src/nw4r/snd/snd_SoundSystem.cpp +++ b/src/nw4r/snd/snd_SoundSystem.cpp @@ -78,6 +78,27 @@ namespace nw4r { namespace snd namespace nw4r { namespace snd { +void SoundSystem::InitSoundSystem(s32 soundThreadPriority, + s32 dvdThreadPriority) { + const int defaultWorkSize = DEFAULT_SOUND_THREAD_STACK_SIZE + + DEFAULT_DVD_THREAD_STACK_SIZE + + detail::AxVoiceManager::WORK_SIZE_MAX + + detail::VoiceManager::WORK_SIZE_MAX + + detail::ChannelManager::WORK_SIZE_MAX; + + static u8 defaultSoundSystemWork[defaultWorkSize] ALIGN_DECL(32); + + // OSRegisterVersion(NW4R_SND_Version_); + + SoundSystemParam param; + param.soundThreadPriority = soundThreadPriority; + param.dvdThreadPriority = dvdThreadPriority; + + // @bug This function ignores the specified buffer size + InitSoundSystem(param, defaultSoundSystemWork, + sizeof(defaultSoundSystemWork)); +} + u32 SoundSystem::GetRequiredMemSize(SoundSystemParam const ¶m) { // could have just used align assert? idk @@ -210,6 +231,20 @@ bool SoundSystem::IsInitializedSoundSystem() return sInitialized; } + +void SoundSystem::WaitForResetReady() { + if (!sInitialized) { + return; + } + + u32 start = OSGetTick(); + + while (!detail::AxManager::GetInstance().IsResetReady()) { + if (OS_TICKS_TO_SEC(OSGetTick() - start) > 0) { + break; + } + } +} // SoundSystem::WaitForResetReady ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14493) DECOMP_FORCE("SoundSystem::WaitForResetReady is TIME OUT.\n"); |
