mirror of https://github.com/PrimeDecomp/prime.git
Reorganize MusyX source
This commit is contained in:
parent
83ed13edf2
commit
cbe676015f
64
configure.py
64
configure.py
|
@ -919,41 +919,43 @@ LIBS = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lib": "musyx",
|
"lib": "musyx",
|
||||||
|
#"mw_version": "1.2.5",
|
||||||
|
#"cflags": "-nodefaults -fp hard -O0 -maxerrors 1 -enum int -str reuse -nosyspath -i include -i libc -use_lmw_stmw on -inline off",
|
||||||
"mw_version": "1.3.2",
|
"mw_version": "1.3.2",
|
||||||
"cflags": "$cflags_musyx",
|
"cflags": "$cflags_musyx",
|
||||||
"host": False,
|
"host": False,
|
||||||
"objects": [
|
"objects": [
|
||||||
"musyx/seq",
|
"musyx/runtime/seq",
|
||||||
"musyx/synth",
|
"musyx/runtime/synth",
|
||||||
["musyx/seq_api", True],
|
["musyx/runtime/seq_api", True],
|
||||||
["musyx/snd_synthapi", True, {"add_to_all": False}],
|
["musyx/runtime/snd_synthapi", True, {"add_to_all": False}],
|
||||||
["musyx/stream", False],
|
["musyx/runtime/stream", False],
|
||||||
"musyx/synthdata",
|
"musyx/runtime/synthdata",
|
||||||
"musyx/synthmacros",
|
"musyx/runtime/synthmacros",
|
||||||
"musyx/synthvoice",
|
"musyx/runtime/synthvoice",
|
||||||
["musyx/synth_ac", True],
|
["musyx/runtime/synth_ac", True],
|
||||||
"musyx/synth_adsr",
|
"musyx/runtime/synth_adsr",
|
||||||
["musyx/synth_vsamples", False],
|
["musyx/runtime/synth_vsamples", False],
|
||||||
["musyx/synth_dbtab", True],
|
["musyx/runtime/synth_dbtab", True],
|
||||||
"musyx/s_data",
|
"musyx/runtime/s_data",
|
||||||
["musyx/hw_dspctrl", False],
|
["musyx/runtime/hw_dspctrl", False],
|
||||||
["musyx/hw_volconv", False],
|
["musyx/runtime/hw_volconv", False],
|
||||||
["musyx/snd3d", False],
|
["musyx/runtime/snd3d", False],
|
||||||
["musyx/snd_init", True],
|
["musyx/runtime/snd_init", True],
|
||||||
["musyx/snd_math", True],
|
["musyx/runtime/snd_math", True],
|
||||||
["musyx/snd_midictrl", False],
|
["musyx/runtime/snd_midictrl", False],
|
||||||
["musyx/snd_service", True],
|
["musyx/runtime/snd_service", True],
|
||||||
["musyx/hardware", True],
|
["musyx/runtime/hardware", True],
|
||||||
"musyx/hw_aramdma",
|
"musyx/runtime/hw_aramdma",
|
||||||
["musyx/dsp_import", True],
|
["musyx/runtime/dsp_import", True],
|
||||||
["musyx/hw_dolphin", True],
|
["musyx/runtime/hw_dolphin", True],
|
||||||
["musyx/hw_memory", True],
|
["musyx/runtime/hw_memory", True],
|
||||||
["musyx/creverb_fx", True],
|
["musyx/runtime/CheapReverb/creverb_fx", True],
|
||||||
"musyx/creverb",
|
"musyx/runtime/CheapReverb/creverb",
|
||||||
["musyx/reverb_fx", True],
|
["musyx/runtime/StdReverb/reverb_fx", True],
|
||||||
["musyx/reverb", False],
|
["musyx/runtime/StdReverb/reverb", False],
|
||||||
["musyx/delay_fx", True],
|
["musyx/runtime/Delay/delay_fx", True],
|
||||||
["musyx/chorus_fx", True],
|
["musyx/runtime/Chorus/chorus_fx", True],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,12 +5,12 @@ extern void OSPanic(const char* file, int line, const char* msg, ...);
|
||||||
|
|
||||||
#ifndef ASSERT
|
#ifndef ASSERT
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define ASSERT(cond) \
|
#define ASSERT(cond) \
|
||||||
do { \
|
do { \
|
||||||
if (!cond) { \
|
if (!cond) { \
|
||||||
OSPanic(__FILE__, __LINE__, "Failed assertion " #cond); \
|
OSPanic(__FILE__, __LINE__, "Failed assertion " #cond); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define ASSERT(cond)
|
#define ASSERT(cond)
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,15 +18,23 @@ extern void OSPanic(const char* file, int line, const char* msg, ...);
|
||||||
|
|
||||||
#ifndef ASSERT_MSG
|
#ifndef ASSERT_MSG
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define ASSERT_MSG(cond, msg) \
|
#define ASSERT_MSG(cond, msg) \
|
||||||
do { \
|
do { \
|
||||||
if (!cond) { \
|
if (!cond) { \
|
||||||
OSPanic(__FILE__, __LINE__, msg); \
|
OSPanic(__FILE__, __LINE__, msg); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define ASSERT_MSG(cond, msg)
|
#define ASSERT_MSG(cond, msg)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MUSY_DEBUG
|
||||||
|
#if _DEBUG
|
||||||
|
#define MUSY_DEBUG OSReport
|
||||||
|
#else
|
||||||
|
#define MUSY_DEBUG
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // _MUSYX_ASSERT
|
#endif // _MUSYX_ASSERT
|
||||||
|
|
|
@ -607,7 +607,7 @@ void sndConvertTicks(u32* out, u32 seconds);
|
||||||
u32 sndConvert2Ms(u32 time);
|
u32 sndConvert2Ms(u32 time);
|
||||||
void hwActivateStudio(unsigned char studio, unsigned long isMaster, SND_STUDIO_TYPE type);
|
void hwActivateStudio(unsigned char studio, unsigned long isMaster, SND_STUDIO_TYPE type);
|
||||||
void hwDeactivateStudio(u8);
|
void hwDeactivateStudio(u8);
|
||||||
u32 hwIsActive(s32);
|
u32 hwIsActive(u32);
|
||||||
|
|
||||||
extern SND_HOOKS salHooks;
|
extern SND_HOOKS salHooks;
|
||||||
extern u8 sndActive;
|
extern u8 sndActive;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
#include "musyx/assert.h"
|
||||||
#include "musyx/musyx_priv.h"
|
#include "musyx/musyx_priv.h"
|
||||||
|
|
||||||
|
extern void OSReport(const char*, ...);
|
||||||
|
|
||||||
extern void DCStoreRange(void* addr, u32 nBytes);
|
extern void DCStoreRange(void* addr, u32 nBytes);
|
||||||
|
|
||||||
static volatile const u16 itdOffTab[128] = {
|
static volatile const u16 itdOffTab[128] = {
|
||||||
|
@ -65,29 +68,30 @@ void snd_handle_irq() {
|
||||||
hwIRQLeaveCritical();
|
hwIRQLeaveCritical();
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 hwInit(u32 * frq, u16 numVoices, u16 numStudios, u32 flags) {
|
s32 hwInit(u32* frq, u16 numVoices, u16 numStudios, u32 flags) {
|
||||||
|
MUSY_DEBUG("Entering hwInit()\n\n");
|
||||||
hwInitIrq();
|
hwInitIrq();
|
||||||
salFrame = 0;
|
salFrame = 0;
|
||||||
salAuxFrame = 0;
|
salAuxFrame = 0;
|
||||||
salMessageCallback = NULL;
|
salMessageCallback = NULL;
|
||||||
if (salInitAi(snd_handle_irq, flags, frq) == 0) {
|
if (salInitAi(snd_handle_irq, flags, frq) != 0) {
|
||||||
// OSReport("Could not initialize AI.\n");
|
MUSY_DEBUG("salInitAi() is done.\n\n");
|
||||||
} else {
|
if (salInitDspCtrl(numVoices, numStudios, (flags & 1) != 0) != 0) {
|
||||||
// OSReport("salInitAi() is done.\n\n");
|
MUSY_DEBUG("salInitDspCtrl() is done.\n\n");
|
||||||
if (salInitDspCtrl(numVoices, numStudios, (flags & 1) != 0) == 0) {
|
|
||||||
// OSReport("Could not initialize DSP control logic.\n");
|
|
||||||
} else {
|
|
||||||
// OSReport("salInitDspCtrl() is done.\n\n");
|
|
||||||
if (salInitDsp(flags)) {
|
if (salInitDsp(flags)) {
|
||||||
// OSReport("salInitDsp() is done.\n\n");
|
MUSY_DEBUG("salInitDsp() is done.\n\n");
|
||||||
hwEnableIrq();
|
hwEnableIrq();
|
||||||
// OSReport("Starting AI DMA...\n\n");
|
MUSY_DEBUG("Starting AI DMA...\n\n");
|
||||||
salStartAi();
|
salStartAi();
|
||||||
// OSReport("hwInit() done.\n\n");
|
MUSY_DEBUG("hwInit() done.\n\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// OSReport("Could not initialize DSP.\n");
|
MUSY_DEBUG("Could not initialize DSP.\n");
|
||||||
|
} else {
|
||||||
|
MUSY_DEBUG("Could not initialize DSP control logic.\n");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MUSY_DEBUG("Could not initialize AI.\n");
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -105,7 +109,7 @@ void hwSetTimeOffset(u8 offset) { salTimeOffset = offset; }
|
||||||
|
|
||||||
u8 hwGetTimeOffset() { return salTimeOffset; }
|
u8 hwGetTimeOffset() { return salTimeOffset; }
|
||||||
|
|
||||||
u32 hwIsActive(s32 idx) { return dspVoice[idx].state != 0; }
|
u32 hwIsActive(u32 v) { return dspVoice[v].state != 0; }
|
||||||
|
|
||||||
void hwSetMesgCallback(SND_MESSAGE_CALLBACK callback) { salMessageCallback = callback; }
|
void hwSetMesgCallback(SND_MESSAGE_CALLBACK callback) { salMessageCallback = callback; }
|
||||||
|
|
||||||
|
@ -292,9 +296,12 @@ void hwSetITDMode(u32 v, u8 mode) {
|
||||||
dspVoice[v].flags &= ~0x80000000;
|
dspVoice[v].flags &= ~0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define hwGetITDMode(dsp_vptr) (dsp_vptr->flags & 0x80000000)
|
||||||
|
|
||||||
void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long pan,
|
void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long pan,
|
||||||
unsigned long span, float auxa, float auxb) {
|
unsigned long span, float auxa, float auxb) {
|
||||||
struct SAL_VOLINFO vi; // r1+0x24
|
SAL_VOLINFO vi; // r1+0x24
|
||||||
unsigned short il; // r30
|
unsigned short il; // r30
|
||||||
unsigned short ir; // r29
|
unsigned short ir; // r29
|
||||||
unsigned short is; // r28
|
unsigned short is; // r28
|
||||||
|
@ -353,8 +360,8 @@ void hwSetVolume(unsigned long v, unsigned char table, float vol, unsigned long
|
||||||
dsp_vptr->lastUpdate.volB = 0;
|
dsp_vptr->lastUpdate.volB = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dsp_vptr->flags & 0x80000000) {
|
if (hwGetITDMode(dsp_vptr)) {
|
||||||
SetupITD(dsp_vptr, pan >> 16);
|
SetupITD(dsp_vptr, (pan >> 16) & 0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,7 +545,7 @@ void hwDisableHRTF() { dspHRTFOn = FALSE; }
|
||||||
|
|
||||||
u32 hwGetVirtualSampleID(u32 v) {
|
u32 hwGetVirtualSampleID(u32 v) {
|
||||||
if (dspVoice[v].state == 0) {
|
if (dspVoice[v].state == 0) {
|
||||||
return ~0;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dspVoice[v].virtualSampleID;
|
return dspVoice[v].virtualSampleID;
|
Loading…
Reference in New Issue