summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJcw87 <Jcw87@users.noreply.github.com>2025-12-26 13:20:53 -0800
committerGitHub <noreply@github.com>2025-12-26 13:20:53 -0800
commitbae6d9da2d03ea94d7eb87c8fe5255abd01f34c6 (patch)
tree2d3191ea80511e80c23b1cd879054926bc5a6a8d /include
parent67b576ad9aec15953fa0d52f33cc88e8a783b46b (diff)
JAudio2 debug (#2996)
Diffstat (limited to 'include')
-rw-r--r--include/JSystem/JAudio2/JAISe.h2
-rw-r--r--include/JSystem/JAudio2/JAISeMgr.h7
-rw-r--r--include/JSystem/JAudio2/JAISeq.h2
-rw-r--r--include/JSystem/JAudio2/JAISeqMgr.h3
-rw-r--r--include/JSystem/JAudio2/JASBNKParser.h4
-rw-r--r--include/JSystem/JAudio2/JASBank.h2
-rw-r--r--include/JSystem/JAudio2/JASChannel.h7
-rw-r--r--include/JSystem/JAudio2/JASHeapCtrl.h35
-rw-r--r--include/JSystem/JAudio2/JASOscillator.h8
-rw-r--r--include/JSystem/JAudio2/JASSeqReader.h3
-rw-r--r--include/JSystem/JAudio2/JASTrackPort.h4
-rw-r--r--include/JSystem/JAudio2/JASWSParser.h2
-rw-r--r--include/JSystem/JSupport/JSUList.h4
-rw-r--r--include/JSystem/JSupport/JSupport.h6
14 files changed, 62 insertions, 27 deletions
diff --git a/include/JSystem/JAudio2/JAISe.h b/include/JSystem/JAudio2/JAISe.h
index e23372410d..408a84703a 100644
--- a/include/JSystem/JAudio2/JAISe.h
+++ b/include/JSystem/JAudio2/JAISe.h
@@ -10,7 +10,7 @@ class JAISeMgr;
* @ingroup jsystem-jaudio
*
*/
-class JAISe : public JSULink<JAISe>, public JASPoolAllocObject<JAISe>, public JAISound {
+class JAISe : public JSULink<JAISe>, public JAISound, public JASPoolAllocObject<JAISe> {
public:
class TInner {
public:
diff --git a/include/JSystem/JAudio2/JAISeMgr.h b/include/JSystem/JAudio2/JAISeMgr.h
index 0ec8a510a8..10f559595c 100644
--- a/include/JSystem/JAudio2/JAISeMgr.h
+++ b/include/JSystem/JAudio2/JAISeMgr.h
@@ -69,6 +69,7 @@ public:
return mMaxActiveSe + mMaxInactiveSe;
}
+ int getMaxInactiveSe() const { return mMaxInactiveSe; }
int getMaxActiveSe() const { return mMaxActiveSe; }
void setMaxActiveSe(int num) { mMaxActiveSe = num; }
void setMaxInactiveSe(int num) { mMaxInactiveSe = num; }
@@ -88,11 +89,11 @@ public:
*
*/
class JAISeMgr : public JASGlobalInstance<JAISeMgr>,
- public JAISeqDataUser,
- public JAISoundActivity {
+ public JAISeqDataUser {
public:
JAISeMgr(bool setInstance);
void setCategoryArrangement(const JAISeCategoryArrangement& arrangement);
+ void getCategoryArrangement(JAISeCategoryArrangement*);
void stop();
void stopSoundID(JAISoundID id);
void initParams();
@@ -105,6 +106,8 @@ public:
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
int getNumActiveSe() const;
+ /* 0x004 */ JAISoundActivity mSoundActivity;
+
virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
diff --git a/include/JSystem/JAudio2/JAISeq.h b/include/JSystem/JAudio2/JAISeq.h
index b6cb55b5dc..b619ea4396 100644
--- a/include/JSystem/JAudio2/JAISeq.h
+++ b/include/JSystem/JAudio2/JAISeq.h
@@ -52,7 +52,7 @@ public:
void mixOut_(const JASSoundParams& params, JAISoundActivity activity);
void JAISeqMgr_mixOut_(const JASSoundParams& params, JAISoundActivity activity);
- JAISeqData& getSeqData() { return inner_.mSeqData; }
+ const JAISeqData& getSeqData() const { return inner_.mSeqData; }
/* 0x0A8 */ TInner inner_;
/* 0x3A8 */ JAISoundStrategyMgr__unknown<JAISeq>* field_0x3a8;
diff --git a/include/JSystem/JAudio2/JAISeqMgr.h b/include/JSystem/JAudio2/JAISeqMgr.h
index cdbf853a62..87c85f316f 100644
--- a/include/JSystem/JAudio2/JAISeqMgr.h
+++ b/include/JSystem/JAudio2/JAISeqMgr.h
@@ -29,6 +29,8 @@ public:
JAISeq* beginStartSeq_();
bool endStartSeq_(JAISeq* seq, JAISoundHandle* handle);
+ /* 0x04 */ JAISoundActivity mActivity;
+
virtual ~JAISeqMgr() {}
virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
@@ -59,7 +61,6 @@ public:
void pause(bool paused) { mActivity.field_0x0.flags.flag2 = paused; }
private:
- /* 0x04 */ JAISoundActivity mActivity;
/* 0x08 */ JAIAudience* mAudience;
/* 0x0C */ JAISeqDataMgr* seqDataMgr_;
/* 0x10 */ JAISoundStrategyMgr<JAISeq>* field_0x10;
diff --git a/include/JSystem/JAudio2/JASBNKParser.h b/include/JSystem/JAudio2/JASBNKParser.h
index bfbad8376c..bebe1a1f05 100644
--- a/include/JSystem/JAudio2/JASBNKParser.h
+++ b/include/JSystem/JAudio2/JASBNKParser.h
@@ -18,7 +18,7 @@ namespace JASBNKParser {
namespace Ver1 {
struct TOsc {
- /* 0x00 */ u8 _00[4];
+ /* 0x00 */ u32 id;
/* 0x04 */ u8 mTarget;
/* 0x08 */ f32 _08;
/* 0x0C */ u32 mTableOffset;
@@ -50,7 +50,7 @@ namespace JASBNKParser {
};
struct TListChunk : TChunk {
- /* 0x8 */ u32 mCount;
+ /* 0x8 */ u32 count;
/* 0xC */ u32 mOffsets[0];
};
diff --git a/include/JSystem/JAudio2/JASBank.h b/include/JSystem/JAudio2/JASBank.h
index 8daa926938..67136da0ee 100644
--- a/include/JSystem/JAudio2/JASBank.h
+++ b/include/JSystem/JAudio2/JASBank.h
@@ -17,6 +17,8 @@ namespace JASDsp {
*/
class JASBank {
public:
+ static const int PRG_OSC = 240;
+
JASBank() { mWaveBank = NULL; }
virtual ~JASBank() {};
virtual bool getInstParam(int, int, int, JASInstParam*) const = 0;
diff --git a/include/JSystem/JAudio2/JASChannel.h b/include/JSystem/JAudio2/JASChannel.h
index 6cd2d4c0de..5b4a959372 100644
--- a/include/JSystem/JAudio2/JASChannel.h
+++ b/include/JSystem/JAudio2/JASChannel.h
@@ -53,6 +53,7 @@ class JASChannel : public JASPoolAllocObject_MultiThreaded<JASChannel> {
public:
typedef void (*Callback)(u32, JASChannel*, JASDsp::TChannel*, void*);
static const int BUSOUT_CPUCH = 6;
+ static const int OSC_NUM = 2;
enum CallbackType {
/* 0 */ CB_PLAY,
@@ -62,8 +63,8 @@ public:
};
enum Status {
- /* 0 */ STATUS_INACTIVE,
- /* 1 */ STATUS_ACTIVE,
+ /* 0 */ STATUS_STOP,
+ /* 1 */ STATUS_PLAY,
/* 2 */ STATUS_RELEASE,
};
@@ -129,7 +130,7 @@ public:
void setKey(s32 param_0) { mKey = param_0; }
void setVelocity(u32 param_0) { mVelocity = param_0; }
void setSkipSamples(u32 param_0) { mSkipSamples = param_0; }
- bool isDolbyMode() { return mMixConfig[0].whole == 0xffff; }
+ bool isDolbyMode() const { return mMixConfig[0].whole == 0xffff; }
/* 0x00 */ int mStatus;
/* 0x04 */ bool mPauseFlag;
diff --git a/include/JSystem/JAudio2/JASHeapCtrl.h b/include/JSystem/JAudio2/JASHeapCtrl.h
index af04892178..759ac8fda6 100644
--- a/include/JSystem/JAudio2/JASHeapCtrl.h
+++ b/include/JSystem/JAudio2/JASHeapCtrl.h
@@ -22,8 +22,8 @@ public:
bool alloc(JASHeap*, u32);
bool allocTail(JASHeap*, u32);
bool free();
- u32 getTotalFreeSize();
- u32 getFreeSize();
+ u32 getTotalFreeSize() const;
+ u32 getFreeSize() const;
void insertChild(JASHeap*, JASHeap*, void*, u32, bool);
JASHeap* getTailHeap();
u32 getTailOffset();
@@ -203,6 +203,7 @@ public:
}
bool createNewChunk() {
+ bool r27 = 0;
if (field_0x18 != NULL && field_0x18->isEmpty()) {
field_0x18->revive();
return true;
@@ -242,7 +243,7 @@ public:
while (chunk != NULL) {
if (chunk->checkArea(ptr)) {
chunk->free(ptr);
-
+ bool r26 = false;
if (chunk != field_0x18 && chunk->isEmpty()) {
MemoryChunk* nextChunk = chunk->getNextChunk();
delete chunk;
@@ -283,38 +284,54 @@ template <typename T>
class JASPoolAllocObject {
public:
static void* operator new(size_t n) {
+#if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_();
+#endif
return memPool_.alloc(n);
}
static void* operator new(size_t n, void* ptr) {
return ptr;
}
static void operator delete(void* ptr, size_t n) {
+#if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_();
+#endif
memPool_.free(ptr, n);
}
static void newMemPool(int param_0) {
+#if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_();
+#endif
memPool_.newMemPool(param_0);
}
static u32 getFreeMemCount() {
+#if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_();
+#endif
return memPool_.getFreeMemCount();
}
static u32 getTotalMemCount() {
+#if PLATFORM_GCN
JASMemPool<T>& memPool_ = getMemPool_();
+#endif
return memPool_.getTotalMemCount();
}
private:
// Fakematch? Is memPool_ both an in-function static and an out-of-function static?
static JASMemPool<T> memPool_;
+#if PLATFORM_GCN
static JASMemPool<T>& getMemPool_() {
static JASMemPool<T> memPool_;
return memPool_;
}
+#endif
};
+#if !PLATFORM_GCN
+template <typename T> JASMemPool<T> JASPoolAllocObject<T>::memPool_;
+#endif
+
/**
* @ingroup jsystem-jaudio
*
@@ -346,31 +363,43 @@ template <typename T>
class JASPoolAllocObject_MultiThreaded {
public:
static void* operator new(size_t n) {
+#if PLATFORM_GCN
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
+#endif
return memPool_.alloc(n);
}
static void* operator new(size_t n, void* ptr) {
return ptr;
}
static void operator delete(void* ptr, size_t n) {
+#if PLATFORM_GCN
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
+#endif
memPool_.free(ptr, n);
}
static void newMemPool(int n) {
+#if PLATFORM_GCN
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
+#endif
memPool_.newMemPool(n);
}
private:
// Fakematch? Is memPool_ both an in-function static and an out-of-function static?
static JASMemPool_MultiThreaded<T> memPool_;
+#if PLATFORM_GCN
static JASMemPool_MultiThreaded<T>& getMemPool() {
static JASMemPool_MultiThreaded<T> memPool_;
return memPool_;
}
+#endif
};
+#if !PLATFORM_GCN
+template <typename T> JASMemPool_MultiThreaded<T> JASPoolAllocObject_MultiThreaded<T>::memPool_;
+#endif
+
extern JKRSolidHeap* JASDram;
#endif /* JASHEAPCTRL_H */
diff --git a/include/JSystem/JAudio2/JASOscillator.h b/include/JSystem/JAudio2/JASOscillator.h
index bfff094f5c..56e7dbf966 100644
--- a/include/JSystem/JAudio2/JASOscillator.h
+++ b/include/JSystem/JAudio2/JASOscillator.h
@@ -64,10 +64,10 @@ struct JASOscillator {
void setDirectRelease(u16 param_0) { mDirectRelease = param_0; }
void stop() { _1C = 0; }
- bool isValid() { return mData != NULL; }
- bool isStop() { return _1C == 0; }
- bool isRelease() { return _1C == 3 || _1C == 4; }
- u32 getTarget() { return mData->mTarget; }
+ bool isValid() const { return mData != NULL; }
+ bool isStop() const { return _1C == 0; }
+ bool isRelease() const { return _1C == 3 || _1C == 4; }
+ u32 getTarget() const { return mData->mTarget; }
/* 0x00 */ const Data* mData;
/* 0x04 */ f32 _04;
diff --git a/include/JSystem/JAudio2/JASSeqReader.h b/include/JSystem/JAudio2/JASSeqReader.h
index 24cc48a1d7..b600d49504 100644
--- a/include/JSystem/JAudio2/JASSeqReader.h
+++ b/include/JSystem/JAudio2/JASSeqReader.h
@@ -9,6 +9,7 @@
*/
class JASSeqReader {
public:
+ JASSeqReader() { init(); }
void init();
void init(void*);
bool call(u32);
@@ -25,7 +26,7 @@ public:
field_0x04 = (u8*)param_1;
}
- u32 get24(int param_0) const {
+ u32 get24(u32 param_0) const {
return (*(u32*)(field_0x00 + param_0 - 1)) & 0xffffff;
}
diff --git a/include/JSystem/JAudio2/JASTrackPort.h b/include/JSystem/JAudio2/JASTrackPort.h
index 08ebd4360a..f020ae3bd1 100644
--- a/include/JSystem/JAudio2/JASTrackPort.h
+++ b/include/JSystem/JAudio2/JASTrackPort.h
@@ -9,6 +9,8 @@
*/
class JASTrackPort {
public:
+ static const int MAX_PORTS = 16;
+
void init();
u16 readImport(u32);
u16 readExport(u32);
@@ -22,7 +24,7 @@ public:
u16 field_0x0;
u16 field_0x2;
- u16 field_0x4[16];
+ u16 field_0x4[MAX_PORTS];
};
#endif /* JASTRACKPORT_H */
diff --git a/include/JSystem/JAudio2/JASWSParser.h b/include/JSystem/JAudio2/JASWSParser.h
index 0191ffa625..000aee0069 100644
--- a/include/JSystem/JAudio2/JASWSParser.h
+++ b/include/JSystem/JAudio2/JASWSParser.h
@@ -17,7 +17,7 @@ public:
template<class T>
class TOffset {
public:
- T* ptr(void const* param_0) {
+ T* ptr(void const* param_0) const {
return JSUConvertOffsetToPtr<T>(param_0, mOffset);
}
diff --git a/include/JSystem/JSupport/JSUList.h b/include/JSystem/JSupport/JSUList.h
index 7b31430276..8d42762d2c 100644
--- a/include/JSystem/JSupport/JSUList.h
+++ b/include/JSystem/JSupport/JSUList.h
@@ -245,9 +245,9 @@ public:
return *this;
}
- T* operator*() const { return this->getObject(); }
+ T* operator*() const { return mTree->getObject(); }
- T* operator->() const { return this->getObject(); }
+ T* operator->() const { return mTree->getObject(); }
private:
JSUTree<T>* mTree;
diff --git a/include/JSystem/JSupport/JSupport.h b/include/JSystem/JSupport/JSupport.h
index 4f103bdf1a..717fd9b7b0 100644
--- a/include/JSystem/JSupport/JSupport.h
+++ b/include/JSystem/JSupport/JSupport.h
@@ -10,11 +10,7 @@
*/
template <typename T>
T* JSUConvertOffsetToPtr(const void* ptr, uintptr_t offset) {
- if (offset == 0) {
- return NULL;
- } else {
- return (T*)((intptr_t)ptr + (intptr_t)offset);
- }
+ return offset == 0 ? NULL : (T*)((intptr_t)ptr + (intptr_t)offset);
}
/**