mirror of https://github.com/PrimeDecomp/prime.git
Give MusyX it's own types
This commit is contained in:
parent
7043befead
commit
79eff1f8b5
|
@ -1,30 +1,81 @@
|
|||
#ifndef MUSYX_H
|
||||
#define MUSYX_H
|
||||
|
||||
#include "types.h"
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
typedef signed short s16;
|
||||
typedef unsigned short u16;
|
||||
typedef signed long s32;
|
||||
typedef unsigned long u32;
|
||||
typedef float f32;
|
||||
typedef double f64;
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef bool8
|
||||
typedef unsigned char bool8;
|
||||
#endif
|
||||
#ifndef bool
|
||||
typedef signed long bool;
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#define SND_STUDIO_MAXNUM 8
|
||||
|
||||
#define SND_STUDIO_DEFAULT 0
|
||||
#define SND_STUDIO_NONE 0xFF
|
||||
|
||||
#define SYNTH_MAX_VOICES 64
|
||||
|
||||
typedef u32 SND_SEQID;
|
||||
typedef u32 SND_VOICEID;
|
||||
typedef u32 SND_STREAMID;
|
||||
typedef u16 SND_GROUPID;
|
||||
typedef u16 SND_SONGID;
|
||||
typedef u16 SND_FXID;
|
||||
|
||||
typedef enum {
|
||||
SND_OUTPUTMODE_MONO = 0,
|
||||
SND_OUTPUTMODE_STEREO,
|
||||
SND_OUTPUTMODE_SURROUND,
|
||||
} SND_OUTPUTMODE;
|
||||
|
||||
typedef struct SND_PLAYBACKINFO {
|
||||
u32 frq;
|
||||
u8 stereo;
|
||||
u8 bits;
|
||||
s8 deviceName[256];
|
||||
s8 versionText[256];
|
||||
} SND_PLAYBACKINFO;
|
||||
|
||||
typedef struct SND_SEQVOLDEF {
|
||||
u8 track;
|
||||
u8 volGroup;
|
||||
} SND_SEQVOLDEF;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SynthInfo {
|
||||
u32 freq;
|
||||
u8 unk[0x20c];
|
||||
u8 voices;
|
||||
u8 music;
|
||||
u8 sfx;
|
||||
u8 studios;
|
||||
} SynthInfo;
|
||||
|
||||
typedef struct _SND_HOOKS {
|
||||
typedef struct SND_HOOKS {
|
||||
void* (*malloc)(u32 len);
|
||||
void (*free)(void* addr);
|
||||
} SND_HOOKS;
|
||||
|
||||
typedef struct SND_FVECTOR {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
} SND_FVECTOR;
|
||||
|
||||
typedef struct SND_FMATRIX {
|
||||
f32 m[3][3];
|
||||
f32 t[3];
|
||||
} SND_FMATRIX;
|
||||
|
||||
#define SND_AUX_NUMPARAMETERS 4
|
||||
|
||||
#define SND_AUX_REASON_BUFFERUPDATE 0
|
||||
|
@ -97,10 +148,10 @@ typedef struct SND_AUX_DELAY {
|
|||
} SND_AUX_DELAY;
|
||||
|
||||
void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user);
|
||||
s32 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay);
|
||||
s32 sndAuxCallbackPrepareDelay(SND_AUX_DELAY* rev);
|
||||
s32 sndAuxCallbackShutdownDelay(SND_AUX_DELAY* rev);
|
||||
s32 sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI* rev);
|
||||
bool sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay);
|
||||
bool sndAuxCallbackPrepareDelay(SND_AUX_DELAY* rev);
|
||||
bool sndAuxCallbackShutdownDelay(SND_AUX_DELAY* rev);
|
||||
bool sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI* rev);
|
||||
|
||||
typedef struct _SND_REVSTD_DELAYLINE {
|
||||
s32 inPoint;
|
||||
|
@ -135,20 +186,32 @@ typedef struct SND_AUX_REVERBSTD {
|
|||
} SND_AUX_REVERBSTD;
|
||||
|
||||
void sndAuxCallbackReverbSTD(u8 reason, SND_AUX_INFO* info, void* user);
|
||||
s32 sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD* rev);
|
||||
s32 sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD* rev);
|
||||
s32 sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev);
|
||||
bool sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD* rev);
|
||||
bool sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD* rev);
|
||||
bool sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev);
|
||||
|
||||
typedef struct SND_FVECTOR {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
} SND_FVECTOR;
|
||||
typedef struct SND_PARAMETER {
|
||||
u8 ctrl;
|
||||
union {
|
||||
u8 value7;
|
||||
u16 value14;
|
||||
} paraData;
|
||||
} SND_PARAMETER;
|
||||
|
||||
typedef struct SND_FMATRIX {
|
||||
f32 m[3][3];
|
||||
f32 t[3];
|
||||
} SND_FMATRIX;
|
||||
typedef struct SND_PARAMETER_INFO {
|
||||
u8 numPara;
|
||||
SND_PARAMETER* paraArray;
|
||||
|
||||
} SND_PARAMETER_INFO;
|
||||
|
||||
#define sndFXStart(fid,vol,pan) sndFXStartEx(fid,vol,pan,SND_STUDIO_DEFAULT)
|
||||
SND_VOICEID sndFXStartEx(SND_FXID fid,u8 vol,u8 pan,u8 studio);
|
||||
SND_VOICEID sndFXStartPara(SND_FXID fid,u8 vol,u8 pan,u8 studio,u8 numPara,...);
|
||||
SND_VOICEID sndFXStartParaInfo(SND_FXID fid,u8 vol,u8 pan,u8 studio,SND_PARAMETER_INFO *paraInfo);
|
||||
SND_VOICEID sndFXCheck(SND_VOICEID vid);
|
||||
bool sndFXKeyOff(SND_VOICEID vid);
|
||||
bool sndFXCtrl(SND_VOICEID vid,u8 ctrl,u8 value);
|
||||
bool sndFXCtrl14(SND_VOICEID vid,u8 ctrl,u16 value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _SynthInfo {
|
||||
u32 freq;
|
||||
u8 unk[0x20c];
|
||||
u8 voices;
|
||||
u8 music;
|
||||
u8 sfx;
|
||||
u8 studios;
|
||||
} SynthInfo;
|
||||
|
||||
typedef s32 (*SND_COMPARE)(u16*, u8*);
|
||||
|
||||
void dataInit(u32, s32); /* extern */
|
||||
|
|
|
@ -166,9 +166,23 @@ asm void PPCSync (void)
|
|||
* Address: ........
|
||||
* Size: 000034
|
||||
*/
|
||||
void PPCEieio(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
asm void PPCEieio(void) {
|
||||
nofralloc
|
||||
mfmsr r5
|
||||
rlwinm r6, r5, 0, 0x11, 0xf
|
||||
mtmsr r6
|
||||
mfspr r3, hid0
|
||||
ori r4, r3, 8
|
||||
mtspr hid0, r4
|
||||
isync
|
||||
eieio
|
||||
isync
|
||||
|
||||
mtspr hid0, r3
|
||||
mtmsr r5
|
||||
isync
|
||||
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -196,9 +210,11 @@ _spin:
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfmmcr0(void)
|
||||
asm void PPCMfmmcr0(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
nofralloc
|
||||
mfspr r3, MMCR0
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -219,10 +235,11 @@ asm void PPCMtmmcr0 (register u32 newMmcr0)
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfmmcr1(void)
|
||||
asm void PPCMfmmcr1(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
nofralloc
|
||||
mfspr r3, MMCR1
|
||||
blr}
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
|
@ -242,9 +259,11 @@ asm void PPCMtmmcr1 (register u32 newMmcr1)
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfpmc1(void)
|
||||
asm void PPCMfpmc1(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
nofralloc
|
||||
mfspr r3, PMC1
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -265,9 +284,11 @@ asm void PPCMtpmc1 (register u32 newPmc1)
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfpmc2(void)
|
||||
asm void PPCMfpmc2(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
nofralloc
|
||||
mfspr r3, PMC2
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -288,10 +309,11 @@ asm void PPCMtpmc2 (register u32 newPmc2)
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfpmc3(void)
|
||||
asm void PPCMfpmc3(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
nofralloc
|
||||
mfspr r3, PMC2
|
||||
blr}
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
|
@ -311,9 +333,11 @@ asm void PPCMtpmc3 (register u32 newPmc3)
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfpmc4(void)
|
||||
asm void PPCMfpmc4(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
nofralloc
|
||||
mfspr r3, PMC4
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -334,19 +358,22 @@ asm void PPCMtpmc4 (register u32 newPmc4)
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfsia(void)
|
||||
asm void PPCMfsia(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
}
|
||||
nofralloc
|
||||
mfspr r3, SIA
|
||||
blr}
|
||||
|
||||
/*
|
||||
* --INFO--
|
||||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMtsia(void)
|
||||
asm void PPCMtsia(register u32 newSia)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
nofralloc
|
||||
mtspr SIA, newSia
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -441,9 +468,11 @@ asm void PPCMtwpar ( register u32 newwpar )
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfdmaU(void)
|
||||
asm void PPCMfdmaU(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
nofralloc
|
||||
mfspr r3, DMA_U
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -451,9 +480,11 @@ void PPCMfdmaU(void)
|
|||
* Address: ........
|
||||
* Size: 000008
|
||||
*/
|
||||
void PPCMfdmaL(void)
|
||||
asm void PPCMfdmaL(void)
|
||||
{
|
||||
// UNUSED FUNCTION
|
||||
nofralloc
|
||||
mfspr r3, DMA_L
|
||||
blr
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,8 +23,8 @@ void __AICallbackStackSwitch(register AIDCallback cb);
|
|||
void __AI_SRC_INIT(void);
|
||||
|
||||
AIDCallback AIRegisterDMACallback(AIDCallback callback) {
|
||||
AIDCallback ret;
|
||||
s32 oldInts;
|
||||
AIDCallback ret;
|
||||
|
||||
ret = __AID_Callback;
|
||||
oldInts = OSDisableInterrupts();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "musyx/musyx_priv.h"
|
||||
|
||||
extern s32 ReverbSTDCreate(_SND_REVSTD_WORK* rv, f32 coloration, f32 time, f32 mix, f32 damping, f32 preDelay);
|
||||
extern bool ReverbSTDCreate(_SND_REVSTD_WORK* rv, f32 coloration, f32 time, f32 mix, f32 damping, f32 preDelay);
|
||||
extern void ReverbHIFree(_SND_REVSTD_WORK* rev);
|
||||
extern void ReverbSTDCallback(s32* left, s32* right, s32* surround, _SND_REVSTD_WORK* rv);
|
||||
|
||||
|
@ -21,14 +21,15 @@ void sndAuxCallbackReverbSTD(u8 reason, SND_AUX_INFO* info, void* user) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
bool sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
rev->tempDisableFX = 0;
|
||||
return ReverbSTDCreate(&rev->rv, rev->coloration, rev->time, rev->mix, rev->damping, rev->preDelay);
|
||||
}
|
||||
s32 sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
bool sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
ReverbSTDFree(&rev->rv);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev) { /* not in MP */
|
||||
bool sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
|
||||
bool sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
|
||||
s32 i;
|
||||
s32* left;
|
||||
s32* right;
|
||||
|
@ -96,19 +96,19 @@ s32 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
|
|||
*sur = 0;
|
||||
++sur;
|
||||
}
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackPrepareDelay(SND_AUX_DELAY* delay) {
|
||||
bool sndAuxCallbackPrepareDelay(SND_AUX_DELAY* delay) {
|
||||
delay->left = NULL;
|
||||
return sndAuxCallbackUpdateSettingsDelay(delay);
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackShutdownDelay(SND_AUX_DELAY* delay) {
|
||||
bool sndAuxCallbackShutdownDelay(SND_AUX_DELAY* delay) {
|
||||
if (delay->left != NULL) {
|
||||
salFree(delay->left);
|
||||
salFree(delay->right);
|
||||
salFree(delay->sur);
|
||||
}
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
|
||||
|
||||
extern s32 ReverbHICreate(_SND_REVHI_WORK* rev, f32 coloration, f32 time, f32 mix, f32 damping, f32 preDelay, f32 crosstalk);
|
||||
extern bool ReverbHICreate(_SND_REVHI_WORK* rev, f32 coloration, f32 time, f32 mix, f32 damping, f32 preDelay, f32 crosstalk);
|
||||
extern void ReverbHIFree(_SND_REVHI_WORK* rev);
|
||||
|
||||
void sndAuxCallbackReverbHI(u8 reason, SND_AUX_INFO* info, void* user) {
|
||||
|
@ -36,16 +36,17 @@ void sndAuxCallbackReverbHI(u8 reason, SND_AUX_INFO* info, void* user) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackPrepareReverbHI(SND_AUX_REVERBHI *rev) {
|
||||
bool sndAuxCallbackPrepareReverbHI(SND_AUX_REVERBHI *rev) {
|
||||
rev->tempDisableFX = 0;
|
||||
return ReverbHICreate(&rev->rv, rev->coloration, rev->time, rev->mix, rev->damping, rev->preDelay, rev->crosstalk);
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackShutdownReverbHI(SND_AUX_REVERBHI* rev) {
|
||||
bool sndAuxCallbackShutdownReverbHI(SND_AUX_REVERBHI* rev) {
|
||||
ReverbHIFree(&rev->rv);
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
s32 sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI *rev) {
|
||||
bool sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI *rev) {
|
||||
/* not in MP */
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ extern s8 sndActive;
|
|||
extern s8 synthIdleWaitActive;
|
||||
extern SynthInfo synthInfo;
|
||||
|
||||
inline s32 DoInit(u32 rate, u32 aramSize, u8 voices, u32 flags) {
|
||||
inline bool DoInit(u32 rate, u32 aramSize, u8 voices, u32 flags) {
|
||||
dataInitStack();
|
||||
dataInit(0, aramSize);
|
||||
seqInit();
|
||||
|
@ -20,10 +20,10 @@ inline s32 DoInit(u32 rate, u32 aramSize, u8 voices, u32 flags) {
|
|||
s3dInit(flags);
|
||||
sndActive = 1;
|
||||
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 sndInit(u8 voices, u8 music, u8 sfx, u8 studios, s32 flags, s32 aramSize) {
|
||||
bool sndInit(u8 voices, u8 music, u8 sfx, u8 studios, s32 flags, s32 aramSize) {
|
||||
s32 rate;
|
||||
s32 ret;
|
||||
|
||||
|
|
Loading…
Reference in New Issue