snd_Sound3DListener OK

This commit is contained in:
robojumper
2025-05-28 00:25:36 +02:00
parent e95b03506b
commit 23fe65685a
8 changed files with 188 additions and 43 deletions
+34
View File
@@ -0,0 +1,34 @@
#ifndef NW4R_SND_SOUND_3D_ENGINE_H
#define NW4R_SND_SOUND_3D_ENGINE_H
#include "nw4r/math.h"
#include "nw4r/types_nw4r.h"
#include "nw4r/snd/snd_Sound3DManager.h"
namespace nw4r {
namespace snd {
class Sound3DManager;
class Sound3DEngine {
public:
Sound3DEngine();
virtual ~Sound3DEngine() {}
virtual void UpdateAmbientParam(const Sound3DManager*, const Sound3DParam*, u32, int, SoundAmbientParam*);
virtual void GetAmbientPriority(const Sound3DManager*, const Sound3DParam*, u32);
virtual s32 GetRequiredVoiceOutCount(const Sound3DManager*, const Sound3DParam*, u32);
virtual void UpdateAmbientParam(const Sound3DManager*, const Sound3DParam*, u32, u32, SoundAmbientParam*);
private:
f32 mSpeakerAngleStereo; // at 0x04
f32 mFrontSpeakerAngleDpl2; // at 0x08
f32 mRearSpeakerAngleDpl2; // at 0x0C
f32 mInitPan; // at 0x10
};
} // namespace snd
} // namespace nw4r
#endif
+22 -14
View File
@@ -1,8 +1,9 @@
#ifndef NW4R_SND_SOUND_3D_LISTENER_H
#define NW4R_SND_SOUND_3D_LISTENER_H
#include "nw4r/math.h"
#include "common.h"
#include "nw4r/types_nw4r.h"
#include "nw4r/math.h"
namespace nw4r {
namespace snd {
@@ -15,32 +16,39 @@ public:
return mMtx;
}
void SetMatrix(const math::MTX34 &mtx);
f32 GetInteriorSize() const {
return mInteriorSize;
}
void SetInteriorSize(f32 size) {
mInteriorSize = size;
}
void SetInteriorSize(f32 size);
f32 GetMaxVolumeDistance() const {
return mMaxVolumeDistance;
}
void SetMaxVolumeDistance(f32 distance) {
mMaxVolumeDistance = distance;
}
void SetMaxVolumeDistance(f32 distance);
f32 GetUnitDistance() const {
return mUnitDistance;
}
void SetUnitDistance(f32 distance) {
mUnitDistance = distance;
}
void SetUnitDistance(f32 distance);
void SetUnitBiquadFilterValue(f32 value);
void SetUnitBiquadFilterMax(f32 value);
private:
math::MTX34 mMtx; // at 0x0
f32 mInteriorSize; // at 0x30
f32 mMaxVolumeDistance; // at 0x34
f32 mUnitDistance; // at 0x38
math::MTX34 mMtx; // at 0x0
math::VEC3 mPosition; // at 0x30
math::VEC3 mVelocity; // at 0x3C
f32 mInteriorSize; // at 0x48
f32 mMaxVolumeDistance; // at 0x4C
f32 mUnitDistance; // at 0x50
UNKWORD field_0x54; // at 0x54
u8 mSkipVelocityUpdate; // at 0x58
f32 mUnitBiquadFilterValue; // at 0x5C
f32 mUnitBiquadFilterMax; // at 0x60
UNKWORD field_0x64; // at 0x64
UNKWORD field_0x68; // at 0x68
};
} // namespace snd
+16 -13
View File
@@ -10,6 +10,19 @@
namespace nw4r {
namespace snd {
struct Sound3DParam
{
/* 0x00 */ u8 _0x00[0x18];
/* 0x18 */ UNKWORD field_0x18;
/* 0x1C */ u8 field_0x1C;
/* 0x1D */ u8 field_0x1D;
/* 0x1E */ u8 field_0x1E;
/* 0x20 */ UNKWORD field_0x20;
/* 0x24 */ UNKWORD field_0x24;
Sound3DParam();
};
class Sound3DManager : public detail::BasicSound::AmbientInfo::AmbientParamUpdateCallback,
public detail::BasicSound::AmbientInfo::AmbientArgAllocaterCallback {
public:
@@ -51,10 +64,6 @@ public:
mMaxPriorityReduction = max;
}
f32 GetPanRange() const {
return mPanRange;
}
private:
enum ParamDecayCurve {
DECAY_CURVE_NONE,
@@ -63,16 +72,10 @@ private:
};
private:
detail::InstancePool<Sound3DActorParam> mParamPool; // at 0x8
detail::InstancePool<Sound3DParam> mParamPool; // at 0x8
Sound3DListener *mListener; // at 0xC
s32 mMaxPriorityReduction; // at 0x10
f32 mSpeakerAngleStereo; // at 0x14
f32 mFrontSpeakerAngleDpl2; // at 0x18
f32 mRearSpeakerAngleDpl2; // at 0x1C
f32 mInitPan; // at 0x20
f32 mPanRange; // at 0x24
u8 _0x10[0x1C - 0x10];
s32 mMaxPriorityReduction; // at 0x1C
};
} // namespace snd