Work on Z2AudioLib (#2032)

This commit is contained in:
hatal175
2024-01-13 15:41:29 +02:00
committed by GitHub
parent 6260020b3e
commit ead852383f
42 changed files with 853 additions and 1572 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ class JAISeqMgr : public JAISeqDataUser, public JASGlobalInstance<JAISeqMgr> {
public:
/* 802A1914 */ JAISeqMgr(bool);
/* 802A1A08 */ void freeDeadSeq_();
/* 802A1B48 */ void startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
/* 802A1B48 */ int startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
/* 802A1C90 */ void calc();
/* 802A1DFC */ void stop();
/* 802A1E3C */ void stop(u32);
+7 -1
View File
@@ -8,7 +8,7 @@
class JAISoundID {
public:
operator u32() const { return this->mId.mFullId; }
void operator=(JAISoundID const& other) { mId.mFullId = other.mId.mFullId; };
const JAISoundID& operator=(JAISoundID const& other) { mId.mFullId = other.mId.mFullId; return *this; };
JAISoundID(u32 pId) { mId.mFullId = pId; };
@@ -16,6 +16,10 @@ public:
JAISoundID() {}
// Helps solve some JAISoundID ctor/assignment operator stack issues
// Remove when solved
void stackCopyHelper(JAISoundID other) { mId = other.mId; }
bool isAnonymous() { return mId.mFullId == 0xffffffff; }
void setAnonymous() { mId.mFullId = -1; }
@@ -284,6 +288,8 @@ public:
return;
}
JAISoundParamsProperty& getProperty() { return params.mProperty; }
s32 getCount() const { return mCount; }
JAISoundParamsMove& getAuxiliary() { return params.mMove; }
+2 -11
View File
@@ -3,26 +3,17 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JAudio2/JAIStream.h"
#include "JSystem/JSupport/JSUList.h"
#include "JSystem/JUtility/JUTAssert.h"
class JAIStreamAramMgr;
class JAIStreamDataMgr;
class JAIStreamMgr;
class JAIStream {
public:
/* 802A3104 */ JAIStream(JAIStreamMgr*, JAISoundStrategyMgr<JAIStream>*);
/* 802A319C */ void JAIStreamMgr_startID_(JAISoundID, s32, JGeometry::TVec3<f32> const*,
JAIAudience*, int);
/* 802A34E4 */ void JAIStreamMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
/* 802A388C */ void JAIStreamMgr_calc_();
};
class JAIStreamMgr : public JASGlobalInstance<JAIStreamMgr> {
public:
/* 802A3B68 */ JAIStreamMgr(bool);
/* 802A3C3C */ void startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
/* 802A3C3C */ int startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
/* 802A3D70 */ void freeDeadStream_();
/* 802A3EBC */ void calc();
/* 802A4028 */ void stop();
+1 -4
View File
@@ -13,10 +13,7 @@ struct JAUAudibleParam {
u16 f1;
} half;
struct {
u8 b0_0 : 1;
u8 b0_1 : 1;
u8 b0_2 : 1;
u8 b0_3 : 1;
u8 b0_0 : 4;
u8 b0_4 : 1;
u8 b0_5 : 1;
u8 b0_6 : 1;
+2 -1
View File
@@ -3,11 +3,12 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JAudio2/JAUAudibleParam.h"
class JAUSoundInfo : public JASGlobalInstance<JAUSoundInfo> {
public:
JAUSoundInfo(bool param_0) : JASGlobalInstance<JAUSoundInfo>(param_0) {}
virtual void getAudibleSw(JAISoundID) const = 0;
virtual u16 getAudibleSw(JAISoundID) const = 0;
virtual u16 getBgmSeqResourceID(JAISoundID) const = 0;
};
+13 -3
View File
@@ -4,6 +4,14 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
struct JAUSoundTableItem {
u8 mPriority;
u8 field_0x1;
u16 mResourceId;
u32 field_0x4;
f32 field_0x8;
};
template<typename Root, typename Section, typename Group, typename Typename_0>
struct JAUSoundTable_ {
JAUSoundTable_() {
@@ -116,16 +124,18 @@ struct JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
/* 802A7114 */ void init(void const*);
/* 802A7160 */ u8 getTypeID(JAISoundID) const;
/* 802A728C */ void* getData(JAISoundID) const;
/* 802A728C */ JAUSoundTableItem* getData(JAISoundID) const;
void* getItem(JAUSoundTableGroup* group, int index) const {
JAUSoundTableItem* getItem(JAUSoundTableGroup* group, int index) const {
u32 offset = group->getItemOffset(index);
if (offset == 0) {
return NULL;
}
return (void*)((u8*)field_0x0.field_0x0 + offset);
return (JAUSoundTableItem*)((u8*)field_0x0.field_0x0 + offset);
}
const void* getResource() { return field_0x0.field_0x0; }
JAUSoundTable_<JAUSoundTableRoot,JAUSoundTableSection,JAUSoundTableGroup,void> field_0x0;
};
+4
View File
@@ -15,6 +15,10 @@ struct TRandom_fast_ {
u32 get_bit32(void) { return this->get(); }
s8 get_uint8(u8 param_0) {
return get_ufloat_1() * param_0;
}
// due to the float constant, having this function inlined adds that float to data,
// making it not match
float get_ufloat_1(void) {
+2 -2
View File
@@ -39,7 +39,7 @@ struct Z2LinkSoundStarter : public Z2SoundStarter {
Z2LinkSoundStarter();
inline virtual ~Z2LinkSoundStarter();
virtual void startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*, u32, f32,
virtual int startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*, u32, f32,
f32, f32, f32, f32, u32);
};
@@ -126,7 +126,7 @@ struct Z2RideSoundStarter : public Z2SoundStarter {
/* 802C5234 */ Z2RideSoundStarter(Z2CreatureRide*);
/* 802C5078 */ inline virtual ~Z2RideSoundStarter();
/* 802C5284 */ virtual void startSound(JAISoundID, JAISoundHandle*,
/* 802C5284 */ virtual int startSound(JAISoundID, JAISoundHandle*,
JGeometry::TVec3<f32> const*, u32, f32, f32, f32, f32,
f32, u32);
+5 -1
View File
@@ -73,7 +73,7 @@ struct Z2EnvSeMgr : public JASGlobalInstance<Z2EnvSeMgr> {
/* 802C92C8 */ void registWolfSmellSePos(Vec*);
/* 802C92EC */ void startFogWipeTrigger(Vec*);
/* 802C93A0 */ void setFogWipeWidth(f32);
/* 802C93E4 */ void getFogDensity();
/* 802C93E4 */ f32 getFogDensity();
/* 802C9400 */ void startFogSe();
/* 802C950C */ void initLv3WaterSe(u8, u8, u8, u8);
/* 802C9F58 */ void registLv3WaterSePos(u8, Vec*);
@@ -170,4 +170,8 @@ STATIC_ASSERT(sizeof(Z2EnvSeMgr) == 0x30C);
extern Z2EnvSeMgr g_mEnvSeMgr;
inline Z2EnvSeMgr* Z2GetEnvSeMgr() {
return JASGlobalInstance<Z2EnvSeMgr>::getInstance();
}
#endif /* Z2ENVSEMGR_H */
+4
View File
@@ -4,6 +4,8 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASGadget.h"
s8 dComIfGp_getReverb(int roomNo);
class Z2SceneMgr : public JASGlobalInstance<Z2SceneMgr> {
public:
Z2SceneMgr();
@@ -31,6 +33,8 @@ public:
bool isSceneExist() const { return sceneExist; }
int getCurrentSceneNum() const { return sceneNum; }
bool isInGame() const { return inGame; }
bool isInDarkness() const { return inDarkness; }
s8 getRoomReverb() const { return dComIfGp_getReverb(roomNum); }
private:
/* 0x00 */ long BGM_ID;
+4 -2
View File
@@ -4,11 +4,12 @@
#include "JSystem/JAudio2/JAISoundInfo.h"
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
#include "JSystem/JAudio2/JAUSoundInfo.h"
#include "JSystem/JAudio2/JAUAudibleParam.h"
class Z2SoundInfo : public JAISoundInfo, public JAUSoundInfo, public JAIStreamDataMgr, public JASGlobalInstance<Z2SoundInfo> {
public:
Z2SoundInfo() : JAISoundInfo(true), JAUSoundInfo(true), JASGlobalInstance<Z2SoundInfo>(true) {}
/* 802BB448 */ virtual void getAudibleSw(JAISoundID) const;
/* 802BB448 */ virtual u16 getAudibleSw(JAISoundID) const;
/* 802BB00C */ virtual u16 getBgmSeqResourceID(JAISoundID) const;
/* 802BBA88 */ virtual s32 getStreamFileEntry(JAISoundID);
/* 802BB090 */ virtual u32 getSoundType(JAISoundID) const;
@@ -19,12 +20,13 @@ public:
/* 802BB8E0 */ virtual void getStreamInfo(JAISoundID, JAIStream*) const;
/* 802BBBE0 */ virtual ~Z2SoundInfo();
/* 802BB158 */ u32 getAudibleSwFull(JAISoundID);
/* 802BB158 */ JAUAudibleParam getAudibleSwFull(JAISoundID);
/* 802BBA10 */ const char* getStreamFilePath(JAISoundID);
/* 802BBAC8 */ int getSwBit(JAISoundID) const;
/* 802BBB48 */ void getSoundInfo_(JAISoundID, JAISound*) const;
};
inline Z2SoundInfo* Z2GetSoundInfo() {
return JASGlobalInstance<Z2SoundInfo>::getInstance();
}
+4 -4
View File
@@ -7,11 +7,11 @@
struct Z2SoundStarter : public JAISoundStarter, public JASGlobalInstance<Z2SoundStarter> {
Z2SoundStarter(bool);
void setPortData(JAISoundHandle*, u32, u16, s8);
void getPortData(JAISoundHandle*, u32, s8);
u16 getPortData(JAISoundHandle*, u32, s8);
virtual ~Z2SoundStarter();
virtual void startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
virtual void startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*, u32, float,
virtual ~Z2SoundStarter() {}
virtual int startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
virtual int startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*, u32, float,
float, float, float, float, u32);
};
+6 -6
View File
@@ -10,7 +10,7 @@ struct Z2SpeechStarter : public Z2SoundStarter {
/* 802CCFB8 */ Z2SpeechStarter();
/* 802CBCEC */ virtual ~Z2SpeechStarter();
/* 802CCFF8 */ virtual void startSound(JAISoundID, JAISoundHandle*,
/* 802CCFF8 */ virtual int startSound(JAISoundID, JAISoundHandle*,
JGeometry::TVec3<f32> const*, u32, f32, f32, f32, f32,
f32, u32);
};
@@ -20,26 +20,26 @@ struct Z2SpeechMgr2 : public JASGlobalInstance<Z2SpeechMgr2> {
/* 802CBD88 */ void setString(u16 const*, s16, u8, u16);
/* 802CBF60 */ void setTextCount(s16);
/* 802CC190 */ void speakOneWord(bool);
/* 802CC2FC */ void isNonVerbal();
/* 802CC2FC */ bool isNonVerbal();
/* 802CC4C0 */ void selectUnit(bool);
/* 802CC738 */ void selectTail();
/* 802CC9D0 */ void framework();
/* 802CCA18 */ void playOneShotVoice(u8, u16, Vec*, s8);
/* 802CCF88 */ void isMidnaSpeak();
/* 802CCF88 */ bool isMidnaSpeak();
/* 0x000 */ JAISoundHandle field_0x0;
/* 0x004 */ JAISoundHandle field_0x4;
/* 0x008 */ JMath::TRandom_fast_ random;
/* 0x00C */ Z2SpeechStarter mSpeech;
/* 0x010 */ u16 field_0x10[500];
/* 0x3F8 */ u16 field_0x3f8;
/* 0x3FA */ u16 field_0x3fa;
/* 0x3F8 */ s16 field_0x3f8;
/* 0x3FA */ s16 field_0x3fa;
/* 0x3FC */ u16 field_0x3fc;
/* 0x3FE */ u8 field_0x3fe;
/* 0x3FF */ u8 field_0x3ff;
/* 0x400 */ u8 field_0x400;
/* 0x401 */ u8 field_0x401;
/* 0x402 */ u8 field_0x402[64];
/* 0x402 */ s8 field_0x402[64];
}; // Size: 0x444
STATIC_ASSERT(sizeof(Z2SpeechMgr2) == 0x444);
+1
View File
@@ -24,6 +24,7 @@ struct Z2StatusMgr : public JASGlobalInstance<Z2StatusMgr> {
void setHour(s32 hour) { mHour = hour; }
void setMinute(s32 min) { mMinute = min; }
void setWeekday(s32 day) { mWeekday = day; }
f32 getCameraInWaterDepthRatio() const { return mCameraInWaterDepthRatio; }
/* 0x00 */ u8 mHour;
/* 0x01 */ u8 mMinute;