JASChannel OK

This commit is contained in:
LagoLunatic
2025-03-15 19:55:45 -04:00
parent e9afe4c428
commit 89e9cdafb5
14 changed files with 755 additions and 166 deletions
-1
View File
@@ -10,7 +10,6 @@ namespace JASystem {
void enQueue(JASystem::TChannel*);
int deleteQueue(JASystem::TChannel*);
void checkQueue();
}
extern JSUList<TChannel> sDspQueueList;
+37 -20
View File
@@ -14,6 +14,23 @@ namespace JASystem {
class TChannel {
public:
enum CalcType {
// NB: haven't seen others used, add from calc_sw_table in JASChannel.cpp if needed
CALC_None = 0,
CALC_AddChannelOnly = 1,
CALC_AddAll = 13,
CALC_WeightAll = 26,
};
union MixConfig {
u16 mWhole;
struct {
u8 u;
u8 l0 : 4;
u8 l1 : 4;
} mParts;
};
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;
@@ -28,7 +45,7 @@ namespace JASystem {
void directReleaseOsc(u32, u16);
f32 bankOscToOfs(u32);
void effectOsc(u32, f32);
int getOscState(u32) const;
u8 getOscState(u32) const;
BOOL isOsc(u32);
void copyOsc(u32, TOscillator::Osc_*);
void overwriteOsc(u32, TOscillator::Osc_*);
@@ -41,24 +58,24 @@ namespace JASystem {
void stop(u16);
void updateJcToDSP();
bool forceStopLogicalChannel();
bool stopLogicalChannel();
int playLogicalChannel();
BOOL stopLogicalChannel();
BOOL playLogicalChannel();
void updateEffectorParam();
static void killBrokenLogicalChannels(TDSPChannel*);
static void updatecallDSPChannel(TDSPChannel*, u32);
static int 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);
static u32 extraUpdate(TChannel*, u32);
static BOOL updatecallLogicalChannel(TChannel*, u32);
u8 getNoteOnPriority() const { return field_0x48; }
u8 getReleasePriority() const { return field_0x48 >> 8; }
u8 getLifeTimePriority() const { return field_0x48 >> 0x10; }
// TODO
void getLifeTimePriority() const {}
void getReleasePriority() const {}
void setSkipSamples(u32) {}
/* 0x00 */ u8 field_0x0;
@@ -74,38 +91,38 @@ namespace JASystem {
/* 0x1C */ int field_0x1c;
/* 0x20 */ TDSPChannel* field_0x20;
/* 0x24 */ TChannel* field_0x24;
/* 0x28 */ void (*field_0x28)(TChannel*, u32);
/* 0x2C */ int field_0x2c;
/* 0x28 */ BOOL (*field_0x28)(TChannel*, u32);
/* 0x2C */ u32 (*field_0x2c)(TChannel*, u32);
/* 0x30 */ int field_0x30;
/* 0x34 */ int field_0x34;
/* 0x34 */ s32 field_0x34;
/* 0x38 */ TOscillator* osc[4];
/* 0x48 */ u32 field_0x48;
/* 0x4C */ short field_0x4c;
/* 0x4C */ u16 field_0x4c;
/* 0x50 */ f32 field_0x50;
/* 0x54 */ f32 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;
/* 0x60 */ u8 mCalcTypes[3]; // Pan, FxMix, ?
/* 0x64 */ Driver::PanMatrix_ mPanPower;
/* 0x70 */ Driver::PanMatrix_ mPanVec;
/* 0x7C */ Driver::PanMatrix_ mFxmixVec;
/* 0x88 */ Driver::PanMatrix_ mDolbyVec;
/* 0x94 */ f32 field_0x94;
/* 0x98 */ f32 field_0x98;
/* 0x9C */ f32 field_0x9c;
/* 0xA0 */ u16 field_0xa0;
/* 0xA0 */ u16 mPitch;
/* 0xA2 */ u16 field_0xa2;
/* 0xA4 */ TChannelMgr* field_0xa4;
/* 0xA8 */ f32 field_0xa8;
/* 0xAC */ f32 field_0xac;
/* 0xB0 */ u16 field_0xb0[6];
/* 0xB0 */ MixConfig mMixConfigs[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;
/* 0xE8 */ u32 field_0xe8;
};
}
+3 -3
View File
@@ -13,8 +13,8 @@ namespace JASystem {
void stopAllRelease();
void initAllocChannel(u32);
TChannel* getLogicalChannel(u32);
bool moveListHead(TChannel*, u32);
bool moveListTail(TChannel*, u32);
BOOL moveListHead(TChannel*, u32);
BOOL moveListTail(TChannel*, u32);
void addListHead(TChannel*, u32);
void addListTail(TChannel*, u32);
TChannel* getListHead(u32);
@@ -24,7 +24,7 @@ namespace JASystem {
void checkLimitStop(TChannel*, u32);
/* 0x00 */ u32 field_0x0;
/* 0x04 */ int field_0x4;
/* 0x04 */ u32 field_0x4;
/* 0x08 */ TChannel* field_0x8;
/* 0x0C */ TChannel* field_0xc;
/* 0x10 */ TChannel* field_0x10;
+21 -12
View File
@@ -4,6 +4,8 @@
#include "dolphin/os/OSTime.h"
namespace JASystem {
class TChannel;
namespace DSPInterface {
class DSPBuffer;
}
@@ -38,28 +40,35 @@ namespace JASystem {
static int getNumBreak();
u8 getNumber() { return mNumber; }
u8 getPriority() { return mPriority; }
void setPriority(u8 priority) { mPriority = priority; }
u16 getPriorityTime() { return mPriorityTime; }
void setPriorityTime(u16 time) { mPriorityTime = time; }
u16 getCBInterval() { return mCBInterval; }
void setCBInterval(u16 interval) { mCBInterval = interval; }
void decCBInterval() { mCBInterval--; }
TChannel* getLogicalChannel() {
if (mCallback != NULL) {
return (TChannel*)field_0x8; // ?? is this userdata?
} else {
return NULL;
}
}
// TODO: inlines
void checkSign(u32) {}
void isFree() {}
void getPriority() {}
void getStatus() {}
void getCBInterval() {}
void decCBInterval() {}
void getPriorityTime() {}
void setCBInterval(u16) {}
void setPriorityTime(u16) {}
void setPriority(u8) {}
void getLogicalChannel() {}
void forceStop(TDSPChannel*) {}
void release(TDSPChannel*, u32) {}
/* 0x00 */ u8 mNumber;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u8 field_0x2;
/* 0x03 */ u8 field_0x3;
/* 0x04 */ u16 field_0x4;
/* 0x06 */ u16 field_0x6;
/* 0x08 */ int field_0x8;
/* 0x03 */ u8 mPriority;
/* 0x04 */ u16 mPriorityTime;
/* 0x06 */ u16 mCBInterval;
/* 0x08 */ u32 field_0x8;
/* 0x0C */ DSPInterface::DSPBuffer* field_0xc;
/* 0x10 */ int (*mCallback)(TDSPChannel*, u32);
+3 -1
View File
@@ -8,13 +8,15 @@ namespace JASystem {
struct Wave_ {
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u8 field_0x2[0x10 - 0x2];
/* 0x02 */ u8 field_0x2;
/* 0x03 */ u8 field_0x3[0x10 - 0x3];
/* 0x10 */ int field_0x10;
/* 0x14 */ int field_0x14;
/* 0x18 */ int field_0x18;
/* 0x1C */ int field_0x1c;
/* 0x20 */ short field_0x20;
/* 0x22 */ short field_0x22;
/* 0x24 */ u32* field_0x24;
};
}
namespace DSPInterface {
+18 -3
View File
@@ -6,9 +6,9 @@
namespace JASystem {
namespace Driver {
struct PanMatrix_ {
/* 0x00 */ f32 field_0x0;
/* 0x04 */ f32 field_0x4;
/* 0x08 */ f32 field_0x8;
/* 0x00 */ f32 mSound;
/* 0x04 */ f32 mEffect;
/* 0x08 */ f32 mChannel;
};
void init();
@@ -19,6 +19,21 @@ namespace JASystem {
u32 getOutputMode();
u8 getUpdateInterval();
inline f32 Clamp01(f32 value) {
if (value <= 0.0f) {
return 0.0f;
}
if (value >= 1.0f) {
return 1.0f;
}
return value;
}
// TODO
inline void getMixerLevel() {}
extern u8 calc_sw_table[][3];
extern u16 MAX_MIXERLEVEL;
extern u16 MAX_AUTOMIXERLEVEL;
extern u32 JAS_SYSTEM_OUTPUT_MODE;