mirror of
https://github.com/zeldaret/tp
synced 2026-05-23 06:54:28 -04:00
JAudio2 debug (#2996)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user