mirror of
https://github.com/PrimeDecomp/prime.git
synced 2026-07-12 18:18:56 -07:00
More MusyX progress, fully match hardware.c
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -920,9 +920,9 @@ LIBS = [
|
||||
{
|
||||
"lib": "musyx",
|
||||
#"mw_version": "1.2.5",
|
||||
#"cflags": "-proc gecko -fp hard -nodefaults -nosyspath -i include -i libc -g -sym on -D_DEBUG=1 -enum int ",
|
||||
#"cflags": "-proc gecko -fp hard -nodefaults -nosyspath -i include -i libc -g -sym on -D_DEBUG=1 -enum int -DMUSY_VERSION_MAJOR=1 -DMUSY_VERSION_MINOR=5 -DMUSY_VERSION_PATCH=3",
|
||||
"mw_version": "1.3.2",
|
||||
"cflags": "$cflags_musyx",
|
||||
"cflags": "$cflags_musyx -DMUSY_VERSION_MAJOR=1 -DMUSY_VERSION_MINOR=5 -DMUSY_VERSION_PATCH=4",
|
||||
"host": False,
|
||||
"objects": [
|
||||
"musyx/runtime/seq",
|
||||
@@ -951,7 +951,7 @@ LIBS = [
|
||||
["musyx/runtime/hw_dolphin", True],
|
||||
["musyx/runtime/hw_memory", True],
|
||||
["musyx/runtime/CheapReverb/creverb_fx", True],
|
||||
"musyx/runtime/CheapReverb/creverb",
|
||||
["musyx/runtime/CheapReverb/creverb", False],
|
||||
["musyx/runtime/StdReverb/reverb_fx", True],
|
||||
["musyx/runtime/StdReverb/reverb", False],
|
||||
["musyx/runtime/Delay/delay_fx", True],
|
||||
|
||||
+18
-5
@@ -4,29 +4,42 @@
|
||||
extern void OSPanic(const char* file, int line, const char* msg, ...);
|
||||
extern void OSReport(const char* msg, ...);
|
||||
|
||||
static inline unsigned __SOME_ASSERT_DERP1() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned __SOME_ASSERT_DERP2() {
|
||||
return __SOME_ASSERT_DERP1();
|
||||
}
|
||||
|
||||
static inline void __SOME_ASSERT_DERP() {
|
||||
__SOME_ASSERT_DERP2() != 0;
|
||||
}
|
||||
|
||||
#ifndef ASSERT
|
||||
#ifdef _DEBUG
|
||||
#define ASSERT(cond) \
|
||||
#define MUSY_ASSERT(cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
OSPanic(__FILE__, __LINE__, "Failed assertion " #cond); \
|
||||
} \
|
||||
__SOME_ASSERT_DERP(); \
|
||||
} while(0)
|
||||
#else
|
||||
#define ASSERT(cond)
|
||||
#define MUSY_ASSERT(cond)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ASSERT_MSG
|
||||
#ifndef MUSY_ASSERT_MSG
|
||||
#ifdef _DEBUG
|
||||
#define ASSERT_MSG(cond, msg) \
|
||||
#define MUSY_ASSERT_MSG(cond, msg) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
OSPanic(__FILE__, __LINE__, msg); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define ASSERT_MSG(cond, msg)
|
||||
#define MUSY_ASSERT_MSG(cond, msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _MUSYX_MUSYX
|
||||
#define _MUSYX_MUSYX
|
||||
|
||||
#include "musyx/version.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _MUSYX_MUSYX_PRIV
|
||||
#define _MUSYX_MUSYX_PRIV
|
||||
|
||||
#include "musyx/assert.h"
|
||||
#include "musyx/musyx.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -857,6 +858,7 @@ u32 dataRemoveMacro(u16 mid);
|
||||
u32 dataInsertCurve(u16 cid, void* curvedata);
|
||||
u32 dataRemoveCurve(u16 sid);
|
||||
long dataGetSample(u16 sid, SAMPLE_INFO* newsmp);
|
||||
void* dataGetCurve(u16 cid);
|
||||
u32 dataAddSampleReference(u16 sid);
|
||||
u32 dataRemoveSampleReference(u16 sid);
|
||||
u32 dataInsertKeymap(u16 cid, void* keymapdata);
|
||||
@@ -884,14 +886,16 @@ void s3dKillEmitterByFXID(FX_TAB* fxTab, unsigned long num);
|
||||
void s3dExit();
|
||||
void synthInit(u32, u8); /* extern */
|
||||
void synthFXCloneMidiSetup(SYNTH_VOICE* dest, SYNTH_VOICE* src);
|
||||
|
||||
extern u32 synthGlobalVariable[16];
|
||||
extern s16 voicePrioSortRootListRoot;
|
||||
extern u16 voicePrioSortRootListRoot;
|
||||
extern u8 voiceMusicRunning;
|
||||
extern u8 voiceFxRunning;
|
||||
extern u8 voiceListInsert;
|
||||
extern u8 voiceListRoot;
|
||||
void voiceSetPriority(struct SYNTH_VOICE* svoice, unsigned char prio);
|
||||
u32 voiceIsLastStarted(struct SYNTH_VOICE* svoice);
|
||||
s32 voiceKillSound(u32 voiceid);
|
||||
|
||||
u32 synthGetTicksPerSecond(SYNTH_VOICE* svoice);
|
||||
void synthKillVoicesByMacroReferences(u16* ref);
|
||||
@@ -916,6 +920,7 @@ typedef s32 (*SND_MESSAGE_CALLBACK)(u32, u32);
|
||||
typedef void (*SND_SOME_CALLBACK)();
|
||||
|
||||
extern SND_MESSAGE_CALLBACK salMessageCallback;
|
||||
extern SND_MESSAGE_CALLBACK synthMessageCallback;
|
||||
/* Math */
|
||||
void salApplyMatrix(const SND_FMATRIX* a, const SND_FVECTOR* b, SND_FVECTOR* out);
|
||||
float salNormalizeVector(SND_FVECTOR* vec);
|
||||
@@ -960,8 +965,13 @@ typedef struct SND_STREAM_INFO {
|
||||
} SND_STREAM_INFO;
|
||||
|
||||
void streamOutputModeChanged();
|
||||
void inpSetExCtrl(struct SYNTH_VOICE* svoice, unsigned char ctrl, signed short v);
|
||||
void inpSetGlobalMIDIDirtyFlag(u8 chan, u8 midiSet, s32 flag);
|
||||
void inpAddCtrl(struct CTRL_DEST* dest, unsigned char ctrl, long scale, unsigned char comb,
|
||||
unsigned long isVar);
|
||||
void inpSetExCtrl(SYNTH_VOICE* svoice, unsigned char ctrl, signed short v);
|
||||
CHANNEL_DEFAULTS* inpGetChannelDefaults(unsigned char midi, unsigned char midiSet);
|
||||
extern CTRL_DEST inpAuxA[8][4];
|
||||
extern CTRL_DEST inpAuxB[8][4];
|
||||
void inpSetMidiLastNote(u8 midi, u8 midiSet, u8 key);
|
||||
u8 inpGetMidiLastNote(u8 midi, u8 midiSet);
|
||||
unsigned short inpGetExCtrl(SYNTH_VOICE* svoice, unsigned char ctrl);
|
||||
|
||||
@@ -18,7 +18,7 @@ extern void* synthAuxBUser[8];
|
||||
extern u8 synthITDDefault[16];
|
||||
extern u32 synthFlags;
|
||||
|
||||
s32 vidGetInternalId(SND_VOICEID id);
|
||||
u32 vidGetInternalId(SND_VOICEID id);
|
||||
bool synthFXSetCtrl(SND_VOICEID vid, u8 ctrl, u8 value);
|
||||
bool synthFXSetCtrl14(SND_VOICEID vid, u8 ctrl, u16 value);
|
||||
bool synthSendKeyOff(SND_VOICEID vid);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef _MUSYX_VERSION
|
||||
#define _MUSYX_VERSION
|
||||
|
||||
|
||||
#ifndef MUSY_VERSION_CHECK
|
||||
#define MUSY_VERSION_CHECK(major, minor, patch) ((major << 16) | (minor << 8) | (patch))
|
||||
#endif
|
||||
|
||||
#ifndef MUSY_VERSION_MAJOR
|
||||
#define MUSY_VERSION_MAJOR 1
|
||||
#endif
|
||||
|
||||
#ifndef MUSY_VERSION_MINOR
|
||||
#define MUSY_VERSION_MINOR 5
|
||||
#endif
|
||||
|
||||
#ifndef MUSY_VERSION_PATCH
|
||||
#define MUSY_VERSION_PATCH 3
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MUSY_VERSION
|
||||
#define MUSY_VERSION MUSY_VERSION_CHECK(MUSY_VERSION_MAJOR, MUSY_VERSION_MINOR, MUSY_VERSION_PATCH)
|
||||
#endif
|
||||
|
||||
#endif // _MUSYX_VERSION
|
||||
+2
-2
@@ -160,7 +160,7 @@ static inline int __fpclassifyd(double x) {
|
||||
#define isinf(x) (fpclassify(x) == FP_INFINITE)
|
||||
#define isfinite(x) ((fpclassify(x) > FP_INFINITE))
|
||||
|
||||
static float sqrtf(float x) {
|
||||
static inline float sqrtf(float x) {
|
||||
const double _half = .5;
|
||||
const double _three = 3.0;
|
||||
volatile float y;
|
||||
@@ -179,7 +179,7 @@ static float sqrtf(float x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
static double sqrt(double x) {
|
||||
static inline double sqrt(double x) {
|
||||
if (x > 0.0) {
|
||||
double guess = __frsqrte(x); /* returns an approximation to */
|
||||
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/* ---------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------
|
||||
*/
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
static void DLsetdelay(_SND_REVSTD_DELAYLINE * dl, s32 lag) {
|
||||
dl->outPoint = dl->inPoint - (lag * sizeof(f32));
|
||||
while (dl->outPoint < 0) {
|
||||
dl->outPoint += dl->length;
|
||||
}
|
||||
}
|
||||
|
||||
static void DLcreate(_SND_REVSTD_DELAYLINE* dl, s32 len) {
|
||||
dl->length = len * sizeof(f32);
|
||||
dl->inputs = (f32*)salMalloc(len * sizeof(f32));
|
||||
memset(dl->inputs, 0, len * sizeof(len));
|
||||
dl->lastOutput = 0.f;
|
||||
DLsetdelay(dl, len >> 1);
|
||||
dl->inPoint = 0;
|
||||
dl->outPoint = 0;
|
||||
}
|
||||
|
||||
static void DLdelete(_SND_REVSTD_DELAYLINE* dl) { salFree(dl->inputs); }
|
||||
@@ -1,26 +1,46 @@
|
||||
/* ---------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------------------------
|
||||
*/
|
||||
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
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);
|
||||
extern unsigned long ReverbSTDModify(_SND_REVSTD_WORK* rv, float coloration, float time, float mix,
|
||||
float damping, float predelay);
|
||||
|
||||
void sndAuxCallbackReverbSTD(u8 reason, SND_AUX_INFO* info, void* user) {
|
||||
SND_AUX_REVERBSTD* rev;
|
||||
switch (reason) {
|
||||
case SND_AUX_REASON_BUFFERUPDATE:
|
||||
rev = (SND_AUX_REVERBSTD*)user;
|
||||
if ((u8)rev->tempDisableFX == 0) {
|
||||
if ((u8)((SND_AUX_REVERBSTD*)user)->tempDisableFX == 0) {
|
||||
ReverbSTDCallback(info->data.bufferUpdate.left, info->data.bufferUpdate.right,
|
||||
info->data.bufferUpdate.surround, &rev->rv);
|
||||
info->data.bufferUpdate.surround, &((SND_AUX_REVERBSTD*)user)->rv);
|
||||
}
|
||||
break;
|
||||
case SND_AUX_REASON_PARAMETERUPDATE:
|
||||
// UNIMPLEMENTED
|
||||
break;
|
||||
default:
|
||||
// ASSERT_MSG(FALSE);
|
||||
MUSY_ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
rev->tempDisableFX = TRUE;
|
||||
ReverbSTDModify(&rev->rv, rev->coloration, rev->time, rev->mix, rev->damping, rev->preDelay);
|
||||
rev->tempDisableFX = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
rev->tempDisableFX = 0;
|
||||
@@ -31,5 +51,3 @@ bool sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD* rev) {
|
||||
ReverbSTDFree(&rev->rv);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev) { return FALSE; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,56 +12,56 @@
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user) {
|
||||
s32 curSur;
|
||||
s32 curLeft;
|
||||
s32 curRight;
|
||||
s32 i;
|
||||
s32* leftOffset;
|
||||
s32* surOffset;
|
||||
s32* rightOffset;
|
||||
s32* leftPtr;
|
||||
s32* rightPtr;
|
||||
s32* surPtr;
|
||||
SND_AUX_DELAY* delay;
|
||||
long l; // r30
|
||||
long r; // r29
|
||||
long s; // r28
|
||||
long* lBuf; // r27
|
||||
long* rBuf; // r26
|
||||
long* sBuf; // r25
|
||||
unsigned long i; // r24
|
||||
struct SND_AUX_DELAY* c; // r31
|
||||
long* left; // r23
|
||||
long* right; // r22
|
||||
long* sur; // r21
|
||||
|
||||
switch (reason) {
|
||||
case SND_AUX_REASON_BUFFERUPDATE:
|
||||
delay = (SND_AUX_DELAY*)user;
|
||||
leftOffset = delay->left + (delay->currentPos[0] * 160);
|
||||
leftPtr = info->data.bufferUpdate.left;
|
||||
rightPtr = info->data.bufferUpdate.right;
|
||||
rightOffset = delay->right + (delay->currentPos[1] * 160);
|
||||
surPtr = info->data.bufferUpdate.surround;
|
||||
surOffset = delay->sur + (delay->currentPos[2] * 160);
|
||||
for (i = 160; i > 0; --i) {
|
||||
curLeft = *leftOffset;
|
||||
curRight = *rightOffset;
|
||||
curSur = *surOffset;
|
||||
*leftOffset = *leftPtr + ((s32)(curLeft * delay->currentFeedback[0]) >> 7);
|
||||
++leftOffset;
|
||||
*rightOffset = *rightPtr + ((s32)(curRight * delay->currentFeedback[1]) >> 7);
|
||||
++rightOffset;
|
||||
*surOffset = *surPtr + ((s32)(curSur * delay->currentFeedback[2]) >> 7);
|
||||
++surOffset;
|
||||
*leftPtr = (s32)(curLeft * delay->currentOutput[0]) >> 7;
|
||||
++leftPtr;
|
||||
*rightPtr = (s32)(curRight * delay->currentOutput[1]) >> 7;
|
||||
++rightPtr;
|
||||
*surPtr = (s32)(curSur * delay->currentOutput[2]) >> 7;
|
||||
++surPtr;
|
||||
c = (SND_AUX_DELAY*)user;
|
||||
left = info->data.bufferUpdate.left;
|
||||
right = info->data.bufferUpdate.right;
|
||||
sur = info->data.bufferUpdate.surround;
|
||||
lBuf = c->left + (c->currentPos[0] * 160);
|
||||
rBuf = c->right + (c->currentPos[1] * 160);
|
||||
sBuf = c->sur + (c->currentPos[2] * 160);
|
||||
for (i = 0; i < 160; ++i) {
|
||||
|
||||
l = *lBuf;
|
||||
r = *rBuf;
|
||||
s = *sBuf;
|
||||
|
||||
*lBuf++ = *left + ((s32)(l * c->currentFeedback[0]) >> 7);
|
||||
*rBuf++ = *right + ((s32)(r * c->currentFeedback[1]) >> 7);
|
||||
*sBuf++ = *sur + ((s32)(s * c->currentFeedback[2]) >> 7);
|
||||
|
||||
*left++ = (s32)(l * c->currentOutput[0]) >> 7;
|
||||
*right++ = (s32)(r * c->currentOutput[1]) >> 7;
|
||||
*sur++ = (s32)(s * c->currentOutput[2]) >> 7;
|
||||
}
|
||||
delay->currentPos[0] = (delay->currentPos[0] + 1) % delay->currentSize[0];
|
||||
delay->currentPos[1] = (delay->currentPos[1] + 1) % delay->currentSize[1];
|
||||
delay->currentPos[2] = (delay->currentPos[2] + 1) % delay->currentSize[2];
|
||||
|
||||
c->currentPos[0] = (c->currentPos[0] + 1) % c->currentSize[0];
|
||||
c->currentPos[1] = (c->currentPos[1] + 1) % c->currentSize[1];
|
||||
c->currentPos[2] = (c->currentPos[2] + 1) % c->currentSize[2];
|
||||
break;
|
||||
case SND_AUX_REASON_PARAMETERUPDATE:
|
||||
break;
|
||||
default:
|
||||
// ASSERT_MSG(FALSE);
|
||||
MUSY_ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
|
||||
s32 i;
|
||||
u32 i;
|
||||
s32* left;
|
||||
s32* right;
|
||||
s32* sur;
|
||||
@@ -77,25 +77,25 @@ bool sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
|
||||
delay->left = (s32*)salMalloc(delay->currentSize[0] * 160 * 4);
|
||||
delay->right = (s32*)salMalloc(delay->currentSize[1] * 160 * 4);
|
||||
delay->sur = (s32*)salMalloc(delay->currentSize[2] * 160 * 4);
|
||||
|
||||
/* clang-format off */
|
||||
MUSY_ASSERT(delay->left!=NULL);
|
||||
MUSY_ASSERT(delay->right!=NULL);
|
||||
MUSY_ASSERT(delay->sur!=NULL);
|
||||
/* clang-format on */
|
||||
left = delay->left;
|
||||
right = delay->right;
|
||||
sur = delay->sur;
|
||||
// ASSERT_MSG(delay->left!=NULL);
|
||||
// ASSERT_MSG(delay->right!=NULL);
|
||||
// ASSERT_MSG(delay->sur!=NULL);
|
||||
|
||||
for (i = 0; i < delay->currentSize[0] * 160; ++i) {
|
||||
*left = 0;
|
||||
++left;
|
||||
*left++ = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < delay->currentSize[1] * 160; ++i) {
|
||||
*right = 0;
|
||||
++right;
|
||||
*right++ = 0;
|
||||
}
|
||||
for (i = 0; i < delay->currentSize[2] * 160; ++i) {
|
||||
*sur = 0;
|
||||
++sur;
|
||||
*sur++ = 0;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,12 @@ void sndAuxCallbackReverbHI(u8 reason, SND_AUX_INFO* info, void* user) {
|
||||
ReverbHICallback(info->data.bufferUpdate.left, info->data.bufferUpdate.right,
|
||||
info->data.bufferUpdate.surround, (SND_AUX_REVERBHI*)user);
|
||||
}
|
||||
|
||||
break;
|
||||
case SND_AUX_REASON_PARAMETERUPDATE:
|
||||
break;
|
||||
default:
|
||||
// ASSERT_MSG(FALSE);
|
||||
MUSY_ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+43
-113
@@ -1,4 +1,4 @@
|
||||
#include "musyx/assert.h"
|
||||
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
extern void OSReport(const char*, ...);
|
||||
@@ -6,15 +6,13 @@ extern void OSReport(const char*, ...);
|
||||
extern void DCStoreRange(void* addr, u32 nBytes);
|
||||
|
||||
static volatile const u16 itdOffTab[128] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
|
||||
2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8,
|
||||
9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17,
|
||||
17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25,
|
||||
25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30,
|
||||
31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4,
|
||||
5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16,
|
||||
16, 17, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27,
|
||||
28, 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
};
|
||||
|
||||
SND_PROFILE_INFO prof;
|
||||
//SND_PROFILE_INFO prof;
|
||||
|
||||
u8 salFrame;
|
||||
u8 salAuxFrame;
|
||||
@@ -24,7 +22,7 @@ SND_HOOKS salHooks;
|
||||
u8 salTimeOffset;
|
||||
void hwSetTimeOffset(u8 offset);
|
||||
|
||||
void snd_handle_irq() {
|
||||
static void snd_handle_irq() {
|
||||
u8 r; // r31
|
||||
u8 i; // r30
|
||||
u8 v; // r29
|
||||
@@ -135,13 +133,13 @@ void hwSetTimeOffset(u8 offset) { salTimeOffset = offset; }
|
||||
u8 hwGetTimeOffset() { return salTimeOffset; }
|
||||
|
||||
u32 hwIsActive(u32 v) { return dspVoice[v].state != 0; }
|
||||
u32 hwGlobalActivity() { return 0; }
|
||||
|
||||
void hwSetMesgCallback(SND_MESSAGE_CALLBACK callback) { salMessageCallback = callback; }
|
||||
|
||||
void hwSetPriority(u32 idx, u32 priority) { dspVoice[idx].prio = priority; }
|
||||
|
||||
void hwInitSamplePlayback(u32 v, u16 smpID, void* newsmp, u32 set_defadsr, u32 prio,
|
||||
u32 callbackUserValue, u32 setSRC, u8 itdMode) {
|
||||
void hwInitSamplePlayback(u32 v, u16 smpID, void* newsmp, u32 set_defadsr, u32 prio, u32 callbackUserValue, u32 setSRC, u8 itdMode) {
|
||||
unsigned char i; // r30
|
||||
unsigned long bf; // r29
|
||||
bf = 0;
|
||||
@@ -257,8 +255,7 @@ void hwSetPitch(unsigned long v, unsigned short speed) {
|
||||
speed = 0x3fff;
|
||||
}
|
||||
|
||||
if (dsp_vptr->lastUpdate.pitch != 0xff &&
|
||||
dsp_vptr->pitch[dsp_vptr->lastUpdate.pitch] == speed * 16) {
|
||||
if (dsp_vptr->lastUpdate.pitch != 0xff && dsp_vptr->pitch[dsp_vptr->lastUpdate.pitch] == speed * 16) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -281,7 +278,7 @@ void hwSetPolyPhaseFilter(unsigned long v, unsigned char salCoefSel) {
|
||||
dsp_vptr->changed[0] |= 0x80;
|
||||
}
|
||||
|
||||
void SetupITD(DSPvoice* dsp_vptr, u8 pan) {
|
||||
static void SetupITD(DSPvoice* dsp_vptr, u8 pan) {
|
||||
dsp_vptr->itdShiftL = itdOffTab[pan];
|
||||
dsp_vptr->itdShiftR = 32 - itdOffTab[pan];
|
||||
dsp_vptr->changed[0] |= 0x200;
|
||||
@@ -299,8 +296,7 @@ void hwSetITDMode(u32 v, u8 mode) {
|
||||
|
||||
#define hwGetITDMode(dsp_vptr) (dsp_vptr->flags & 0x80000000)
|
||||
|
||||
void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long pan,
|
||||
unsigned long span, float auxa, float auxb) {
|
||||
void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long pan, unsigned long span, float auxa, float auxb) {
|
||||
SAL_VOLINFO vi; // r1+0x24
|
||||
unsigned short il; // r30
|
||||
unsigned short ir; // r29
|
||||
@@ -325,8 +321,7 @@ void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long
|
||||
ir = 32767.f * vi.volR;
|
||||
is = 32767.f * vi.volS;
|
||||
|
||||
if (dsp_vptr->lastUpdate.vol == 0xff || dsp_vptr->volL != il || dsp_vptr->volR != ir ||
|
||||
dsp_vptr->volS != is) {
|
||||
if (dsp_vptr->lastUpdate.vol == 0xff || dsp_vptr->volL != il || dsp_vptr->volR != ir || dsp_vptr->volS != is) {
|
||||
dsp_vptr->volL = il;
|
||||
dsp_vptr->volR = ir;
|
||||
dsp_vptr->volS = is;
|
||||
@@ -338,8 +333,7 @@ void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long
|
||||
ir = 32767.f * vi.volAuxAR;
|
||||
is = 32767.f * vi.volAuxAS;
|
||||
|
||||
if (dsp_vptr->lastUpdate.volA == 0xff || dsp_vptr->volLa != il || dsp_vptr->volRa != ir ||
|
||||
dsp_vptr->volSa != is) {
|
||||
if (dsp_vptr->lastUpdate.volA == 0xff || dsp_vptr->volLa != il || dsp_vptr->volRa != ir || dsp_vptr->volSa != is) {
|
||||
dsp_vptr->volLa = il;
|
||||
dsp_vptr->volRa = ir;
|
||||
dsp_vptr->volSa = is;
|
||||
@@ -351,8 +345,7 @@ void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long
|
||||
ir = 32767.f * vi.volAuxBR;
|
||||
is = 32767.f * vi.volAuxBS;
|
||||
|
||||
if (dsp_vptr->lastUpdate.volB == 0xff || dsp_vptr->volLb != il || dsp_vptr->volRb != ir ||
|
||||
dsp_vptr->volSb != is) {
|
||||
if (dsp_vptr->lastUpdate.volB == 0xff || dsp_vptr->volLb != il || dsp_vptr->volRb != ir || dsp_vptr->volSb != is) {
|
||||
dsp_vptr->volLb = il;
|
||||
dsp_vptr->volRb = ir;
|
||||
dsp_vptr->volSb = is;
|
||||
@@ -367,31 +360,24 @@ void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long
|
||||
|
||||
void hwOff(s32 vid) { salDeactivateVoice(&dspVoice[vid]); }
|
||||
|
||||
void hwSetAUXProcessingCallbacks(u8 studio, SND_AUX_CALLBACK auxA, void* userA,
|
||||
SND_AUX_CALLBACK auxB, void* userB) {
|
||||
void hwSetAUXProcessingCallbacks(u8 studio, SND_AUX_CALLBACK auxA, void* userA, SND_AUX_CALLBACK auxB, void* userB) {
|
||||
dspStudio[studio].auxAHandler = auxA;
|
||||
dspStudio[studio].auxAUser = userA;
|
||||
dspStudio[studio].auxBHandler = auxB;
|
||||
dspStudio[studio].auxBUser = userB;
|
||||
}
|
||||
|
||||
void hwActivateStudio(unsigned char studio, unsigned long isMaster, SND_STUDIO_TYPE type) {
|
||||
salActivateStudio(studio, isMaster, type);
|
||||
}
|
||||
void hwActivateStudio(unsigned char studio, unsigned long isMaster, SND_STUDIO_TYPE type) { salActivateStudio(studio, isMaster, type); }
|
||||
|
||||
void hwDeactivateStudio(u8 studio) { salDeactivateStudio(studio); }
|
||||
|
||||
void hwChangeStudioMix(u8 studio, u32 isMaster) { dspStudio[studio].isMaster = isMaster; }
|
||||
|
||||
bool hwIsStudioActive(u32 studio) { return dspStudio[studio].state == 1; }
|
||||
bool hwIsStudioActive(u8 studio) { return dspStudio[studio].state == 1; }
|
||||
|
||||
bool hwAddInput(u8 studio, SND_STUDIO_INPUT* in_desc) {
|
||||
return salAddStudioInput(&dspStudio[studio], in_desc);
|
||||
}
|
||||
bool hwAddInput(u8 studio, SND_STUDIO_INPUT* in_desc) { return salAddStudioInput(&dspStudio[studio], in_desc); }
|
||||
|
||||
bool hwRemoveInput(u8 studio, SND_STUDIO_INPUT* in_desc) {
|
||||
return salRemoveStudioInput(&dspStudio[studio], in_desc);
|
||||
}
|
||||
bool hwRemoveInput(u8 studio, SND_STUDIO_INPUT* in_desc) { return salRemoveStudioInput(&dspStudio[studio], in_desc); }
|
||||
|
||||
void hwChangeStudio(u32 v, u8 studio) { salReconnectVoice(&dspVoice[v], studio); }
|
||||
|
||||
@@ -424,84 +410,36 @@ u32 hwGetPos(u32 v) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
#if NONMATCHING
|
||||
void hwFlushStream(void* base, unsigned long offset, unsigned long bytes,
|
||||
unsigned char hwStreamHandle, void (*callback)(unsigned long),
|
||||
void hwFlushStream(void* base, unsigned long offset, unsigned long bytes, unsigned char hwStreamHandle, void (*callback)(unsigned long),
|
||||
unsigned long user) {
|
||||
unsigned long aram; // r28
|
||||
unsigned long mram; // r29
|
||||
unsigned long len;
|
||||
u32 aram; // r28
|
||||
u32 mram; // r29
|
||||
u32 len;
|
||||
aram = aramGetStreamBufferAddress(hwStreamHandle, &len);
|
||||
DCStoreRange((void*)((u32)base + (offset & ~31)), bytes + ((offset & 31) + 31) & ~31);
|
||||
aramUploadData((void*)((u32)base + (offset & ~31)), aram + (offset & ~31),
|
||||
bytes + ((offset & 31) + 31) & ~31, 1, callback, user);
|
||||
bytes += (offset & 31);
|
||||
offset &= ~31;
|
||||
bytes = (bytes + 31) & ~31;
|
||||
mram = (u32)base + offset;
|
||||
DCStoreRange((void*)mram, bytes);
|
||||
aramUploadData((void*)mram, aram + offset, bytes, 1, callback, user);
|
||||
}
|
||||
#else
|
||||
/* clang-format off */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
extern void _savegpr_25();
|
||||
extern void _restgpr_25();
|
||||
asm void hwFlushStream(void* base, unsigned long offset, unsigned long bytes,
|
||||
unsigned char hwStreamHandle, void (*callback)(unsigned long),
|
||||
unsigned long user) {
|
||||
nofralloc
|
||||
stwu r1, -0x30(r1)
|
||||
mflr r0
|
||||
stw r0, 0x34(r1)
|
||||
addi r11, r1, 0x30
|
||||
bl _savegpr_25
|
||||
mr r25, r3
|
||||
mr r29, r4
|
||||
mr r26, r5
|
||||
mr r27, r7
|
||||
mr r28, r8
|
||||
mr r3, r6
|
||||
addi r4, r1, 8
|
||||
bl aramGetStreamBufferAddress
|
||||
clrlwi r0, r29, 0x1b
|
||||
rlwinm r30, r29, 0, 0, 0x1a
|
||||
add r26, r26, r0
|
||||
mr r31, r3
|
||||
addi r0, r26, 0x1f
|
||||
add r29, r25, r30
|
||||
rlwinm r26, r0, 0, 0, 0x1a
|
||||
mr r3, r29
|
||||
mr r4, r26
|
||||
bl DCStoreRange
|
||||
mr r3, r29
|
||||
mr r5, r26
|
||||
mr r7, r27
|
||||
mr r8, r28
|
||||
add r4, r31, r30
|
||||
li r6, 1
|
||||
bl aramUploadData
|
||||
addi r11, r1, 0x30
|
||||
bl _restgpr_25
|
||||
lwz r0, 0x34(r1)
|
||||
mtlr r0
|
||||
addi r1, r1, 0x30
|
||||
blr
|
||||
}
|
||||
#pragma pop
|
||||
/* clang-format on */
|
||||
#endif
|
||||
|
||||
void hwPrepareStreamBuffer() {}
|
||||
u32 hwInitStream(u32 len) { return aramAllocateStreamBuffer(len); }
|
||||
|
||||
void hwExitStream(u8 id) { aramFreeStreamBuffer(id); }
|
||||
|
||||
void* hwGetStreamPlayBuffer(u8 hwStreamHandle) {
|
||||
return (void*)aramGetStreamBufferAddress(hwStreamHandle, NULL);
|
||||
}
|
||||
void* hwGetStreamPlayBuffer(u8 hwStreamHandle) { return (void*)aramGetStreamBufferAddress(hwStreamHandle, NULL); }
|
||||
|
||||
void* hwTransAddr(void* samples) { return samples; }
|
||||
|
||||
u32 hwFrq2Pitch(u32 frq) { return (frq * 4096.f) / synthInfo.mixFrq; }
|
||||
|
||||
void hwInitSampleMem(u32 baseAddr, u32 length) { aramInit(length); }
|
||||
void hwInitSampleMem(u32 baseAddr, u32 length) {
|
||||
#line 940
|
||||
MUSY_ASSERT(baseAddr == 0x00000000);
|
||||
aramInit(length);
|
||||
}
|
||||
|
||||
void hwExitSampleMem() { aramExit(); }
|
||||
|
||||
@@ -519,25 +457,17 @@ static u32 convert_length(u32 len, u8 type) {
|
||||
}
|
||||
|
||||
void hwSaveSample(void* header, void* data) {
|
||||
u32 len;
|
||||
u8 type;
|
||||
|
||||
header = (void*)((u32*)header)[0];
|
||||
header = (void*)((u32*)header)[1];
|
||||
len = (u32)header & 0xFFFFFF;
|
||||
type = (u32)header >> 0x18;
|
||||
*((u32*)data) = (u32)aramStoreData((void*)*((u32*)data), convert_length(len, type));
|
||||
u32 len = ((u32*)*((u32*)header))[1] & 0xFFFFFF;
|
||||
u8 type = ((u32*)*((u32*)header))[1] >> 0x18;
|
||||
len = convert_length(len, type);
|
||||
*((u32*)data) = (u32)aramStoreData((void*)*((u32*)data), len);
|
||||
}
|
||||
|
||||
void hwSetSaveSampleCallback(ARAMUploadCallback callback, unsigned long chunckSize) {
|
||||
aramSetUploadCallback(callback);
|
||||
}
|
||||
void hwSetSaveSampleCallback(ARAMUploadCallback callback, unsigned long chunckSize) { aramSetUploadCallback(callback, chunckSize); }
|
||||
|
||||
void hwRemoveSample(void* header, void* data) {
|
||||
u32 len; // r31
|
||||
u8 type; // r30
|
||||
type = ((u32*)header)[1] >> 0x18;
|
||||
len = convert_length(((u32*)header)[1] & 0xFFFFFF, type);
|
||||
u8 type = (((u32*)header))[1] >> 0x18;
|
||||
u32 len = convert_length((((u32*)header))[1] & 0xFFFFFF, type);
|
||||
aramRemoveData(data, len);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ u32 salExitDsp() {
|
||||
void salStartDsp(u16* cmdList) {
|
||||
salDspIsDone = FALSE;
|
||||
PPCSync();
|
||||
ASSERT(((u32)cmdList & 0x1F)==0);
|
||||
MUSY_ASSERT(((u32)cmdList & 0x1F)==0);
|
||||
DSPSendMailToDSP(dspCmdFirstSize | 0xbabe0000);
|
||||
|
||||
while (DSPCheckMailToDSP())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "musyx/assert.h"
|
||||
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -31,7 +31,7 @@ u32 salInitDspCtrl(u8 numVoices, u8 numStudios, u32 defaultStudioDPL2) {
|
||||
salNumVoices = numVoices;
|
||||
salMaxStudioNum = numStudios;
|
||||
#line 66
|
||||
ASSERT(salMaxStudioNum <= SAL_MAX_STUDIONUM);
|
||||
MUSY_ASSERT(salMaxStudioNum <= SAL_MAX_STUDIONUM);
|
||||
dspARAMZeroBuffer = aramGetZeroBuffer();
|
||||
if ((dspCmdList = salMalloc(1024 * sizeof(u16))) != NULL) {
|
||||
MUSY_DEBUG("Allocated dspCmdList.\n\n");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "musyx/assert.h"
|
||||
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
static GSTACK gs[128];
|
||||
@@ -182,8 +182,8 @@ void sndSetSampleDataUploadCallback(void* (*callback)(unsigned long, unsigned lo
|
||||
u32 sndPushGroup(void* prj_data, u16 gid, void* samples, void* sdir, void* pool) {
|
||||
GROUP_DATA* g; // r31
|
||||
#line 0x18d
|
||||
ASSERT_MSG(prj_data != NULL, "Project data pointer is NULL");
|
||||
ASSERT_MSG(sdir != NULL, "Sample directory pointer is NULL");
|
||||
MUSY_ASSERT_MSG(prj_data != NULL, "Project data pointer is NULL");
|
||||
MUSY_ASSERT_MSG(sdir != NULL, "Sample directory pointer is NULL");
|
||||
|
||||
if (sndActive && sp < 128) {
|
||||
g = prj_data;
|
||||
@@ -232,8 +232,8 @@ unsigned long sndPopGroup() {
|
||||
void* prj;
|
||||
struct FX_DATA* fd;
|
||||
|
||||
ASSERT_MSG(sndActive != FALSE, "Sound system is not initialized.");
|
||||
ASSERT_MSG(sp != 0, "Soundstack is empty.");
|
||||
MUSY_ASSERT_MSG(sndActive != FALSE, "Sound system is not initialized.");
|
||||
MUSY_ASSERT_MSG(sp != 0, "Soundstack is empty.");
|
||||
g = gs[--sp].gAddr;
|
||||
prj = gs[sp].prjAddr;
|
||||
sdir = gs[sp].sdirAddr;
|
||||
@@ -282,7 +282,7 @@ u32 seqPlaySong(u16 sgid, u16 sid, void* arrfile, SND_PLAYPARA* para, u8 irq_cal
|
||||
MIDISETUP* midiSetup;
|
||||
u32 seqId;
|
||||
void* prj;
|
||||
ASSERT_MSG(sndActive != FALSE, "Sound system is not initialized.");
|
||||
MUSY_ASSERT_MSG(sndActive != FALSE, "Sound system is not initialized.");
|
||||
|
||||
for (i = 0; i < sp; ++i) {
|
||||
if (sgid != gs[i].gAddr->id) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "musyx/musyx_priv.h"
|
||||
//#define _DEBUG
|
||||
#include "musyx/assert.h"
|
||||
|
||||
|
||||
s32 DoInit(u32 rate, u32 aramSize, u8 voices, u32 flags) {
|
||||
dataInitStack();
|
||||
@@ -50,8 +50,8 @@ void sndQuit() {
|
||||
}
|
||||
|
||||
void sndSetMaxVoices(u8 music, u8 sfx) {
|
||||
ASSERT_MSG(music > synthInfo.voiceNum, "Music voices are above maximum voice number.");
|
||||
ASSERT_MSG(sfx > synthInfo.voiceNum, "Sfx voices are above maximum voice number.");
|
||||
MUSY_ASSERT_MSG(music > synthInfo.voiceNum, "Music voices are above maximum voice number.");
|
||||
MUSY_ASSERT_MSG(sfx > synthInfo.voiceNum, "Sfx voices are above maximum voice number.");
|
||||
synthInfo.maxMusic = music;
|
||||
synthInfo.maxSFX = sfx;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "musyx/assert.h"
|
||||
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
#define SYNTH_FX_MIDISET 0xFF
|
||||
@@ -29,7 +29,7 @@ void inpResetGlobalMIDIDirtyFlags() {
|
||||
}
|
||||
|
||||
bool inpResetGlobalMIDIDirtyFlag(u8 chan, u8 midiSet, s32 flag) {
|
||||
// ASSERT(midiSet!=SYNTH_FX_MIDISET);
|
||||
// MUSY_ASSERT(midiSet!=SYNTH_FX_MIDISET);
|
||||
bool ret = GetGlobalFlagSet(chan, midiSet, flag);
|
||||
if (ret) {
|
||||
inpGlobalMIDIDirtyFlags[midiSet][chan] &= ~flag;
|
||||
@@ -38,7 +38,7 @@ bool inpResetGlobalMIDIDirtyFlag(u8 chan, u8 midiSet, s32 flag) {
|
||||
}
|
||||
|
||||
void inpSetGlobalMIDIDirtyFlag(u8 chan, u8 midiSet, s32 flag) {
|
||||
// ASSERT(midiSet!=SYNTH_FX_MIDISET);
|
||||
// MUSY_ASSERT(midiSet!=SYNTH_FX_MIDISET);
|
||||
inpGlobalMIDIDirtyFlags[midiSet][chan] |= flag;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "musyx/assert.h"
|
||||
|
||||
#include "musyx/musyx_priv.h"
|
||||
|
||||
static u32 synthTicksPerSecond[9][16];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user