summaryrefslogtreecommitdiff
path: root/include/JSystem
diff options
context:
space:
mode:
authorhatal175 <hatal175@users.noreply.github.com>2024-01-13 15:41:29 +0200
committerGitHub <noreply@github.com>2024-01-13 05:41:29 -0800
commitead852383fef10f3a7876af7f280d9707ac9e3ef (patch)
treea0c0ab1d2ffac1788bffefcf511183de62efad22 /include/JSystem
parent6260020b3e40a5227572f4a129ddf5f970f7b72c (diff)
Work on Z2AudioLib (#2032)
Diffstat (limited to 'include/JSystem')
-rw-r--r--include/JSystem/JAudio2/JAISeqMgr.h2
-rw-r--r--include/JSystem/JAudio2/JAISound.h8
-rw-r--r--include/JSystem/JAudio2/JAIStreamMgr.h13
-rw-r--r--include/JSystem/JAudio2/JAUAudibleParam.h5
-rw-r--r--include/JSystem/JAudio2/JAUSoundInfo.h3
-rw-r--r--include/JSystem/JAudio2/JAUSoundTable.h16
-rw-r--r--include/JSystem/JMath/random.h4
7 files changed, 30 insertions, 21 deletions
diff --git a/include/JSystem/JAudio2/JAISeqMgr.h b/include/JSystem/JAudio2/JAISeqMgr.h
index b0373ef4d4..86b5dbe21a 100644
--- a/include/JSystem/JAudio2/JAISeqMgr.h
+++ b/include/JSystem/JAudio2/JAISeqMgr.h
@@ -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);
diff --git a/include/JSystem/JAudio2/JAISound.h b/include/JSystem/JAudio2/JAISound.h
index 5a60a6eae2..310622c84f 100644
--- a/include/JSystem/JAudio2/JAISound.h
+++ b/include/JSystem/JAudio2/JAISound.h
@@ -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; }
diff --git a/include/JSystem/JAudio2/JAIStreamMgr.h b/include/JSystem/JAudio2/JAIStreamMgr.h
index 2ce2b8f884..c98c1b9d6b 100644
--- a/include/JSystem/JAudio2/JAIStreamMgr.h
+++ b/include/JSystem/JAudio2/JAIStreamMgr.h
@@ -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();
diff --git a/include/JSystem/JAudio2/JAUAudibleParam.h b/include/JSystem/JAudio2/JAUAudibleParam.h
index 079864c06e..7ff7e87425 100644
--- a/include/JSystem/JAudio2/JAUAudibleParam.h
+++ b/include/JSystem/JAudio2/JAUAudibleParam.h
@@ -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;
diff --git a/include/JSystem/JAudio2/JAUSoundInfo.h b/include/JSystem/JAudio2/JAUSoundInfo.h
index 078f1db924..9aa0e9d423 100644
--- a/include/JSystem/JAudio2/JAUSoundInfo.h
+++ b/include/JSystem/JAudio2/JAUSoundInfo.h
@@ -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;
};
diff --git a/include/JSystem/JAudio2/JAUSoundTable.h b/include/JSystem/JAudio2/JAUSoundTable.h
index a91f711118..67e0d72014 100644
--- a/include/JSystem/JAudio2/JAUSoundTable.h
+++ b/include/JSystem/JAudio2/JAUSoundTable.h
@@ -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;
};
diff --git a/include/JSystem/JMath/random.h b/include/JSystem/JMath/random.h
index c8448ed513..84d3dfa64c 100644
--- a/include/JSystem/JMath/random.h
+++ b/include/JSystem/JMath/random.h
@@ -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) {