summaryrefslogtreecommitdiff
path: root/include/JSystem
diff options
context:
space:
mode:
authorjdflyer <jdflyer10@gmail.com>2022-12-24 12:47:48 -0700
committerjdflyer <jdflyer10@gmail.com>2022-12-24 12:47:48 -0700
commitae040aa688d6937ded96ea46e5ab804019d1ee85 (patch)
treed8bf6182e5dfb244218215fdd3352433b5382842 /include/JSystem
parente0c23673db94cae6729ec0827a67219d5b114814 (diff)
Old JAudio changes
Diffstat (limited to 'include/JSystem')
-rw-r--r--include/JSystem/JAudio2/JAIAudible.h3
-rw-r--r--include/JSystem/JAudio2/JAIAudience.h4
-rw-r--r--include/JSystem/JAudio2/JAISound.h126
-rw-r--r--include/JSystem/JAudio2/JAISoundParams.h6
-rw-r--r--include/JSystem/JAudio2/JASAudioReseter.h9
-rw-r--r--include/JSystem/JAudio2/JASAudioThread.h12
-rw-r--r--include/JSystem/JAudio2/JASGadget.h13
-rw-r--r--include/JSystem/JAudio2/JASReport.h2
-rw-r--r--include/JSystem/JAudio2/dspproc.h1
9 files changed, 151 insertions, 25 deletions
diff --git a/include/JSystem/JAudio2/JAIAudible.h b/include/JSystem/JAudio2/JAIAudible.h
index d42029bec9..047b913295 100644
--- a/include/JSystem/JAudio2/JAIAudible.h
+++ b/include/JSystem/JAudio2/JAIAudible.h
@@ -2,10 +2,11 @@
#define JAIAUDIBLE_H
#include "dolphin/types.h"
+#include "JSystem/JAudio2/JASSoundParams.h"
struct JAIAudible {
virtual ~JAIAudible();
- virtual void getOuterParams(int) = 0;
+ virtual JASSoundParams* getOuterParams(int) = 0;
virtual void calc() = 0;
};
diff --git a/include/JSystem/JAudio2/JAIAudience.h b/include/JSystem/JAudio2/JAIAudience.h
index 2f2586bf2d..1621386ad8 100644
--- a/include/JSystem/JAudio2/JAIAudience.h
+++ b/include/JSystem/JAudio2/JAIAudience.h
@@ -13,9 +13,9 @@ struct JAIAudience {
virtual ~JAIAudience();
virtual JAIAudible* newAudible(JGeometry::TVec3<f32> const&, JAISoundID,
JGeometry::TVec3<f32> const*, u32) = 0;
- virtual void getMaxChannels() = 0;
+ virtual int getMaxChannels() = 0;
virtual void deleteAudible(JAIAudible*) = 0;
- virtual void calcPriority(JAIAudible*) = 0;
+ virtual u32 calcPriority(JAIAudible*) = 0;
virtual void mixChannelOut(JASSoundParams const&, JAIAudible*, int) = 0;
};
diff --git a/include/JSystem/JAudio2/JAISound.h b/include/JSystem/JAudio2/JAISound.h
index 61bac44a42..1fd0f4f9c9 100644
--- a/include/JSystem/JAudio2/JAISound.h
+++ b/include/JSystem/JAudio2/JAISound.h
@@ -11,11 +11,11 @@
class JAISoundID {
public:
operator u32() const { return this->mId; }
- void operator=(JAISoundID const&);
+ void operator=(JAISoundID const& other) {mId = other.mId;};
JAISoundID(u32 pId) { mId = pId; };
- JAISoundID(JAISoundID const& other);
+ JAISoundID(JAISoundID const& other) {mId = other.mId;};
JAISoundID() {}
@@ -29,6 +29,13 @@ struct JASTrack {
/* 80291C30 */ void openChild(u32);
/* 80292918 */ void writePort(u32, u16);
/* 8029297C */ void readPort(u32);
+
+ inline int getChannelMgrCount() {
+ return channelMgrCount;
+ }
+
+ /* 0x0 */u8 field_0x0[0x1d0];
+ /* 0x1d0 */ int channelMgrCount;
};
struct JAISoundStatus_ {
@@ -36,26 +43,92 @@ struct JAISoundStatus_ {
/* 802A2244 */ s32 unlockIfLocked();
void init() {
- field_0x0 = 0;
- field_0x1 = 0;
- *((u16*)(this) + 2) = 0;
+ field_0x0.value = 0;
+ field_0x1.value = 0;
+ *((u16*)&state) = 0;
user_data = 0;
}
- /* 0x0 */ u8 field_0x0;
- /* 0x1 */ u8 field_0x1;
- /* 0x2 */ u8 state[2]; // debug accesses like "state.flags.calcedOnce"
+ bool isAlive(); //used in assert
+
+ inline bool isPlaying() {
+ return state.unk==5;
+ }
+
+ inline bool isPaused() {
+ return field_0x0.flags.paused;
+ }
+
+ /* 0x0 */ union {
+ u8 value;
+ struct{
+ u8 flag1:1;
+ u8 paused:1;
+ u8 flag3:1;
+ u8 flag4:1;
+ u8 flag5:1;
+ u8 flag6:1;
+ u8 flag7:1;
+ u8 flag8:1;
+ }flags;
+ }field_0x0;
+ /* 0x1 */ union {
+ u8 value;
+ struct{
+ u8 flag1:1;
+ u8 flag2:1;
+ u8 flag3:1;
+ u8 flag4:1;
+ u8 flag5:1;
+ u8 flag6:1;
+ u8 flag7:1;
+ u8 flag8:1;
+ }flags;
+ }field_0x1;
+ /* 0x2 */ struct {
+ u8 unk;
+ struct {
+ u8 flag1:1;
+ u8 flag2:1;
+ u8 flag3:1;
+ u8 flag4:1;
+ u8 flag5:1;
+ u8 flag6:1;
+ u8 flag7:1;
+ u8 flag8:1;
+ }flags;
+ } state;
/* 0x4 */ u32 user_data;
}; // Size: 0x6
struct JAISoundFader {
void forceIn() {
mIntensity = 1.0f;
- field_0x4.zero();
+ mTransition.zero();
+ }
+ inline void forceOut() {
+ mIntensity = 0.0f;
+ mTransition.zero();
+ }
+ inline void fadeOut(u32 fadeCount) {
+ if (fadeCount!=0) {
+ mTransition.set(0.0f,mIntensity,fadeCount);
+ }else{
+ forceOut();
+ }
+ }
+ inline bool isOut() {
+ if(mTransition.mCount!=0||mIntensity<0.01f) {
+ return true;
+ }
+ return false;
+ }
+ inline void calc() {
+ mIntensity = mTransition.apply(mIntensity);
}
/* 0x00 */ f32 mIntensity;
- /* 0x04 */ JAISoundParamsTransition::TTransition field_0x4;
+ /* 0x04 */ JAISoundParamsTransition::TTransition mTransition;
}; // Size: 0x10
template <typename A0>
@@ -88,29 +161,50 @@ public:
JAIAudience*);
/* 802A2598 */ void stop();
/* 802A24DC */ void stop(u32 fadeout);
- /* 802A25D8 */ bool asSe();
- /* 802A25E0 */ bool asSeq();
- /* 802A25E8 */ bool asStream();
/* 802A25F0 */ void die_JAISound_();
/* 802A266C */ void increasePrepareCount_JAISound_();
- /* 802A26B8 */ void calc_JAISound_();
+ /* 802A26B8 */ bool calc_JAISound_();
/* 802A29DC */ void initTrack_JAISound_(JASTrack*);
virtual void getNumChild() = 0;
+ virtual void getChild() = 0;
+ virtual void releaseChild() = 0;
+ /* 802A25D8 */ virtual bool asSe();
+ /* 802A25E0 */ virtual bool asSeq();
+ /* 802A25E8 */ virtual bool asStream();
+ virtual void getTrack() = 0;
+ virtual void getChildTrack() = 0;
+ virtual void getTempoMgr() = 0;
+ virtual bool JAISound_tryDie_() = 0;
JAISoundID getID() const;
u32 getUserData() const { return status_.user_data; }
bool isHandleAttached() const { return handle_ != NULL; }
+ inline void removeLifeTime_() {
+ status_.field_0x1.flags.flag1 = false;
+ }
+ inline void stop_JAISound_() {
+ status_.state.flags.flag5 = 0;
+ status_.state.flags.flag1 = 1;
+ }
+ inline bool isStopping() {
+ bool isStopping = false;
+ if(status_.state.flags.flag1) {
+ isStopping = status_.state.flags.flag5 ? fader.isOut() : true;
+ }
+ return isStopping;
+ }
+
/* 0x04 */ JAISoundHandle* handle_;
/* 0x08 */ JAIAudible* audible_;
/* 0x0C */ JAIAudience* audience_;
- /* 0x10 */ s32 lifeTime;
+ /* 0x10 */ u32 lifeTime;
/* 0x14 */ s32 prepareCount;
/* 0x18 */ JAISoundID soundID;
/* 0x1C */ JAISoundStatus_ status_;
/* 0x24 */ JAISoundFader fader;
- /* 0x34 */ s32 field_0x34;
+ /* 0x34 */ s32 mPriority;
/* 0x38 */ s32 mCount;
/* 0x3C */ JAISoundParams params;
}; // Size: 0x98
diff --git a/include/JSystem/JAudio2/JAISoundParams.h b/include/JSystem/JAudio2/JAISoundParams.h
index 6984c0a912..f9befe83e0 100644
--- a/include/JSystem/JAudio2/JAISoundParams.h
+++ b/include/JSystem/JAudio2/JAISoundParams.h
@@ -24,9 +24,9 @@ struct JAISoundParamsTransition {
field_0x4 = 0.0f;
}
- void set(f32 newValue, f32 param_1, u32 param_2) {
- mCount = param_2;
- field_0x0 = (newValue - param_1) / mCount;
+ void set(f32 newValue, f32 intensity, u32 fadeCount) {
+ mCount = fadeCount;
+ field_0x0 = (newValue - intensity) / mCount;
field_0x4 = newValue;
}
diff --git a/include/JSystem/JAudio2/JASAudioReseter.h b/include/JSystem/JAudio2/JASAudioReseter.h
index 25e6af4a33..66d466f3f5 100644
--- a/include/JSystem/JAudio2/JASAudioReseter.h
+++ b/include/JSystem/JAudio2/JASAudioReseter.h
@@ -3,6 +3,13 @@
#include "JSystem/JAudio2/JASDriverIF.h"
#include "dolphin/types.h"
+#include "dolphin/os/OS.h"
+
+struct JASCriticalSection {
+ inline JASCriticalSection() {mInterruptState = OSDisableInterrupts();};
+ inline ~JASCriticalSection() {OSRestoreInterrupts(mInterruptState);};
+ u32 mInterruptState;
+};
struct JASAudioReseter {
/* 8029D0B4 */ JASAudioReseter();
@@ -10,7 +17,7 @@ struct JASAudioReseter {
/* 8029D138 */ bool start(u32, bool);
/* 8029D1D4 */ void resume();
/* 8029D1F8 */ s32 checkDone() const;
- /* 8029D200 */ static s32 calc();
+ /* 8029D200 */ s32 calc();
/* 8029D2D4 */ static s32 callback(void*);
/* 0x0 */ u32 field_0x0;
diff --git a/include/JSystem/JAudio2/JASAudioThread.h b/include/JSystem/JAudio2/JASAudioThread.h
index 2ed9d02f54..e8da1c883b 100644
--- a/include/JSystem/JAudio2/JASAudioThread.h
+++ b/include/JSystem/JAudio2/JASAudioThread.h
@@ -3,4 +3,16 @@
#include "dolphin/types.h"
+struct JASAudioThread {
+ /* 8029CCDC */ JASAudioThread(int, int, u32);
+ /* 8029CD4C */ void create(s32);
+ /* 8029CDC0 */ void stop();
+ /* 8029CDEC */ void run();
+ /* 8029CF68 */ void DMACallback();
+ /* 8029CFBC */ void DSPCallback(void*);
+ /* 8029D028 */ ~JASAudioThread();
+
+ static u8 snIntCount[4 + 4 /* padding */];
+};
+
#endif /* JASAUDIOTHREAD_H */
diff --git a/include/JSystem/JAudio2/JASGadget.h b/include/JSystem/JAudio2/JASGadget.h
index 6edcf6961a..811aeacb3b 100644
--- a/include/JSystem/JAudio2/JASGadget.h
+++ b/include/JSystem/JAudio2/JASGadget.h
@@ -6,9 +6,18 @@
template <class T>
class JASGlobalInstance {
public:
- // T* getInstance() { return sInstance; }
+ T* getInstance() { return sInstance; }
- // static T* sInstance;
+ JASGlobalInstance(bool param) {
+ if (param) {
+ ASSERT(sInstance == 0);
+ if (this!=NULL) {
+ sInstance = this - sizeof(T);
+ }
+ }
+ }
+
+ static T* sInstance;
};
#endif /* JASGADGET_H */
diff --git a/include/JSystem/JAudio2/JASReport.h b/include/JSystem/JAudio2/JASReport.h
index 6f0c1a0fae..86b0944e83 100644
--- a/include/JSystem/JAudio2/JASReport.h
+++ b/include/JSystem/JAudio2/JASReport.h
@@ -3,4 +3,6 @@
#include "dolphin/types.h"
+void JASReport(const char* message, ...);
+
#endif /* JASREPORT_H */
diff --git a/include/JSystem/JAudio2/dspproc.h b/include/JSystem/JAudio2/dspproc.h
index e624638ec3..5f1c530495 100644
--- a/include/JSystem/JAudio2/dspproc.h
+++ b/include/JSystem/JAudio2/dspproc.h
@@ -2,5 +2,6 @@
#define DSPPROC_H
#include "dolphin/types.h"
+#include "dolphin/dsp/dsp.h"
#endif /* DSPPROC_H */