se sound pool

This commit is contained in:
robojumper
2025-06-14 00:35:04 +02:00
parent 05c7eb29c9
commit baa9c8e5de
11 changed files with 210 additions and 38 deletions
+2 -3
View File
@@ -3,7 +3,6 @@
#include "common.h"
#include "d/snd/d_snd_3d_actor.h"
#include "m/m_vec.h"
#include "nw4r/math/math_types.h"
#include "nw4r/snd/snd_SoundHandle.h"
#include "nw4r/ut/ut_list.h"
@@ -40,8 +39,8 @@ public:
}
private:
/* 0x0E4 */ nw4r::ut::Node mDistantLink;
/* 0x0EC */ u8 _0x0EC[0x0F4 - 0x0EC];
/* 0x0E4 */ nw4r::ut::Node mPoolLink; // sound actor pool link
/* 0x0EC */ nw4r::ut::Node mSourceLink; // sound source link
/* 0x0F4 */ UNKWORD field_0x0F4;
/* 0x0F8 */ dSoundSource_c *mpSoundSource;
/* 0x0FC */ nw4r::snd::SoundHandle mSoundHandle;
@@ -2,9 +2,9 @@
#define D_SND_DISTANT_SOUND_ACTOR_POOL_H
#include "common.h"
#include "d/snd/d_snd_distant_sound_actor.h"
#include "d/snd/d_snd_misc.h"
#include "d/snd/d_snd_util.h"
#include "d/snd/d_snd_distant_sound_actor.h"
#include "nw4r/ut/ut_list.h"
SND_DISPOSER_FORWARD_DECL(dSndDistantSoundActorPool_c);
@@ -17,15 +17,19 @@ SND_DISPOSER_FORWARD_DECL(dSndDistantSoundActorPool_c);
class dSndDistantSoundActorPool_c {
SND_DISPOSER_MEMBERS(dSndDistantSoundActorPool_c);
static const s32 POOL_SIZE = 64;
public:
dSndDistantSoundActorPool_c();
static dSndSourceParam& getSourceParam() {
static dSndSourceParam &getSourceParam() {
return sParam;
}
void onChangeStage();
private:
/* 0x0010 */ dSndDistantSoundActor_c mSounds[64];
/* 0x0010 */ dSndDistantSoundActor_c mSounds[POOL_SIZE];
/* 0x4210 */ UNKWORD field_0x4210;
/* 0x4214 */ nw4r::ut::List mList;
+13 -6
View File
@@ -32,17 +32,24 @@ public:
/* vt 0x10 */ virtual void onCalc(dSoundSource_c *source);
void calc(dSoundSource_c *source);
void clear();
// not sure what this does
void shiftPair(const UnkSeSoundStruct *p);
void shiftValue(f32 value);
typedef void Callback(dSndSeSound_c *sound, dSoundSource_c *source, nw4r::snd::SoundHandle &handle);
protected:
void clear();
/* 0x004 */ u8 _0x004[0x00C - 0x004];
typedef void Callback(dSndSeSound_c *sound, dSoundSource_c *source, nw4r::snd::SoundHandle &handle);
void stop(s32 fadeFrames) {
mpSoundHandle->Stop(fadeFrames);
}
bool isAttachedSound() const {
return mpSoundHandle->IsAttachedSound();
}
protected:
/* 0x004 */ nw4r::ut::Node mSourceLink;
/* 0x00C */ nw4r::ut::Node mPoolLink;
/* 0x014 */ UNKWORD field_0x014;
/* 0x018 */ dSndSound_c mSound;
+40
View File
@@ -0,0 +1,40 @@
#ifndef D_SND_SE_SOUND_POOL_H
#define D_SND_SE_SOUND_POOL_H
#include "common.h"
#include "d/snd/d_snd_se_sound_1.h"
#include "d/snd/d_snd_se_sound_2.h"
#include "d/snd/d_snd_util.h"
#include "nw4r/ut/ut_list.h"
class dSoundSource_c;
SND_DISPOSER_FORWARD_DECL(dSndSeSoundPool_c);
class dSndSeSoundPool_c {
SND_DISPOSER_MEMBERS(dSndSeSoundPool_c)
static const u32 POOL_SIZE = 64;
public:
dSndSeSoundPool_c();
void calc();
dSndSeSound1_c *acquireSoundType1(dSoundSource_c *source, u32 soundId);
dSndSeSound2_c *acquireSoundType2(dSoundSource_c *source, u32 soundId);
void releaseSoundType1(dSndSeSound1_c *sound, bool arg);
void releaseSoundType2(dSndSeSound2_c *sound);
private:
void removeSoundType1(dSndSeSound1_c *sound);
void removeSoundType2(dSndSeSound2_c *sound);
/* 0x0010 */ nw4r::ut::List mFreeType1List;
/* 0x001C */ nw4r::ut::List mActiveType1List;
/* 0x0028 */ nw4r::ut::List mFreeType2List;
/* 0x0034 */ dSndSeSound1_c mSoundsType1[POOL_SIZE];
/* 0x4A34 */ dSndSeSound2_c mSoundsType2[POOL_SIZE];
};
#endif
+2 -2
View File
@@ -106,8 +106,8 @@ private:
/* 0x10C */ UNKWORD field_0x10C;
/* 0x110 */ nw4r::ut::List mDistantSoundList; // node offset 0xEC -> dSndDistantSoundActor_c
/* 0x11C */ UNKWORD field_0x11C;
/* 0x120 */ nw4r::ut::List field_0x120; // node offset 0x4
/* 0x12C */ nw4r::ut::List field_0x12C; // node offset 0x4
/* 0x120 */ nw4r::ut::List field_0x120; // node offset 0x4 -> dSndSeSound_c
/* 0x12C */ nw4r::ut::List field_0x12C; // node offset 0x4 -> dSndSeSound_c
/* 0x138 */ nw4r::ut::Node mGroupLink; // node for list in dSndSourceGroup_c
/* 0x140 */ dSndSourceGroup_c *mpOwnerGroup;
/* 0x144 */ u8 _0x144[0x154 - 0x144];