mirror of
https://github.com/zeldaret/ss
synced 2026-08-09 02:46:51 -04:00
More player control
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<dSndControlPlayerMgr_c>;
|
||||
|
||||
class dSndControlPlayerMgr_c {
|
||||
public:
|
||||
SndMgrDisposer<dSndControlPlayerMgr_c> *GetDisposer() {
|
||||
return &mDisposer;
|
||||
}
|
||||
|
||||
static dSndControlPlayerMgr_c *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static dSndControlPlayerMgr_c *sInstance;
|
||||
static SndMgrDisposer<dSndControlPlayerMgr_c> *sDisposer;
|
||||
|
||||
private:
|
||||
SndMgrDisposer<dSndControlPlayerMgr_c> 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
|
||||
@@ -43,6 +43,10 @@ public:
|
||||
return mCurrValue;
|
||||
}
|
||||
|
||||
f32 getTargetValue() const {
|
||||
return mTargetValue;
|
||||
}
|
||||
|
||||
bool isFinished() const {
|
||||
return mTimer >= mDuration;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user