mirror of
https://github.com/zeldaret/tp
synced 2026-05-24 07:11:06 -04:00
Old JAudio changes
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -3,4 +3,6 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
void JASReport(const char* message, ...);
|
||||
|
||||
#endif /* JASREPORT_H */
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
#define DSPPROC_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "dolphin/dsp/dsp.h"
|
||||
|
||||
#endif /* DSPPROC_H */
|
||||
|
||||
@@ -121,9 +121,9 @@ struct Z2Audience : public JAIAudience {
|
||||
/* 802BD1FC */ virtual ~Z2Audience();
|
||||
/* 802BD338 */ virtual JAIAudible* newAudible(JGeometry::TVec3<f32> const&, JAISoundID,
|
||||
JGeometry::TVec3<f32> const*, u32);
|
||||
/* 802BDED4 */ virtual void getMaxChannels();
|
||||
/* 802BDED4 */ virtual int getMaxChannels();
|
||||
/* 802BD4D4 */ virtual void deleteAudible(JAIAudible*);
|
||||
/* 802BD5B8 */ virtual void calcPriority(JAIAudible*);
|
||||
/* 802BD5B8 */ virtual u32 calcPriority(JAIAudible*);
|
||||
/* 802BD71C */ virtual void mixChannelOut(JASSoundParams const&, JAIAudible*, int);
|
||||
|
||||
/* 0x004 */ f32 field_0x4;
|
||||
|
||||
@@ -3,4 +3,10 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
void DSPReleaseHalt2(u32 msg);
|
||||
u16 DSP_CreateMap2(u32 msg);
|
||||
void DSPSendCommands2(u32* msgs, u32 param_1, void (*param_2)(u16));
|
||||
void DsetupTable(u32 param_0, u32 param_1, u32 param_2, u32 param_3, u32 param_4);
|
||||
void DsetMixerLevel(f32 level);
|
||||
|
||||
#endif /* DSP_H */
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
#ifndef M_DO_M_DO_AUDIO_H
|
||||
#define M_DO_M_DO_AUDIO_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "Z2AudioLib/Z2AudioMgr.h"
|
||||
#include "Z2AudioLib/Z2EnvSeMgr.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
// move/fix later
|
||||
template <typename T>
|
||||
class JASGlobalInstance {
|
||||
public:
|
||||
T* getInstance() { return sInstance; };
|
||||
|
||||
static T* sInstance;
|
||||
};
|
||||
|
||||
class mDoAud_zelAudio_c {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user