Work On JAudio (#2067)

* Match two JASTrack functions

* dsptask, JAISoundStarter OK. Other small matches

* Work on JAIStream

* Work on JAIStreamMgr

* Work on JAISeqMgr

* Formatting
This commit is contained in:
hatal175
2024-02-08 15:30:28 -08:00
committed by GitHub
parent 95176edb82
commit 9f38190f00
57 changed files with 630 additions and 1937 deletions
+3 -1
View File
@@ -9,7 +9,7 @@
class JAISeqMgr;
class JAISoundChild;
class JAISeq : public JAISound, JSULink<JAISeq> {
class JAISeq : public JASPoolAllocObject<JAISeq>, public JAISound, public JSULink<JAISeq> {
public:
class TInner {
public:
@@ -47,6 +47,8 @@ public:
/* 802A1348 */ void mixOut_(JASSoundParams const&, JAISoundActivity);
/* 802A14FC */ void JAISeqMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
JAISeqData& getSeqData() { return inner_.mSeqData; }
/* 0x0a8 */ TInner inner_;
/* 0x3A8 */ JAISoundStrategyMgr__unknown<JAISeq>* field_0x3a8;
};
+8 -4
View File
@@ -9,8 +9,12 @@
struct JAIAudience;
class JAISeq;
class JAISeqMgr : public JAISeqDataUser, public JASGlobalInstance<JAISeqMgr> {
class JAISeqMgr : public JASGlobalInstance<JAISeqMgr>, public JAISeqDataUser {
public:
enum ReleaseSeqResult {
RELEASE_SEQ_1 = 1,
RELEASE_SEQ_2 = 2,
};
/* 802A1914 */ JAISeqMgr(bool);
/* 802A1A08 */ void freeDeadSeq_();
/* 802A1B48 */ bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
@@ -19,8 +23,8 @@ public:
/* 802A1E3C */ void stop(u32);
/* 802A1E8C */ void stopSoundID(JAISoundID);
/* 802A1EFC */ void mixOut();
/* 802A1F58 */ void beginStartSeq_();
/* 802A1FE8 */ void endStartSeq_(JAISeq*, JAISoundHandle*);
/* 802A1F58 */ JAISeq* beginStartSeq_();
/* 802A1FE8 */ bool endStartSeq_(JAISeq*, JAISoundHandle*);
/* 802A20F0 */ virtual ~JAISeqMgr(); // inline?
/* 802A1804 */ virtual bool isUsingSeqData(JAISeqDataRegion const&);
@@ -50,7 +54,7 @@ private:
/* 0x04 */ JAISoundActivity mActivity;
/* 0x08 */ JAIAudience* mAudience;
/* 0x0C */ JAISeqDataMgr* seqDataMgr_;
/* 0x10 */ void* field_0x10;
/* 0x10 */ JAISoundStrategyMgr<JAISeq>* field_0x10;
/* 0x14 */ JAISoundParamsMove mMove;
/* 0x64 */ JSUList<JAISeq> mSeqList;
/* 0x70 */ int field_0x70;
+3 -3
View File
@@ -47,7 +47,7 @@ struct JAISoundStatus_ {
user_data = 0;
}
bool isAlive(); // used in assert
bool isAlive() { return state.unk != 6; }
bool isDead() { return state.unk == 6;}
inline bool isPlaying() { return state.unk == 5; }
@@ -138,14 +138,14 @@ struct JAISoundFader {
template <typename A0>
struct JAISoundStrategyMgr__unknown {
virtual void virtual2();
virtual void virtual3(A0*);
virtual void calc(A0*);
virtual void virtual4(A0*, const JASSoundParams&);
};
template <typename A0>
struct JAISoundStrategyMgr {
virtual void virtual2();
virtual JAISoundStrategyMgr__unknown<A0>* virtual3(JAISoundID);
virtual JAISoundStrategyMgr__unknown<A0>* calc(JAISoundID);
virtual void virtual4(JAISoundStrategyMgr__unknown<A0>*);
};
/* JAISoundStrategyMgr<JAISe> */
@@ -8,6 +8,7 @@ struct JAISoundStarter : public JASGlobalInstance<JAISoundStarter> {
/* 802A2F6C */ JAISoundStarter(bool);
virtual ~JAISoundStarter();
virtual bool startSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*) = 0;
/* 802A2FEC */ bool startLevelSound(JAISoundID, JAISoundHandle*, JGeometry::TVec3<f32> const*);
};
+8 -5
View File
@@ -3,11 +3,12 @@
#include "JSystem/JAudio2/JAISound.h"
#include "JSystem/JAudio2/JASAramStream.h"
#include "JSystem/JAudio2/JASHeapCtrl.h"
#include "JSystem/JSupport/JSUList.h"
class JAIStreamMgr;
class JAIStream : public JAISound, JSULink<JAIStream> {
class JAIStream : public JASPoolAllocObject<JAIStream>, public JAISound, public JSULink<JAIStream> {
public:
struct TInner {
JASAramStream field_0x0;
@@ -16,7 +17,7 @@ public:
/* 802A3104 */ JAIStream(JAIStreamMgr*, JAISoundStrategyMgr<JAIStream>*);
/* 802A319C */ void JAIStreamMgr_startID_(JAISoundID, s32, JGeometry::TVec3<f32> const*,
JAIAudience*, int);
/* 802A3230 */ void prepare_prepareStream_();
/* 802A3230 */ bool prepare_prepareStream_();
/* 802A33F4 */ void prepare_();
/* 802A3498 */ void prepare_startStream_();
/* 802A34E4 */ void JAIStreamMgr_mixOut_(JASSoundParams const&, JAISoundActivity);
@@ -31,16 +32,18 @@ public:
/* 802A3ACC */ JAIStream* asStream();
/* 802A3AD0 */ JAITempoMgr* getTempoMgr();
void* JAIStreamMgr_getAramAddr_() { return field_0x29c; }
/* 0x0A8 */ TInner field_0x0a8;
/* 0x290 */ int field_0x290;
/* 0x294 */ s32 field_0x294;
/* 0x298 */ int field_0x298;
/* 0x29C */ int field_0x29c;
/* 0x29C */ void* field_0x29c;
/* 0x2A0 */ JAISoundChild* field_0x2a0[6];
/* 0x2B8 */ JAIStreamMgr* field_0x2b8;
/* 0x2BC */ int field_0x2bc;
/* 0x2BC */ JAISoundStrategyMgr__unknown<JAIStream>* field_0x2bc;
/* 0x2C0 */ JAISoundStrategyMgr<JAIStream>* field_0x2c0;
/* 0x2C4 */ u8 field_0x2C4;
/* 0x2C4 */ u8 field_0x2c4;
/* 0x2C5 */ u8 field_0x2c5;
/* 0x2C6 */ u8 field_0x2c6;
};
+6 -5
View File
@@ -20,13 +20,14 @@ public:
/* 802A4068 */ void stop(u32);
/* 802A40B8 */ void stopSoundID(JAISoundID);
/* 802A4118 */ void mixOut();
/* 802A4174 */ void newStream_();
/* 802A4174 */ JAIStream* newStream_();
/* 802B9978 */ bool isActive() const;
JAISoundParamsMove* getParams() { return &mParams; }
JAIStreamAramMgr* getStreamAramMgr() { return mStreamAramMgr; }
void setStreamDataMgr(JAIStreamDataMgr* param_0) {
JUT_ASSERT(139, !isActive());
mStreamDataMgr = param_0;
streamDataMgr_ = param_0;
}
void setStreamAramMgr(JAIStreamAramMgr* param_0) {
JUT_ASSERT(157, !isActive());
@@ -37,11 +38,11 @@ public:
private:
/* 0x00 */ JAISoundActivity mActivity;
/* 0x04 */ JAISoundParamsMove mParams;
/* 0x54 */ int field_0x54;
/* 0x54 */ JAIAudience* field_0x54;
/* 0x58 */ JSUList<JAIStream> mStreamList;
/* 0x64 */ JAIStreamDataMgr * mStreamDataMgr;
/* 0x64 */ JAIStreamDataMgr* streamDataMgr_;
/* 0x68 */ JAIStreamAramMgr* mStreamAramMgr;
/* 0x6C */ int field_0x6c;
/* 0x6C */ JAISoundStrategyMgr<JAIStream>* field_0x6c;
}; // Size: 0x70
#endif /* JAISTREAMMGR_H */
+57 -9
View File
@@ -2,6 +2,7 @@
#define JASARAMSTREAM_H
#include "dolphin/os/OSMessage.h"
#include "JSystem/JUtility/JUTAssert.h"
class JASChannel;
@@ -9,13 +10,15 @@ namespace JASDsp {
class TChannel;
}
#define CHANNEL_MAX 6
class JASAramStream {
public:
/* 8029631C */ static void initSystem(u32, u32);
/* 802963A8 */ JASAramStream();
/* 8029649C */ void init(u32, u32, void (*)(u32, JASAramStream*, void*), void*);
/* 8029655C */ void prepare(s32, int);
/* 80296618 */ void start();
/* 8029655C */ bool prepare(s32, int);
/* 80296618 */ bool start();
/* 8029664C */ void stop(u16);
/* 80296684 */ void pause(bool);
/* 802966CC */ void cancel();
@@ -35,6 +38,51 @@ public:
/* 80297658 */ void channelStart();
/* 80297870 */ void channelStop(u16);
void setPitch(f32 pitch) { field_0x178 = pitch; }
void setVolume(f32 volume) {
for (int i = 0; i < 6; i++) {
mChannelVolume[i] = volume;
}
}
void setPan(f32 pan) {
for (int i = 0; i < 6; i++) {
mChannelPan[i] = pan;
}
}
void setFxmix(f32 fxMix) {
for (int i = 0; i < 6; i++) {
mchannelFxMix[i] = fxMix;
}
}
void setDolby(f32 dolby) {
for (int i = 0; i < 6; i++) {
mChannelDolby[i] = dolby;
}
}
void setChannelVolume(int channel, f32 volume) {
JUT_ASSERT(290, channel < CHANNEL_MAX);
mChannelVolume[channel] = volume;
}
void setChannelPan(int channel, f32 pan) {
JUT_ASSERT(296, channel < CHANNEL_MAX);
mChannelPan[channel] = pan;
}
void setChannelFxmix(int channel, f32 fxMix) {
JUT_ASSERT(302, channel < CHANNEL_MAX);
mchannelFxMix[channel] = fxMix;
}
void setChannelDolby(int channel, f32 dolby) {
JUT_ASSERT(308, channel < CHANNEL_MAX);
mChannelDolby[channel] = dolby;
}
/* 0x000 */ OSMessageQueue field_0x000;
/* 0x020 */ OSMessageQueue field_0x020;
/* 0x040 */ void* field_0x040[16];
@@ -66,8 +114,8 @@ public:
/* 0x128 */ short field_0x128;
/* 0x12A */ u8 field_0x12A[0x12C - 0x12A];
/* 0x12C */ int field_0x12c;
/* 0x130 */ short field_0x130[6];
/* 0x13C */ short field_0x13c[6];
/* 0x130 */ short field_0x130[CHANNEL_MAX];
/* 0x13C */ short field_0x13c[CHANNEL_MAX];
/* 0x148 */ int field_0x148;
/* 0x14C */ int field_0x14c;
/* 0x150 */ void* field_0x150;
@@ -83,11 +131,11 @@ public:
/* 0x170 */ int field_0x170;
/* 0x174 */ f32 field_0x174;
/* 0x178 */ f32 field_0x178;
/* 0x17C */ float field_0x17c[6];
/* 0x194 */ float field_0x194[6];
/* 0x1AC */ float field_0x1ac[6];
/* 0x1C4 */ float field_0x1c4[6];
/* 0x1DC */ short field_0x1dc[6];
/* 0x17C */ float mChannelVolume[CHANNEL_MAX];
/* 0x194 */ float mChannelPan[CHANNEL_MAX];
/* 0x1AC */ float mchannelFxMix[CHANNEL_MAX];
/* 0x1C4 */ float mChannelDolby[CHANNEL_MAX];
/* 0x1DC */ short field_0x1dc[CHANNEL_MAX];
u32 getBlockSize() { return sBlockSize; }
+1 -1
View File
@@ -20,4 +20,4 @@ public:
JASDefaultBankTable() : JASGlobalInstance(true) {}
};
#endif /* JASBANKLIST_H */
#endif /* JASBANKTABLE_H */
+6
View File
@@ -214,6 +214,9 @@ public:
JASMemPool<T>* memPool = getMemPool();
return memPool->alloc(sizeof(T));
}
static void* operator new(size_t n, void* ptr) {
return ptr;
}
static void operator delete(void* ptr, size_t n) {
JASMemPool<T>* memPool_ = getMemPool();
memPool_->free(ptr, sizeof(T));
@@ -256,6 +259,9 @@ public:
JASMemPool_MultiThreaded<T>* memPool_ = getMemPool();
return memPool_->alloc(sizeof(T));
}
static void* operator new(size_t n, void* ptr) {
return ptr;
}
static void operator delete(void* ptr, size_t n) {
JASMemPool_MultiThreaded<T>* memPool_ = getMemPool();
memPool_->free(ptr, sizeof(T));
+4 -2
View File
@@ -1,9 +1,11 @@
#ifndef OSDSP_H
#define OSDSP_H
#include "dolphin/dsp.h"
struct DSPTaskInfo;
struct STRUCT_DSP_TASK;
struct STRUCT_DSP_TASK {
/* 0x00 */ DSPTaskInfo info;
};
extern "C" DSPTaskInfo* DSPAddTask(DSPTaskInfo*);
void DSPAddPriorTask(STRUCT_DSP_TASK*);