Merge pull request #531 from Jcw87/JAudio

JAudio
This commit is contained in:
Jasper St. Pierre
2023-10-27 20:47:11 -07:00
committed by GitHub
16 changed files with 862 additions and 141 deletions
+19
View File
@@ -0,0 +1,19 @@
#ifndef JASCHALLOCQUEUE_H
#define JASCHALLOCQUEUE_H
#include "JSystem/JSupport/JSUList.h"
namespace JASystem {
class TChannel;
namespace TDSPQueue {
void deQueue();
void enQueue(JASystem::TChannel*);
int deleteQueue(JASystem::TChannel*);
void checkQueue();
}
extern JSUList<TChannel> sDspQueueList;
}
#endif /* JASCHALLOCQUEUE_H */
+24
View File
@@ -0,0 +1,24 @@
#ifndef JASCHGLOBAL_H
#define JASCHGLOBAL_H
#include "dolphin/types.h"
namespace JASystem {
class TChannel;
class TChannelMgr;
class TOscillator;
namespace TGlobalChannel {
TChannel* getChannelHandle(u32);
void init();
int alloc(TChannelMgr*, u32);
int release(TChannel*);
int releaseAll(TChannelMgr*);
extern TChannelMgr* sChannelMgr;
extern TChannel* sChannel;
extern TOscillator* sOscillator;
}
}
#endif /* JASCHGLOBAL_H */
+105
View File
@@ -0,0 +1,105 @@
#ifndef JASCHANNEL_H
#define JASCHANNEL_H
#include "JSystem/JAudio/JASDriverIF.h"
#include "JSystem/JAudio/JASOscillator.h"
#include "JSystem/JSupport/JSUList.h"
namespace JASystem {
class TChannelMgr;
class TDSPChannel;
namespace Driver {
struct Wave_;
}
class TChannel {
public:
TChannel() : field_0x4(NULL), field_0x8(NULL), field_0x20(NULL), field_0x24(NULL), field_0xd8(this) {
for (int i = 0; i < 4; i++) {
osc[i] = NULL;
}
}
~TChannel() {}
void init();
void setOscillator(u32, TOscillator*);
void setOscInit(u32, const TOscillator::Osc_*);
bool forceStopOsc(u32);
bool releaseOsc(u32);
void directReleaseOsc(u32, u16);
f32 bankOscToOfs(u32);
void effectOsc(u32, f32);
int getOscState(u32) const;
bool isOsc(u32);
void copyOsc(u32, TOscillator::Osc_*);
void overwriteOsc(u32, TOscillator::Osc_*);
void setKeySweepTarget(u8, u32);
void setPauseFlag(u8);
void setPauseFlagReq(u8);
void setPanPower(f32, f32, f32, f32);
BOOL checkLogicalChannel();
bool play(u32);
void stop(u16);
void updateJcToDSP();
bool forceStopLogicalChannel();
bool stopLogicalChannel();
int playLogicalChannel();
void updateEffectorParam();
static void killBrokenLogicalChannels(TDSPChannel*);
static void updatecallDSPChannel(TDSPChannel*, u32);
static f32 calcEffect(const Driver::PanMatrix_*, const Driver::PanMatrix_*, u8);
static f32 calcPan(const Driver::PanMatrix_*, const Driver::PanMatrix_*, u8);
void updateJcToDSPInit();
void updateAutoMixer(f32, f32, f32, f32);
void updateMixer(f32, f32, f32, f32);
void extraUpdate(TChannel*, u32);
static void updatecallLogicalChannel(TChannel*, u32);
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u8 mPauseFlag;
/* 0x03 */ u8 field_0x3;
/* 0x04 */ TChannelMgr* field_0x4;
/* 0x08 */ TChannel** field_0x8;
/* 0x0C */ u8 field_0xc;
/* 0x10 */ Driver::Wave_* field_0x10;
/* 0x14 */ int field_0x14;
/* 0x18 */ int field_0x18;
/* 0x1C */ int field_0x1c;
/* 0x20 */ TDSPChannel* field_0x20;
/* 0x24 */ TChannel* field_0x24;
/* 0x28 */ void (*field_0x28)(TChannel*, u32);
/* 0x2C */ int field_0x2c;
/* 0x30 */ int field_0x30;
/* 0x34 */ int field_0x34;
/* 0x38 */ TOscillator* osc[4];
/* 0x48 */ u32 field_0x48;
/* 0x4C */ short field_0x4c;
/* 0x50 */ f32 field_0x50;
/* 0x54 */ int field_0x54;
/* 0x58 */ f32 field_0x58;
/* 0x5C */ f32 field_0x5c;
/* 0x60 */ u8 field_0x60[3];
/* 0x64 */ Driver::PanMatrix_ field_0x64;
/* 0x70 */ Driver::PanMatrix_ field_0x70;
/* 0x7C */ Driver::PanMatrix_ field_0x7c;
/* 0x88 */ Driver::PanMatrix_ field_0x88;
/* 0x94 */ f32 field_0x94;
/* 0x98 */ f32 field_0x98;
/* 0x9C */ f32 field_0x9c;
/* 0xA0 */ u16 field_0xa0;
/* 0xA2 */ u16 field_0xa2;
/* 0xA4 */ TChannelMgr* field_0xa4;
/* 0xA8 */ f32 field_0xa8;
/* 0xAC */ f32 field_0xac;
/* 0xB0 */ u16 field_0xb0[6];
/* 0xBC */ u16 field_0xbc[6];
/* 0xC8 */ u16 field_0xc8;
/* 0xCC */ int field_0xcc;
/* 0xD0 */ int field_0xd0;
/* 0xD4 */ int field_0xd4;
/* 0xD8 */ JSULink<TChannel> field_0xd8;
/* 0xE8 */ int field_0xe8;
};
}
#endif /* JASCHANNEL_H */
+53
View File
@@ -0,0 +1,53 @@
#ifndef JASCHANNELMGR_H
#define JASCHANNELMGR_H
#include "dolphin/types.h"
namespace JASystem {
class TChannel;
class TChannelMgr {
public:
void init();
void stopAll();
void stopAllRelease();
void initAllocChannel(u32);
TChannel* getLogicalChannel(u32);
bool moveListHead(TChannel*, u32);
bool moveListTail(TChannel*, u32);
void addListHead(TChannel*, u32);
void addListTail(TChannel*, u32);
TChannel* getListHead(u32);
int cutList(TChannel*);
void receiveAllChannels(TChannelMgr*);
int checkLimitStart(u32);
void checkLimitStop(TChannel*, u32);
u32 field_0x0;
int field_0x4;
TChannel* field_0x8;
TChannel* field_0xc;
TChannel* field_0x10;
TChannel* field_0x14;
f32 field_0x18;
f32 field_0x1c;
f32 field_0x20;
f32 field_0x24;
f32 field_0x28;
s16 field_0x2c[8];
s16 field_0x3c[4];
int field_0x44;
int field_0x48;
s16 field_0x4c;
u16 field_0x4e[6];
u8 field_0x5a[6];
u8 field_0x60;
u8 field_0x61;
u8 field_0x62[3];
int field_0x68;
u16 field_0x6c;
int field_0x70;
};
}
#endif /* JASCHANNELMGR_H */
+9 -6
View File
@@ -14,6 +14,11 @@ namespace JASystem {
class TDSPChannel {
public:
TDSPChannel() {
field_0xc = NULL;
mCallback = NULL;
}
~TDSPChannel() {}
void init(u8);
int allocate(u32);
void free();
@@ -26,13 +31,11 @@ namespace JASystem {
static int free(TDSPChannel*, u32);
static TDSPChannel* getLower();
static TDSPChannel* getLowerActive();
static bool breakLower(u8);
static BOOL breakLower(u8);
static bool breakLowerActive(u8);
static void updateAll();
void onUpdate(u32);
static int getNumBreak();
~TDSPChannel();
TDSPChannel();
u8 getNumber() { return mNumber; }
// TODO: inlines
@@ -54,11 +57,11 @@ namespace JASystem {
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u8 field_0x2;
/* 0x03 */ u8 field_0x3;
/* 0x04 */ short field_0x4;
/* 0x06 */ short field_0x6;
/* 0x04 */ u16 field_0x4;
/* 0x06 */ u16 field_0x6;
/* 0x08 */ int field_0x8;
/* 0x0C */ DSPInterface::DSPBuffer* field_0xc;
/* 0x10 */ void* mCallback;
/* 0x10 */ int (*mCallback)(TDSPChannel*, u32);
static int smnFree;
static TDSPChannel* DSPCH;
+1 -1
View File
@@ -99,7 +99,7 @@ namespace JASystem {
/* 0x106 */ short field_0x106;
/* 0x108 */ short field_0x108;
/* 0x10A */ u16 field_0x10a;
/* 0x10C */ int field_0x10c;
/* 0x10C */ u32 field_0x10c;
/* 0x110 */ int field_0x110;
/* 0x114 */ int field_0x114;
/* 0x118 */ int field_0x118;
+40
View File
@@ -0,0 +1,40 @@
#ifndef JASOSCILLATOR_H
#define JASOSCILLATOR_H
#include "dolphin/types.h"
namespace JASystem {
class TOscillator {
public:
struct Osc_ {
/* 0x00 */ u8 field_0x0;
/* 0x04 */ f32 field_0x4;
/* 0x08 */ u32 table;
/* 0x0C */ int rel_table;
/* 0x10 */ f32 field_0x10;
/* 0x14 */ f32 field_0x14;
};
TOscillator() { init(); }
~TOscillator() {}
void init();
void initStart();
f32 getOffset();
bool forceStop();
bool release();
void calc(s16*);
/* 0x00 */ const Osc_* field_0x0;
/* 0x04 */ u8 field_0x4;
/* 0x05 */ u8 field_0x5;
/* 0x06 */ short field_0x6;
/* 0x08 */ f32 field_0x8;
/* 0x0C */ f32 field_0xc;
/* 0x10 */ f32 field_0x10;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ u16 field_0x18;
/* 0x1C */ f32 field_0x1c;
};
}
#endif /* JASOSCILLATOR_H */