diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 020d2582..642fbb94 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -2371,12 +2371,14 @@ d/snd/d_snd_sound.cpp: .sdata2 start:0x8057D368 end:0x8057D380 d/snd/d_snd_player_mgr.cpp: - .text start:0x8035DA90 end:0x8035F010 align:16 + .text start:0x8035DA90 end:0x8035F04C align:16 .data start:0x80548758 end:0x805487A0 -d/snd/mgr/d_snd_mgr_unk1.cpp: - .text start:0x8035F010 end:0x80360C28 align:16 +d/snd/d_snd_control_player_mgr.cpp: + .text start:0x8035F050 end:0x80360C28 align:16 .ctors start:0x804DB914 end:0x804DB918 + .sbss start:0x80575D40 end:0x80575D58 + .sdata2 start:0x8057D390 end:0x8057D3B8 d/snd/d_snd_3d_manager.cpp: .text start:0x80360C30 end:0x8036145C align:16 @@ -2406,7 +2408,7 @@ d/snd/d_snd_control_player.cpp: d/snd/mgr/d_snd_mgr_effect.cpp: .text start:0x8036C6B0 end:0x8037F8B4 align:16 -d/snd/mgr/d_snd_mgr_unk_5.cpp: +d/snd/d_snd_harp_mgr.cpp: .text start:0x8037F8C0 end:0x80382150 align:16 d/snd/d_snd_anim_sound.cpp: diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index dd464e13..fbd272c6 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -19984,42 +19984,42 @@ calc__15dSndPlayerMgr_cFv = .text:0x8035EFD0; // type:function size:0x40 fn_8035F010 = .text:0x8035F010; // type:function size:0x20 fn_8035F030 = .text:0x8035F030; // type:function size:0x1C fn_8035F050 = .text:0x8035F050; // type:function size:0x50 -fn_8035F0A0 = .text:0x8035F0A0; // type:function size:0x78 -fn_8035F120 = .text:0x8035F120; // type:function size:0x48 -fn_8035F170 = .text:0x8035F170; // type:function size:0x10 -fn_8035F180 = .text:0x8035F180; // type:function size:0x114 -fn_8035F2A0 = .text:0x8035F2A0; // type:function size:0x40 -fn_8035F2E0 = .text:0x8035F2E0; // type:function size:0x40 -fn_8035F320 = .text:0x8035F320; // type:function size:0x3C -fn_8035F360 = .text:0x8035F360; // type:function size:0x40 -fn_8035F3A0 = .text:0x8035F3A0; // type:function size:0x40 -fn_8035F3E0 = .text:0x8035F3E0; // type:function size:0x40 +__dt__40SndMgrDisposer<22dSndControlPlayerMgr_c>Fv = .text:0x8035F0A0; // type:function size:0x78 +create__40SndMgrDisposer<22dSndControlPlayerMgr_c>Fv = .text:0x8035F120; // type:function size:0x48 +remove__40SndMgrDisposer<22dSndControlPlayerMgr_c>Fv = .text:0x8035F170; // type:function size:0x10 +__ct__22dSndControlPlayerMgr_cFv = .text:0x8035F180; // type:function size:0x114 +__ct__26dSndControlPlayerLpfFreq_cFv = .text:0x8035F2A0; // type:function size:0x40 +__ct__25dSndControlPlayerFxSend_cFv = .text:0x8035F2E0; // type:function size:0x40 +__ct__25dSndControlPlayerVolume_cFv = .text:0x8035F320; // type:function size:0x3C +__dt__25dSndControlPlayerVolume_cFv = .text:0x8035F360; // type:function size:0x40 +__dt__26dSndControlPlayerLpfFreq_cFv = .text:0x8035F3A0; // type:function size:0x40 +__dt__25dSndControlPlayerFxSend_cFv = .text:0x8035F3E0; // type:function size:0x40 fn_8035F420 = .text:0x8035F420; // type:function size:0xC8 fn_8035F4F0 = .text:0x8035F4F0; // type:function size:0x118 fn_8035F610 = .text:0x8035F610; // type:function size:0x158 fn_8035F770 = .text:0x8035F770; // type:function size:0xDC -fn_8035F850 = .text:0x8035F850; // type:function size:0x3C -fn_8035F890 = .text:0x8035F890; // type:function size:0xAC +calc__22dSndControlPlayerMgr_cFv = .text:0x8035F850; // type:function size:0x3C +executeControls__22dSndControlPlayerMgr_cFv = .text:0x8035F890; // type:function size:0xAC fn_8035F940 = .text:0x8035F940; // type:function size:0x168 fn_8035FAB0 = .text:0x8035FAB0; // type:function size:0x318 fn_8035FDD0 = .text:0x8035FDD0; // type:function size:0xE0 fn_8035FEB0 = .text:0x8035FEB0; // type:function size:0x11C fn_8035FFD0 = .text:0x8035FFD0; // type:function size:0xE0 -fn_803600B0 = .text:0x803600B0; // type:function size:0x70 -fn_80360120 = .text:0x80360120; // type:function size:0x34 +getPlayer1__22dSndControlPlayerMgr_cFl = .text:0x803600B0; // type:function size:0x70 +getPlayer2__22dSndControlPlayerMgr_cFl = .text:0x80360120; // type:function size:0x34 fn_80360160 = .text:0x80360160; // type:function size:0xBC -fn_80360220 = .text:0x80360220; // type:function size:0x28 -fn_80360250 = .text:0x80360250; // type:function size:0x28 +linkCtrl__22dSndControlPlayerMgr_cFP19dSndControlPlayer_c = .text:0x80360220; // type:function size:0x28 +unlinkCtrl__22dSndControlPlayerMgr_cFP19dSndControlPlayer_c = .text:0x80360250; // type:function size:0x28 fn_80360280 = .text:0x80360280; // type:function size:0x94 fn_80360320 = .text:0x80360320; // type:function size:0xC8 fn_803603F0 = .text:0x803603F0; // type:function size:0xB0 fn_803604A0 = .text:0x803604A0; // type:function size:0x48 -fn_803604F0 = .text:0x803604F0; // type:function size:0x20 -fn_80360510 = .text:0x80360510; // type:function size:0x20 +setLpfFreq__22dSndControlPlayerMgr_cFUlfl = .text:0x803604F0; // type:function size:0x20 +setFxSend__22dSndControlPlayerMgr_cFUlfl = .text:0x80360510; // type:function size:0x20 fn_80360530 = .text:0x80360530; // type:function size:0x38 -fn_80360570 = .text:0x80360570; // type:function size:0xB0 -fn_80360620 = .text:0x80360620; // type:function size:0xAC -fn_803606D0 = .text:0x803606D0; // type:function size:0x40 +setControlValue__22dSndControlPlayerMgr_cFQ222dSndControlPlayerMgr_c12PlayerCtrl_eUlfl = .text:0x80360570; // type:function size:0xB0 +resetControls__22dSndControlPlayerMgr_cFv = .text:0x80360620; // type:function size:0xAC +getTargetValue__22dSndControlPlayerMgr_cCFQ222dSndControlPlayerMgr_c12PlayerCtrl_eUl = .text:0x803606D0; // type:function size:0x40 fn_80360710 = .text:0x80360710; // type:function size:0x78 fn_80360790 = .text:0x80360790; // type:function size:0x5C fn_803607F0 = .text:0x803607F0; // type:function size:0x60 @@ -37644,7 +37644,7 @@ __vt__33SndMgrDisposer<15dSndPlayerMgr_c> = .data:0x80548790; // type:object siz lbl_805487A0 = .data:0x805487A0; // type:object size:0xC lbl_805487AC = .data:0x805487AC; // type:object size:0xC lbl_805487B8 = .data:0x805487B8; // type:object size:0xC -lbl_805487C4 = .data:0x805487C4; // type:object size:0xC +__vt__40SndMgrDisposer<22dSndControlPlayerMgr_c> = .data:0x805487C4; // type:object size:0xC __vt__33SndMgrDisposer<15dSnd3DManager_c> = .data:0x805487D0; // type:object size:0xC scope:weak lbl_805487E0 = .data:0x805487E0; // type:object size:0xAC lbl_8054888C = .data:0x8054888C; // type:object size:0xC @@ -41893,8 +41893,8 @@ sDisposer__15dSndPlayerMgr_c = .sbss:0x80575D3C; // type:object size:0x4 data:4b lbl_80575D40 = .sbss:0x80575D40; // type:object size:0x4 data:4byte lbl_80575D44 = .sbss:0x80575D44; // type:object size:0x4 data:4byte lbl_80575D48 = .sbss:0x80575D48; // type:object size:0x4 data:4byte -lbl_80575D4C = .sbss:0x80575D4C; // type:object size:0x4 data:4byte -lbl_80575D50 = .sbss:0x80575D50; // type:object size:0x8 data:4byte +sInstance__22dSndControlPlayerMgr_c = .sbss:0x80575D4C; // type:object size:0x4 data:4byte +sDisposer__22dSndControlPlayerMgr_c = .sbss:0x80575D50; // type:object size:0x8 data:4byte sInstance__15dSnd3DManager_c = .sbss:0x80575D58; // type:object size:0x4 data:4byte sDisposer__15dSnd3DManager_c = .sbss:0x80575D5C; // type:object size:0x4 data:4byte lbl_80575D60 = .sbss:0x80575D60; // type:object size:0x4 data:4byte @@ -49196,7 +49196,7 @@ lbl_8057E5B8 = .sdata2:0x8057E5B8; // type:object size:0x4 align:4 data:float lbl_8057E5BC = .sdata2:0x8057E5BC; // type:object size:0x4 align:4 data:float lbl_8057E5C0 = .sdata2:0x8057E5C0; // type:object size:0x4 data:4byte lbl_8057E5C4 = .sdata2:0x8057E5C4; // type:object size:0x4 align:4 data:float -lbl_8057E5C8 = .sdata2:0x8057E5C8; // type:object size:0x4 data:4byte +sNumPlayers__22dSndControlPlayerMgr_c = .sdata2:0x8057E5C8; // type:object size:0x4 data:4byte lbl_8057E5CC = .sdata2:0x8057E5CC; // type:object size:0x4 data:4byte lbl_8057E5D0 = .sdata2:0x8057E5D0; // type:object size:0x8 data:4byte lbl_8057E5D8 = .sdata2:0x8057E5D8; // type:object size:0x4 align:4 data:float diff --git a/configure.py b/configure.py index ed3cbdfc..1a15f5f4 100644 --- a/configure.py +++ b/configure.py @@ -708,7 +708,7 @@ config.libs = [ Object(NonMatching, "d/snd/d_snd_3d_engine.cpp"), Object(Matching, "d/snd/d_snd_sound.cpp"), Object(NonMatching, "d/snd/d_snd_player_mgr.cpp"), - Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk1.cpp"), + Object(NonMatching, "d/snd/d_snd_control_player_mgr.cpp"), Object(Matching, "d/snd/d_snd_3d_manager.cpp"), Object(NonMatching, "d/snd/mgr/d_snd_mgr_enemy.cpp"), Object(NonMatching, "d/snd/d_snd_unk_component_2.cpp"), @@ -716,7 +716,7 @@ config.libs = [ Object(Matching, "d/snd/d_snd_control_sound.cpp"), Object(Matching, "d/snd/d_snd_control_player.cpp"), Object(NonMatching, "d/snd/mgr/d_snd_mgr_effect.cpp"), - Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_5.cpp"), + Object(NonMatching, "d/snd/d_snd_harp_mgr.cpp"), Object(NonMatching, "d/snd/d_snd_anim_sound.cpp"), Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_14.cpp"), Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_13.cpp"), diff --git a/include/d/snd/d_snd_actor.h b/include/d/snd/d_snd_actor.h index 5fc2480c..d07a8b5d 100644 --- a/include/d/snd/d_snd_actor.h +++ b/include/d/snd/d_snd_actor.h @@ -2,11 +2,13 @@ #define D_SND_3D_ACTOR_H #include "nw4r/snd/snd_SoundActor.h" -#include "nw4r/snd/snd_SoundHandle.h" class dSndActor_c : public nw4r::snd::SoundActor { public: dSndActor_c(nw4r::snd::SoundArchivePlayer &rPlayer); + +private: + void doesSomethingWithForeachSound(); }; #endif diff --git a/include/d/snd/d_snd_checkers.h b/include/d/snd/d_snd_checkers.h index c34f881b..7a459280 100644 --- a/include/d/snd/d_snd_checkers.h +++ b/include/d/snd/d_snd_checkers.h @@ -2,10 +2,61 @@ #define D_SND_CHECKERS_H #include "nw4r/snd/snd_SoundHandle.h" +#include "toBeSorted/music_mgrs.h" class SoundPropertiesChecker { public: - virtual void operator()(nw4r::snd::SoundHandle &pHandle); + virtual void operator()(nw4r::snd::SoundHandle &pHandle) { + if (mSoundId != -1 && mSoundId != pHandle.GetId()) { + return; + } + + if (mpPlayCounter != nullptr) { + (*mpPlayCounter)++; + } else { + mPlayCounter++; + } + + if (pHandle.IsPause()) { + if (mpPauseCounter != nullptr) { + (*mpPauseCounter)++; + } else { + mPauseCounter++; + } + return; + } + + if (fn_803721F0(FANFARE_SOUND_MGR, pHandle.GetId())) { + if (mpCounter3 != nullptr) { + (*mpCounter3)++; + } else { + mCounter3++; + } + return; + } + + if (fn_803720E0(FANFARE_SOUND_MGR, pHandle.GetId())) { + if (mpCounter3 != nullptr) { + (*mpCounter3)++; + } else { + mCounter3++; + } + return; + } + + if (fn_80372070(FANFARE_SOUND_MGR, pHandle.GetId())) { + if (mpCounter4 != nullptr) { + (*mpCounter4)++; + } else { + mCounter4++; + } + return; + } + + if (fn_803734C0(FANFARE_SOUND_MGR, pHandle.GetId()) && !fn_80373550(FANFARE_SOUND_MGR, pHandle.GetId())) { + mCounter3++; + } + } private: /* 0x04 */ u32 mSoundId; diff --git a/include/d/snd/d_snd_control_player.h b/include/d/snd/d_snd_control_player.h index fc0096ef..33f54205 100644 --- a/include/d/snd/d_snd_control_player.h +++ b/include/d/snd/d_snd_control_player.h @@ -44,7 +44,7 @@ public: class dSndControlPlayerFxSend_c : public dSndControlPlayer_c { public: - dSndControlPlayerFxSend_c() : dSndControlPlayer_c(0.0f, -1.0f, 0.0f) {} + dSndControlPlayerFxSend_c() : dSndControlPlayer_c(0.0f, 0.0f, 1.0f) {} virtual void apply() override; // vt 0x1C virtual f32 getAppliedValue() override; // vt 0x20 diff --git a/include/d/snd/d_snd_control_player_mgr.h b/include/d/snd/d_snd_control_player_mgr.h new file mode 100644 index 00000000..ef9989e1 --- /dev/null +++ b/include/d/snd/d_snd_control_player_mgr.h @@ -0,0 +1,68 @@ +#ifndef D_SND_CONTROL_PLAYER_MGR_H +#define D_SND_CONTROL_PLAYER_MGR_H + +#include "d/snd/d_snd_control_player.h" +#include "d/snd/d_snd_util.h" +#include "nw4r/snd/snd_SoundPlayer.h" +#include "nw4r/ut/ut_list.h" + +class dSndControlPlayerMgr_c; +extern template class SndMgrDisposer; + +class dSndControlPlayerMgr_c { +public: + SndMgrDisposer *GetDisposer() { + return &mDisposer; + } + + static dSndControlPlayerMgr_c *GetInstance() { + return sInstance; + } + + static dSndControlPlayerMgr_c *sInstance; + static SndMgrDisposer *sDisposer; + +private: + SndMgrDisposer mDisposer; + +public: + enum PlayerCtrl_e { + CTRL_VOLUME, + CTRL_LPF_FREQ, + CTRL_FX_SEND, + + CTRL_MAX, + }; + + dSndControlPlayerMgr_c(); + + void calc(); + + static const s32 sNumPlayers; + + nw4r::snd::SoundPlayer *getPlayer1(s32); + nw4r::snd::SoundPlayer *getPlayer2(s32); + + void setLpfFreq(u32 playerIdx, f32 value, s32 frames); + void setFxSend(u32 playerIdx, f32 value, s32 frames); + +private: + void resetControls(); + void executeControls(); + void linkCtrl(dSndControlPlayer_c *); + void unlinkCtrl(dSndControlPlayer_c *); + void setControlValue(PlayerCtrl_e ctrlType, u32 playerIdx, f32 value, s32 frames); + + f32 getTargetValue(PlayerCtrl_e ctrlType, u32 playerIdx) const; + + /* 0x10 */ dSndControlPlayer_c *mpCtrls[CTRL_MAX]; + /* 0x1C */ void *field_0x1C; + /* 0x20 */ void *field_0x20; + /* 0x24 */ void *field_0x24; + /* 0x28 */ f32 *field_0x28; + /* 0x2C */ u32 mControlMask; + /* 0x30 */ nw4r::ut::List mActiveControls; + /* 0x3C */ s16 field_0x3C[8]; +}; + +#endif diff --git a/include/d/snd/d_snd_sound.h b/include/d/snd/d_snd_sound.h index da12e39e..78d95398 100644 --- a/include/d/snd/d_snd_sound.h +++ b/include/d/snd/d_snd_sound.h @@ -43,6 +43,10 @@ public: return mCurrValue; } + f32 getTargetValue() const { + return mTargetValue; + } + bool isFinished() const { return mTimer >= mDuration; } diff --git a/src/d/snd/d_snd_actor.cpp b/src/d/snd/d_snd_actor.cpp index db456ecf..114bb03f 100644 --- a/src/d/snd/d_snd_actor.cpp +++ b/src/d/snd/d_snd_actor.cpp @@ -1,66 +1,12 @@ #include "d/snd/d_snd_actor.h" -#include "common.h" #include "d/snd/d_snd_checkers.h" #include "nw4r/snd/snd_BasicSound.h" #include "nw4r/snd/snd_SoundArchivePlayer.h" -#include "nw4r/snd/snd_SoundHandle.h" -#include "toBeSorted/music_mgrs.h" dSndActor_c::dSndActor_c(nw4r::snd::SoundArchivePlayer &rStartable) : nw4r::snd::SoundActor(rStartable) {} -void d_snd_actor_SoundHandle_dtor() { - nw4r::snd::SoundHandle handle[2]; -} - -void SoundPropertiesChecker::operator()(nw4r::snd::SoundHandle &pHandle) { - if (mSoundId != -1 && mSoundId != pHandle.GetId()) { - return; - } - - if (mpPlayCounter != nullptr) { - (*mpPlayCounter)++; - } else { - mPlayCounter++; - } - - if (pHandle.IsPause()) { - if (mpPauseCounter != nullptr) { - (*mpPauseCounter)++; - } else { - mPauseCounter++; - } - return; - } - - if (fn_803721F0(FANFARE_SOUND_MGR, pHandle.GetId())) { - if (mpCounter3 != nullptr) { - (*mpCounter3)++; - } else { - mCounter3++; - } - return; - } - - if (fn_803720E0(FANFARE_SOUND_MGR, pHandle.GetId())) { - if (mpCounter3 != nullptr) { - (*mpCounter3)++; - } else { - mCounter3++; - } - return; - } - - if (fn_80372070(FANFARE_SOUND_MGR, pHandle.GetId())) { - if (mpCounter4 != nullptr) { - (*mpCounter4)++; - } else { - mCounter4++; - } - return; - } - - if (fn_803734C0(FANFARE_SOUND_MGR, pHandle.GetId()) && !fn_80373550(FANFARE_SOUND_MGR, pHandle.GetId())) { - mCounter3++; - } +void dSndActor_c::doesSomethingWithForeachSound() { + SoundPropertiesChecker checker; + ForEachSound(checker, false); } diff --git a/src/d/snd/d_snd_control_player.cpp b/src/d/snd/d_snd_control_player.cpp index d82931f7..a9a69a04 100644 --- a/src/d/snd/d_snd_control_player.cpp +++ b/src/d/snd/d_snd_control_player.cpp @@ -1,6 +1,7 @@ #include "d/snd/d_snd_control_player.h" #include "common.h" +#include "d/snd/d_snd_control_player_mgr.h" #include "d/snd/d_snd_sound.h" #include "nw4r/snd/snd_SoundPlayer.h" #include "nw4r/snd/snd_global.h" @@ -15,17 +16,13 @@ void dSndControlPlayer_c::reset() { apply(); } -extern "C" void *lbl_80575D4C; -extern "C" nw4r::snd::SoundPlayer *fn_803600B0(void *, s32); -extern "C" nw4r::snd::SoundPlayer *fn_80360120(void *, s32); - void dSndControlPlayer_c::setIndex1(s32 idx) { - mpPlayer = fn_803600B0(lbl_80575D4C, idx); + mpPlayer = dSndControlPlayerMgr_c::GetInstance()->getPlayer1(idx); mIndex = idx; } void dSndControlPlayer_c::setIndex2(s32 idx) { - mpPlayer = fn_80360120(lbl_80575D4C, idx); + mpPlayer = dSndControlPlayerMgr_c::GetInstance()->getPlayer2(idx); mIndex = idx; } diff --git a/src/d/snd/d_snd_control_player_mgr.cpp b/src/d/snd/d_snd_control_player_mgr.cpp new file mode 100644 index 00000000..44375f93 --- /dev/null +++ b/src/d/snd/d_snd_control_player_mgr.cpp @@ -0,0 +1,104 @@ +#include "d/snd/d_snd_control_player_mgr.h" + +#include "common.h" +#include "d/snd/d_snd_control_player.h" +#include "nw4r/ut/ut_list.h" + +template class SndMgrDisposer; + +dSndControlPlayerMgr_c::dSndControlPlayerMgr_c() : mControlMask(0) { + // TODO offsetof + nw4r::ut::List_Init(&mActiveControls, 0x24); + + mpCtrls[CTRL_VOLUME] = new dSndControlPlayerVolume_c[sNumPlayers](); + mpCtrls[CTRL_LPF_FREQ] = new dSndControlPlayerLpfFreq_c[sNumPlayers](); + mpCtrls[CTRL_FX_SEND] = new dSndControlPlayerFxSend_c[sNumPlayers](); + + field_0x28 = new f32[sNumPlayers]; + field_0x1C = new f32[sNumPlayers]; + field_0x20 = new f32[sNumPlayers]; + field_0x24 = new f32[sNumPlayers]; +} + +void dSndControlPlayerMgr_c::calc() {} + +void dSndControlPlayerMgr_c::executeControls() { + dSndControlPlayer_c *next; + dSndControlPlayer_c *iter = static_cast(nw4r::ut::List_GetNext(&mActiveControls, nullptr)); + while (iter != nullptr) { + next = static_cast(nw4r::ut::List_GetNext(&mActiveControls, iter)); + iter->calc(); + iter->apply(); + if (iter->isFinished()) { + unlinkCtrl(iter); + } + iter = next; + } +} + +void dSndControlPlayerMgr_c::linkCtrl(dSndControlPlayer_c *ctrl) { + if (ctrl == nullptr) { + return; + } + if (ctrl->isLinked()) { + return; + } + ctrl->setLinked(true); + nw4r::ut::List_Append(&mActiveControls, ctrl); +} + +void dSndControlPlayerMgr_c::unlinkCtrl(dSndControlPlayer_c *ctrl) { + if (ctrl == nullptr) { + return; + } + if (!ctrl->isLinked()) { + return; + } + ctrl->setLinked(false); + nw4r::ut::List_Remove(&mActiveControls, ctrl); +} + +void dSndControlPlayerMgr_c::setLpfFreq(u32 playerIdx, f32 value, s32 frames) { + if (playerIdx < sNumPlayers) { + setControlValue(CTRL_LPF_FREQ, playerIdx, value, frames); + } +} + +void dSndControlPlayerMgr_c::setFxSend(u32 playerIdx, f32 value, s32 frames) { + if (playerIdx < sNumPlayers) { + setControlValue(CTRL_FX_SEND, playerIdx, value, frames); + } +} + +void dSndControlPlayerMgr_c::setControlValue(PlayerCtrl_e ctrlType, u32 playerIdx, f32 value, s32 frames) { + if (ctrlType < CTRL_MAX && playerIdx < sNumPlayers) { + dSndControlPlayer_c *ctrl = &mpCtrls[ctrlType][playerIdx]; + ctrl->set(value, frames); + if (ctrl->isFinished()) { + unlinkCtrl(ctrl); + } else { + linkCtrl(ctrl); + } + ctrl->apply(); + } +} + +void dSndControlPlayerMgr_c::resetControls() { + for (s32 i = 0; i < sNumPlayers; i++) { + for (s32 ty = 0; ty < CTRL_MAX; ty++) { + mpCtrls[ty][i].reset(); + } + field_0x28[i] = 1.0f; + } + mControlMask = 0; +} + +f32 dSndControlPlayerMgr_c::getTargetValue(PlayerCtrl_e ctrlType, u32 playerIdx) const { + if (ctrlType >= CTRL_MAX) { + return 1.0f; + } + if (playerIdx >= sNumPlayers) { + return 1.0f; + } + return mpCtrls[ctrlType][playerIdx].getTargetValue(); +} diff --git a/src/d/snd/d_snd_mgr.cpp b/src/d/snd/d_snd_mgr.cpp index 6604fcae..982c3fbd 100644 --- a/src/d/snd/d_snd_mgr.cpp +++ b/src/d/snd/d_snd_mgr.cpp @@ -1,12 +1,12 @@ #include "d/snd/d_snd_mgr.h" #include "d/snd/d_snd_3d_manager.h" +#include "d/snd/d_snd_control_player_mgr.h" #include "d/snd/d_snd_player_mgr.h" #include "d/snd/d_snd_util.h" #include "egg/audio/eggAudioRmtSpeakerMgr.h" #include "egg/audio/eggAudioUtility.h" -extern "C" void fn_8035F120(); extern "C" void initEnemySoundMgr(); extern "C" void initFanfareSoundMgr(); extern "C" void initSomeUnusedSoundMgr(); @@ -24,7 +24,7 @@ dSndMgr_c *dSndMgr_c::sInstance; dSndMgr_c::dSndMgr_c(): field_0x6CC(0) { sInstance = this; SndMgrDisposer::create(); - fn_8035F120(); + SndMgrDisposer::create(); initEnemySoundMgr(); SndMgrDisposer::create(); initFanfareSoundMgr();