mirror of
https://github.com/zeldaret/ss
synced 2026-06-18 15:35:20 -04:00
snd_Sound3DCalculator OK
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
#ifndef NW4R_SND_SOUND_3D_CALCULATOR_H
|
||||
#define NW4R_SND_SOUND_3D_CALCULATOR_H
|
||||
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
#include "common.h"
|
||||
#include "nw4r/math/math_triangular.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
class Sound3DManager;
|
||||
class Sound3DParam;
|
||||
|
||||
class Sound3DCalculator {
|
||||
public:
|
||||
struct CalcPanParam {
|
||||
#if 0
|
||||
f32 mSpeakerAngleStereo; // at 0x04
|
||||
f32 mFrontSpeakerAngleDpl2; // at 0x08
|
||||
f32 mRearSpeakerAngleDpl2; // at 0x0C
|
||||
f32 mInitPan; // at 0x10
|
||||
#endif
|
||||
f32 field_0x00;
|
||||
f32 field_0x04;
|
||||
f32 field_0x08;
|
||||
f32 field_0x0C;
|
||||
f32 speakerAngleStereo; // at 0x00
|
||||
f32 frontSpeakerAngleDpl2; // at 0x04
|
||||
f32 rearSpeakerAngleDpl2; // at 0x08
|
||||
f32 initPan; // at 0x0C
|
||||
|
||||
CalcPanParam()
|
||||
: field_0x00(NW4R_MATH_PI / 4),
|
||||
field_0x04(NW4R_MATH_PI / 6),
|
||||
field_0x08(2 * NW4R_MATH_PI / 3),
|
||||
field_0x0C(0.0f) {}
|
||||
: speakerAngleStereo(NW4R_MATH_PI / 4),
|
||||
frontSpeakerAngleDpl2(NW4R_MATH_PI / 6),
|
||||
rearSpeakerAngleDpl2(2 * NW4R_MATH_PI / 3),
|
||||
initPan(0.0f) {}
|
||||
};
|
||||
|
||||
static void
|
||||
CalcVolumeAndPriority(const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, float *, int *);
|
||||
static void
|
||||
CalcPan(const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, const Sound3DCalculator::CalcPanParam &, float *pan, float *surroundPan);
|
||||
static void CalcPan(
|
||||
const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, const Sound3DCalculator::CalcPanParam &,
|
||||
float *pan, float *surroundPan
|
||||
);
|
||||
static void CalcPitch(const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, float *);
|
||||
static void CalcBiquadFilterValue(const Sound3DManager &, const Sound3DListener &, const Sound3DParam &, float *);
|
||||
static void CalcPanDpl2(const nw4r::math::VEC3 &, float, float, float, float, float, float, float *, float *);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#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"
|
||||
#include "nw4r/snd/snd_Sound3DCalculator.h"
|
||||
|
||||
|
||||
@@ -11,6 +9,7 @@ namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
class Sound3DManager;
|
||||
class SoundAmbientParam;
|
||||
|
||||
class Sound3DEngine {
|
||||
public:
|
||||
|
||||
@@ -17,6 +17,14 @@ public:
|
||||
return mMtx;
|
||||
}
|
||||
|
||||
const math::VEC3 &GetPosition() const {
|
||||
return mPosition;
|
||||
}
|
||||
|
||||
const math::VEC3 &GetVelocity() const {
|
||||
return mVelocity;
|
||||
}
|
||||
|
||||
void SetMatrix(const math::MTX34 &mtx);
|
||||
|
||||
f32 GetInteriorSize() const {
|
||||
@@ -34,7 +42,14 @@ public:
|
||||
}
|
||||
void SetUnitDistance(f32 distance);
|
||||
|
||||
f32 GetUnitBiquadFilterValue() const {
|
||||
return mUnitBiquadFilterValue;
|
||||
}
|
||||
void SetUnitBiquadFilterValue(f32 value);
|
||||
|
||||
f32 GetUnitBiquadFilterMax() const {
|
||||
return mUnitBiquadFilterMax;
|
||||
}
|
||||
void SetUnitBiquadFilterMax(f32 value);
|
||||
|
||||
private:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define NW4R_SND_SOUND_3D_MANAGER_H
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_InstancePool.h"
|
||||
#include "nw4r/snd/snd_Sound3DEngine.h"
|
||||
#include "nw4r/snd/snd_SoundArchive.h"
|
||||
#include "nw4r/types_nw4r.h"
|
||||
#include "nw4r/ut/ut_LinkList.h"
|
||||
@@ -12,10 +13,11 @@ namespace nw4r {
|
||||
namespace snd {
|
||||
|
||||
struct Sound3DParam {
|
||||
/* 0x00 */ u8 _0x00[0x18];
|
||||
/* 0x00 */ math::VEC3 position;
|
||||
/* 0x0C */ math::VEC3 field_0x0C;
|
||||
/* 0x18 */ UNKWORD field_0x18;
|
||||
/* 0x1C */ u8 field_0x1C;
|
||||
/* 0x1D */ u8 field_0x1D;
|
||||
/* 0x1C */ u8 decayCurve;
|
||||
/* 0x1D */ u8 decayRatio;
|
||||
/* 0x1E */ u8 field_0x1E;
|
||||
/* 0x20 */ UNKWORD field_0x20;
|
||||
/* 0x24 */ UNKWORD field_0x24;
|
||||
@@ -25,15 +27,6 @@ struct Sound3DParam {
|
||||
|
||||
class Sound3DManager : public detail::BasicSound::AmbientInfo::AmbientParamUpdateCallback,
|
||||
public detail::BasicSound::AmbientInfo::AmbientArgAllocaterCallback {
|
||||
public:
|
||||
struct Sound3DActorParam {
|
||||
u32 userParam; // at 0x0
|
||||
SoundArchive::Sound3DParam soundParam; // at 0x4
|
||||
math::VEC3 position; // at 0xC
|
||||
|
||||
Sound3DActorParam();
|
||||
};
|
||||
|
||||
public:
|
||||
typedef ut::LinkList<Sound3DListener, 0x64> ListenerList;
|
||||
|
||||
@@ -74,7 +67,14 @@ public:
|
||||
return biquadFilterType;
|
||||
}
|
||||
|
||||
private:
|
||||
f32 GetField0x20() const {
|
||||
return field_0x20;
|
||||
}
|
||||
|
||||
f32 GetField0x24() const {
|
||||
return field_0x24;
|
||||
}
|
||||
|
||||
enum ParamDecayCurve {
|
||||
DECAY_CURVE_NONE,
|
||||
DECAY_CURVE_LOGARITHMIC,
|
||||
@@ -84,10 +84,11 @@ private:
|
||||
private:
|
||||
detail::InstancePool<Sound3DParam> mParamPool; // at 0x8
|
||||
ListenerList mListenerList; // at 0x0C
|
||||
u8 _0x18[0x1C - 0x18];
|
||||
s32 mMaxPriorityReduction; // at 0x1C
|
||||
u8 _0x1C[0x28 - 0x20];
|
||||
int biquadFilterType; // at 0x28
|
||||
Sound3DEngine *mpEngine; // at 0x18
|
||||
s32 mMaxPriorityReduction; // at 0x1C
|
||||
f32 field_0x20; // at 0x20
|
||||
f32 field_0x24; // at 0x24
|
||||
int biquadFilterType; // at 0x28
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
|
||||
Reference in New Issue
Block a user