Reorganize MusyX source

This commit is contained in:
Phillip Stephens 2023-02-22 23:04:07 -08:00
parent 83ed13edf2
commit cbe676015f
56 changed files with 79 additions and 62 deletions

View File

@ -919,41 +919,43 @@ LIBS = [
},
{
"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",
"cflags": "$cflags_musyx",
"host": False,
"objects": [
"musyx/seq",
"musyx/synth",
["musyx/seq_api", True],
["musyx/snd_synthapi", True, {"add_to_all": False}],
["musyx/stream", False],
"musyx/synthdata",
"musyx/synthmacros",
"musyx/synthvoice",
["musyx/synth_ac", True],
"musyx/synth_adsr",
["musyx/synth_vsamples", False],
["musyx/synth_dbtab", True],
"musyx/s_data",
["musyx/hw_dspctrl", False],
["musyx/hw_volconv", False],
["musyx/snd3d", False],
["musyx/snd_init", True],
["musyx/snd_math", True],
["musyx/snd_midictrl", False],
["musyx/snd_service", True],
["musyx/hardware", True],
"musyx/hw_aramdma",
["musyx/dsp_import", True],
["musyx/hw_dolphin", True],
["musyx/hw_memory", True],
["musyx/creverb_fx", True],
"musyx/creverb",
["musyx/reverb_fx", True],
["musyx/reverb", False],
["musyx/delay_fx", True],
["musyx/chorus_fx", True],
"musyx/runtime/seq",
"musyx/runtime/synth",
["musyx/runtime/seq_api", True],
["musyx/runtime/snd_synthapi", True, {"add_to_all": False}],
["musyx/runtime/stream", False],
"musyx/runtime/synthdata",
"musyx/runtime/synthmacros",
"musyx/runtime/synthvoice",
["musyx/runtime/synth_ac", True],
"musyx/runtime/synth_adsr",
["musyx/runtime/synth_vsamples", False],
["musyx/runtime/synth_dbtab", True],
"musyx/runtime/s_data",
["musyx/runtime/hw_dspctrl", False],
["musyx/runtime/hw_volconv", False],
["musyx/runtime/snd3d", False],
["musyx/runtime/snd_init", True],
["musyx/runtime/snd_math", True],
["musyx/runtime/snd_midictrl", False],
["musyx/runtime/snd_service", True],
["musyx/runtime/hardware", True],
"musyx/runtime/hw_aramdma",
["musyx/runtime/dsp_import", True],
["musyx/runtime/hw_dolphin", True],
["musyx/runtime/hw_memory", True],
["musyx/runtime/CheapReverb/creverb_fx", True],
"musyx/runtime/CheapReverb/creverb",
["musyx/runtime/StdReverb/reverb_fx", True],
["musyx/runtime/StdReverb/reverb", False],
["musyx/runtime/Delay/delay_fx", True],
["musyx/runtime/Chorus/chorus_fx", True],
],
},
{

View File

@ -29,4 +29,12 @@ extern void OSPanic(const char* file, int line, const char* msg, ...);
#endif
#endif
#ifndef MUSY_DEBUG
#if _DEBUG
#define MUSY_DEBUG OSReport
#else
#define MUSY_DEBUG
#endif
#endif
#endif // _MUSYX_ASSERT

View File

@ -607,7 +607,7 @@ void sndConvertTicks(u32* out, u32 seconds);
u32 sndConvert2Ms(u32 time);
void hwActivateStudio(unsigned char studio, unsigned long isMaster, SND_STUDIO_TYPE type);
void hwDeactivateStudio(u8);
u32 hwIsActive(s32);
u32 hwIsActive(u32);
extern SND_HOOKS salHooks;
extern u8 sndActive;

View File

@ -1,5 +1,8 @@
#include "musyx/assert.h"
#include "musyx/musyx_priv.h"
extern void OSReport(const char*, ...);
extern void DCStoreRange(void* addr, u32 nBytes);
static volatile const u16 itdOffTab[128] = {
@ -66,28 +69,29 @@ void snd_handle_irq() {
}
s32 hwInit(u32* frq, u16 numVoices, u16 numStudios, u32 flags) {
MUSY_DEBUG("Entering hwInit()\n\n");
hwInitIrq();
salFrame = 0;
salAuxFrame = 0;
salMessageCallback = NULL;
if (salInitAi(snd_handle_irq, flags, frq) == 0) {
// OSReport("Could not initialize AI.\n");
} else {
// OSReport("salInitAi() 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 (salInitAi(snd_handle_irq, flags, frq) != 0) {
MUSY_DEBUG("salInitAi() is done.\n\n");
if (salInitDspCtrl(numVoices, numStudios, (flags & 1) != 0) != 0) {
MUSY_DEBUG("salInitDspCtrl() is done.\n\n");
if (salInitDsp(flags)) {
// OSReport("salInitDsp() is done.\n\n");
MUSY_DEBUG("salInitDsp() is done.\n\n");
hwEnableIrq();
// OSReport("Starting AI DMA...\n\n");
MUSY_DEBUG("Starting AI DMA...\n\n");
salStartAi();
// OSReport("hwInit() done.\n\n");
MUSY_DEBUG("hwInit() done.\n\n");
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;
}
@ -105,7 +109,7 @@ void hwSetTimeOffset(u8 offset) { salTimeOffset = offset; }
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; }
@ -292,9 +296,12 @@ void hwSetITDMode(u32 v, u8 mode) {
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,
unsigned long span, float auxa, float auxb) {
struct SAL_VOLINFO vi; // r1+0x24
SAL_VOLINFO vi; // r1+0x24
unsigned short il; // r30
unsigned short ir; // r29
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;
}
if (dsp_vptr->flags & 0x80000000) {
SetupITD(dsp_vptr, pan >> 16);
if (hwGetITDMode(dsp_vptr)) {
SetupITD(dsp_vptr, (pan >> 16) & 0xFF);
}
}
@ -538,7 +545,7 @@ void hwDisableHRTF() { dspHRTFOn = FALSE; }
u32 hwGetVirtualSampleID(u32 v) {
if (dspVoice[v].state == 0) {
return ~0;
return 0xFFFFFFFF;
}
return dspVoice[v].virtualSampleID;