-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
2,439 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#ifndef ADSR_H | ||
#define ADSR_H | ||
|
||
#include "musyx/musyx.h" | ||
typedef struct ADSR_INFO { | ||
// total size: 0x14 | ||
union ai_data { | ||
struct { | ||
// total size: 0x14 | ||
s32 atime; // offset 0x0, size 0x4 | ||
s32 dtime; // offset 0x4, size 0x4 | ||
u16 slevel; // offset 0x8, size 0x2 | ||
u16 rtime; // offset 0xA, size 0x2 | ||
s32 ascale; // offset 0xC, size 0x4 | ||
s32 dscale; // offset 0x10, size 0x4 | ||
} dls; | ||
struct { | ||
// total size: 0x8 | ||
u16 atime; // offset 0x0, size 0x2 | ||
u16 dtime; // offset 0x2, size 0x2 | ||
u16 slevel; // offset 0x4, size 0x2 | ||
u16 rtime; // offset 0x6, size 0x2 | ||
} linear; | ||
} data; // offset 0x0, size 0x14 | ||
} ADSR_INFO; | ||
|
||
typedef struct ADSR_VARS { | ||
u8 mode; | ||
u8 state; | ||
u32 cnt; | ||
s32 currentVolume; | ||
s32 currentIndex; | ||
s32 currentDelta; | ||
|
||
union data { | ||
struct _dls { | ||
u32 aTime; | ||
u32 dTime; | ||
u16 sLevel; | ||
u32 rTime; | ||
u16 cutOff; | ||
u8 aMode; | ||
} dls; | ||
|
||
struct _linear { | ||
u32 aTime; | ||
u32 dTime; | ||
u16 sLevel; | ||
u32 rTime; | ||
} linear; | ||
} data; | ||
} ADSR_VARS; | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
u32 adsrHandleLowPrecision(ADSR_VARS* adsr, u16* adsr_start, u16* adsr_delta); | ||
bool adsrRelease(ADSR_VARS* adsr); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // ADSR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#ifndef DSPVOICE_H | ||
#define DSPVOICE_H | ||
|
||
#include "musyx/musyx.h" | ||
|
||
#include "musyx/voice.h" | ||
#include "musyx/synthdata.h" | ||
|
||
typedef struct DSPvoice { | ||
_PB* pb; | ||
void* patchData; | ||
void* itdBuffer; | ||
struct DSPvoice* next; | ||
struct DSPvoice* prev; | ||
struct DSPvoice* nextAlien; | ||
u32 mesgCallBackUserValue; | ||
u32 prio; | ||
u32 currentAddr; | ||
u32 changed[5]; | ||
u32 pitch[5]; | ||
u16 volL; | ||
u16 volR; | ||
u16 volS; | ||
u16 volLa; | ||
u16 volRa; | ||
u16 volSa; | ||
u16 volLb; | ||
u16 volRb; | ||
u16 volSb; | ||
u16 lastVolL; | ||
u16 lastVolR; | ||
u16 lastVolS; | ||
u16 lastVolLa; | ||
u16 lastVolRa; | ||
u16 lastVolSa; | ||
u16 lastVolLb; | ||
u16 lastVolRb; | ||
u16 lastVolSb; | ||
u16 smp_id; | ||
SAMPLE_INFO smp_info; | ||
VSampleInfo vSampleInfo; | ||
u8 streamLoopPS; | ||
ADSR_VARS adsr; | ||
u16 srcTypeSelect; | ||
u16 srcCoefSelect; | ||
u16 itdShiftL; | ||
u16 itdShiftR; | ||
u8 singleOffset; | ||
struct { | ||
u32 posHi; | ||
u32 posLo; | ||
u32 pitch; | ||
} playInfo; | ||
|
||
struct { | ||
u8 pitch; | ||
u8 vol; | ||
u8 volA; | ||
u8 volB; | ||
} lastUpdate; | ||
|
||
u32 virtualSampleID; | ||
u8 state; | ||
u8 postBreak; | ||
u8 startupBreak; | ||
u8 studio; | ||
u32 flags; | ||
} DSPvoice; | ||
typedef struct DSPhostDPop { | ||
// total size: 0x24 | ||
s32 l; // offset 0x0, size 0x4 | ||
s32 r; // offset 0x4, size 0x4 | ||
s32 s; // offset 0x8, size 0x4 | ||
s32 lA; // offset 0xC, size 0x4 | ||
s32 rA; // offset 0x10, size 0x4 | ||
s32 sA; // offset 0x14, size 0x4 | ||
s32 lB; // offset 0x18, size 0x4 | ||
s32 rB; // offset 0x1C, size 0x4 | ||
s32 sB; // offset 0x20, size 0x4 | ||
} DSPhostDPop; | ||
|
||
typedef struct DSPinput { | ||
// total size: 0xC | ||
u8 studio; // offset 0x0, size 0x1 | ||
u16 vol; // offset 0x2, size 0x2 | ||
u16 volA; // offset 0x4, size 0x2 | ||
u16 volB; // offset 0x6, size 0x2 | ||
SND_STUDIO_INPUT* desc; // offset 0x8, size 0x4 | ||
} DSPinput; | ||
|
||
typedef struct DSPstudioinfo { | ||
// total size: 0xBC | ||
_SPB* spb; // offset 0x0, size 0x4 | ||
DSPhostDPop hostDPopSum; // offset 0x4, size 0x24 | ||
s32* main[2]; // offset 0x28, size 0x8 | ||
s32* auxA[3]; // offset 0x30, size 0xC | ||
s32* auxB[3]; // offset 0x3C, size 0xC | ||
DSPvoice* voiceRoot; // offset 0x48, size 0x4 | ||
DSPvoice* alienVoiceRoot; // offset 0x4C, size 0x4 | ||
u8 state; // offset 0x50, size 0x1 | ||
u8 isMaster; // offset 0x51, size 0x1 | ||
u8 numInputs; // offset 0x52, size 0x1 | ||
SND_STUDIO_TYPE type; // offset 0x54, size 0x4 | ||
DSPinput in[7]; // offset 0x58, size 0x54 | ||
SND_AUX_CALLBACK auxAHandler; // offset 0xAC, size 0x4 | ||
SND_AUX_CALLBACK auxBHandler; // offset 0xB0, size 0x4 | ||
void* auxAUser; // offset 0xB4, size 0x4 | ||
void* auxBUser; // offset 0xB8, size 0x4 | ||
} DSPstudioinfo; | ||
|
||
extern DSPstudioinfo dspStudio[8]; | ||
extern DSPvoice* dspVoice; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef _MUSYX_MACROS | ||
#define _MUSYX_MACROS | ||
|
||
#include "musyx/musyx.h" | ||
#include "musyx/synth.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void macInit(); | ||
bool macPostMessage(SND_VOICEID vid, s32 mesg); | ||
u32 macStart(u16 macid, u8 priority, u8 maxVoices, u16 allocId, u8 key, u8 vol, u8 panning, u8 midi, | ||
u8 midiSet, u8 section, u16 step, u16 trackid, u8 new_vid, u8 vGroup, u8 studio, | ||
u32 itd); | ||
void macHandle(u32 deltaTime); | ||
void macMakeInactive(SYNTH_VOICE* svoice, MAC_STATE); | ||
void macSetPedalState(SYNTH_VOICE* svoice, u32 state); | ||
void macSetExternalKeyoff(SYNTH_VOICE* svoice); | ||
void macSampleEndNotify(SYNTH_VOICE* sv); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef _MUSYX_PLATFORM | ||
#define _MUSYX_PLATFORM | ||
|
||
|
||
#define MUSY_TARGET_PC 0 | ||
#define MUSY_TARGET_DOLPHIN 1 | ||
|
||
#ifndef MUSY_TARGET | ||
#define MUSY_TARGET MUSY_TARGET_PC | ||
#endif | ||
|
||
#ifndef ATTRIBUTE_ALIGN | ||
#if defined(__MWERKS__) || defined(__GNUC__) | ||
#define ATTRIBUTE_ALIGN(num) __attribute__((aligned(num))) | ||
#elif defined(_MSC_VER) | ||
#define ATTRIBUTE_ALIGN(num) | ||
#else | ||
#error unknown compiler | ||
#endif | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef _MUSYX_S3D | ||
#define _MUSYX_S3D | ||
|
||
#include "musyx/musyx.h" | ||
|
||
#include "musyx/synthdata.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void s3dKillAllEmitter(); | ||
void s3dInit(u32); /* extern */ | ||
void s3dKillEmitterByFXID(FX_TAB* fxTab, u32 num); | ||
void s3dExit(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#ifndef SAL_H | ||
#define SAL_H | ||
|
||
#include "musyx/dspvoice.h" | ||
#include "musyx/musyx.h" | ||
typedef void (*SND_SOME_CALLBACK)(); | ||
|
||
#define CLAMP(value, min, max) ((value) > (max) ? (max) : (value) < (min) ? (min) : (value)) | ||
// TODO matching hack | ||
#define CLAMP_INV(value, min, max) ((value) < (min) ? (min) : (value) > (max) ? (max) : (value)) | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
typedef struct SAL_VOLINFO { | ||
// total size: 0x24 | ||
f32 volL; // offset 0x0, size 0x4 | ||
f32 volR; // offset 0x4, size 0x4 | ||
f32 volS; // offset 0x8, size 0x4 | ||
f32 volAuxAL; // offset 0xC, size 0x4 | ||
f32 volAuxAR; // offset 0x10, size 0x4 | ||
f32 volAuxAS; // offset 0x14, size 0x4 | ||
f32 volAuxBL; // offset 0x18, size 0x4 | ||
f32 volAuxBR; // offset 0x1C, size 0x4 | ||
f32 volAuxBS; // offset 0x20, size 0x4 | ||
} SAL_VOLINFO; | ||
|
||
typedef struct SAL_PANINFO { | ||
// total size: 0x30 | ||
u32 pan_i; // offset 0x0, size 0x4 | ||
u32 pan_im; // offset 0x4, size 0x4 | ||
u32 span_i; // offset 0x8, size 0x4 | ||
u32 span_im; // offset 0xC, size 0x4 | ||
u32 rpan_i; // offset 0x10, size 0x4 | ||
u32 rpan_im; // offset 0x14, size 0x4 | ||
f32 pan_f; // offset 0x18, size 0x4 | ||
f32 pan_fm; // offset 0x1C, size 0x4 | ||
f32 span_f; // offset 0x20, size 0x4 | ||
f32 span_fm; // offset 0x24, size 0x4 | ||
f32 rpan_f; // offset 0x28, size 0x4 | ||
f32 rpan_fm; // offset 0x2C, size 0x4 | ||
} SAL_PANINFO; | ||
|
||
u32 salInitAi(SND_SOME_CALLBACK, u32, u32*); | ||
u32 salInitDsp(u32); | ||
u32 salInitDspCtrl(u8 numVoices, u8 numStudios, u32 defaultStudioDPL2); | ||
u32 salStartAi(); | ||
void salInitHRTFBuffer(); | ||
void salActivateVoice(DSPvoice* dsp_vptr, u8 studio); | ||
void salDeactivateVoice(DSPvoice* dsp_vptr); | ||
void salActivateStudio(u8 studio, u32 isMaster, SND_STUDIO_TYPE type); | ||
void salDeactivateStudio(u8 studio); | ||
void salActivateVoice(DSPvoice* dsp_vptr, u8 studio); | ||
void salCalcVolume(u8 voltab_index, SAL_VOLINFO* vi, f32 vol, u32 pan, u32 span, f32 auxa, f32 auxb, | ||
u32 itd, u32 dpl2); | ||
void salReconnectVoice(DSPvoice* dsp_vptr, u8 studio); | ||
void* salMalloc(u32 len); | ||
void salFree(void* addr); | ||
|
||
#define SAL_MAX_STUDIONUM 8 | ||
extern u8 salMaxStudioNum; | ||
extern u8 salNumVoices; | ||
|
||
void salApplyMatrix(const SND_FMATRIX* a, const SND_FVECTOR* b, SND_FVECTOR* out); | ||
f32 salNormalizeVector(SND_FVECTOR* vec); | ||
void salCrossProduct(SND_FVECTOR* out, const SND_FVECTOR* a, const SND_FVECTOR* b); | ||
|
||
#define SAL_CROSS_PRODUCT(out, a, b) \ | ||
do { \ | ||
out.x = (a.y * b.z) - (a.z * b.y); \ | ||
out.y = (a.z * b.x) - (a.x * b.z); \ | ||
out.z = (a.x * b.y) - (a.y * b.x); \ | ||
} while (0) | ||
|
||
void salInvertMatrix(SND_FMATRIX* out, const SND_FMATRIX* in); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef SND_H | ||
#define SND_H | ||
|
||
#include "musyx/musyx.h" | ||
#include "musyx/voice.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef s32 (*SND_COMPARE)(void*, void*); | ||
|
||
u16 sndRand(void); | ||
s16 sndSin(u16 angle); | ||
void* sndBSearch(void* key, void* base, s32 num, s32 len, SND_COMPARE cmp); | ||
void sndConvertMs(u32* time); | ||
void sndConvertTicks(u32* out, SYNTH_VOICE* svoice); | ||
u32 sndConvert2Ms(u32 time); | ||
u32 sndStreamAllocLength(u32 num, u32 flags); | ||
void sndStreamFree(u32 stid); | ||
u32 sndStreamActivate(u32 stid); | ||
void sndStreamDeactivate(u32 stid); | ||
u32 sndGetPitch(u8 key, u32 sInfo); | ||
s32 sndPitchUpOne(u16 note); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.