diff --git a/configure.py b/configure.py index 31888c80..4e3075ed 100755 --- a/configure.py +++ b/configure.py @@ -921,8 +921,8 @@ LIBS = [ "lib": "musyx", ### MusyX 1.5.3 (debug) - # "mw_version": "1.2.5", - # "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.2.5", + #"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", ### MusyX 2.0.3 (debug) # "mw_version": "1.3.2", diff --git a/src/musyx/runtime/snd3d.c b/src/musyx/runtime/snd3d.c index 2019b6f3..f1912f6e 100644 --- a/src/musyx/runtime/snd3d.c +++ b/src/musyx/runtime/snd3d.c @@ -1,15 +1,16 @@ #include "musyx/musyx_priv.h" #include "musyx/synth.h" -u8 s3dCallCnt; -SND_DOOR* s3dDoorRoot; -SND_EMITTER* s3dEmitterRoot; -SND_LISTENER* s3dListenerRoot; -SND_ROOM* s3dRoomRoot; -u8 s3dUseMaxVoices; -u8 snd_base_studio; -u8 snd_max_studios; -u32 snd_used_studios; +static u8 s3dCallCnt; +static SND_EMITTER* s3dEmitterRoot; +static SND_LISTENER* s3dListenerRoot; +static SND_ROOM* s3dRoomRoot; +static SND_DOOR* s3dDoorRoot; +static u32 snd_used_studios; +static u8 snd_base_studio; +static u8 snd_max_studios; +static u8 s3dUseMaxVoices; + static void UpdateRoomDistances() { SND_ROOM* r; // r30 @@ -840,14 +841,32 @@ void sndSetup3DStudios(unsigned char first, unsigned char num) { snd_max_studios = num; } -void sndGet3DParameters(SND_3DINFO* info, SND_FVECTOR* pos, SND_FVECTOR* dir, float maxDis, - float comp, unsigned char maxVol, unsigned char minVol, - struct SND_ROOM* room) { +void sndGet3DParameters(SND_3DINFO* info, SND_FVECTOR* pos, SND_FVECTOR* dir, f32 maxDis, f32 comp, + u8 maxVol, u8 minVol, SND_ROOM* room) { float xPan; // r1+0x34 float yPan; // r1+0x30 float zPan; // r1+0x2C float cvol; // r1+0x28 float pitch; // r1+0x24 + static SND_EMITTER em; + hwDisableIrq(); + + em.flags = 8; + em.pos = *pos; + em.dir = *dir; + em.maxDis = maxDis; + em.maxVol = maxVol / 127.f; + em.minVol = minVol / 127.f; + em.volPush = comp; + em.room = room; + + CalcEmitter(&em, &cvol, &pitch, &xPan, &yPan, &zPan); + info->vol = clip127(cvol * 127.f); + info->pan = clip127((xPan + 1.f) * 64.f); + info->span = clip127((1.f - zPan) * 64.f); + info->doppler = clip3FFF(pitch * 8192.f); + + hwEnableIrq(); } void s3dInit(u32 flags) { diff --git a/src/musyx/runtime/snd_midictrl.c b/src/musyx/runtime/snd_midictrl.c index dcc350a0..db84ffee 100644 --- a/src/musyx/runtime/snd_midictrl.c +++ b/src/musyx/runtime/snd_midictrl.c @@ -387,7 +387,6 @@ u8 inpGetMidiLastNote(u8 midi, u8 midiSet) { return fx_lastNote[midi]; } -#pragma dont_inline on static u16 _GetInputValue(SYNTH_VOICE* svoice, CTRL_DEST* inp, u8 midi, u8 midiSet) { u32 i; // r26 u32 value; // r29 @@ -447,8 +446,6 @@ static u16 _GetInputValue(SYNTH_VOICE* svoice, CTRL_DEST* inp, u8 midi, u8 midiS return value; } -#pragma dont_inline reset - static u16 GetInputValue(SYNTH_VOICE* svoice, CTRL_DEST* inp, u32 dirtyMask) { if (!(svoice->midiDirtyFlags & dirtyMask)) { @@ -501,13 +498,12 @@ u16 inpGetTremolo(SYNTH_VOICE* svoice) { return GetInputValue(svoice, &svoice->inpTremolo, 0x1000); } -u16 inpGetAuxB(u8 studio, u8 index, u8 midi, u8 midiSet) { +u16 inpGetAuxA(u8 studio, u8 index, u8 midi, u8 midiSet) { static u32 dirtyMask[4] = {0x80000001, 0x80000002, 0x80000004, 0x80000008}; - return GetGlobalInputValue(&inpAuxA[studio][index], dirtyMask[index], midi, midiSet); } -u16 inpGetAuxA(u8 studio, u8 index, u8 midi, u8 midiSet) { +u16 inpGetAuxB(u8 studio, u8 index, u8 midi, u8 midiSet) { static u32 dirtyMask[4] = {0x80000010, 0x80000020, 0x80000040, 0x80000080}; return GetGlobalInputValue(&inpAuxB[studio][index], dirtyMask[index], midi, midiSet);