2020-10-03 15:22:44 +00:00
|
|
|
#include "ultra64.h"
|
|
|
|
#include "global.h"
|
2020-07-20 01:08:50 +00:00
|
|
|
|
2021-09-07 17:50:50 +00:00
|
|
|
// TODO: can these macros be shared between files? code_800F9280 seems to use
|
|
|
|
// versions without any casts...
|
2021-11-07 16:58:50 +00:00
|
|
|
#define Audio_DisableSeq(playerIdx, fadeOut) Audio_QueueCmdS32(0x83000000 | ((u8)playerIdx << 16), fadeOut)
|
|
|
|
#define Audio_StartSeq(playerIdx, fadeTimer, seqId) \
|
|
|
|
Audio_QueueSeqCmd(0x00000000 | ((u8)playerIdx << 24) | ((u8)(fadeTimer) << 0x10) | (u16)seqId)
|
|
|
|
#define Audio_SeqCmd7(playerIdx, a, b) \
|
|
|
|
Audio_QueueSeqCmd(0x70000000 | ((u8)playerIdx << 0x18) | ((u8)a << 0x10) | (u8)(b))
|
|
|
|
#define Audio_SeqCmdC(playerIdx, a, b, c) \
|
|
|
|
Audio_QueueSeqCmd(0xC0000000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b << 8) | ((u8)(c)))
|
|
|
|
#define Audio_SeqCmdA(playerIdx, a) Audio_QueueSeqCmd(0xA0000000 | ((u8)playerIdx << 24) | ((u16)(a)))
|
|
|
|
#define Audio_SeqCmd1(playerIdx, a) Audio_QueueSeqCmd(0x100000FF | ((u8)playerIdx << 24) | ((u8)(a) << 16))
|
|
|
|
#define Audio_SeqCmdB(playerIdx, a, b, c) \
|
|
|
|
Audio_QueueSeqCmd(0xB0000000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b << 8) | ((u8)c))
|
|
|
|
#define Audio_SeqCmdB40(playerIdx, a, b) Audio_QueueSeqCmd(0xB0004000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b))
|
|
|
|
#define Audio_SeqCmd6(playerIdx, a, b, c) \
|
|
|
|
Audio_QueueSeqCmd(0x60000000 | ((u8)playerIdx << 24) | ((u8)(a) << 16) | ((u8)b << 8) | ((u8)c))
|
|
|
|
#define Audio_SeqCmdE0(playerIdx, a) Audio_QueueSeqCmd(0xE0000000 | ((u8)playerIdx << 24) | ((u8)a))
|
|
|
|
#define Audio_SeqCmdE01(playerIdx, a) Audio_QueueSeqCmd(0xE0000100 | ((u8)playerIdx << 24) | ((u16)a))
|
|
|
|
#define Audio_SeqCmd8(playerIdx, a, b, c) \
|
|
|
|
Audio_QueueSeqCmd(0x80000000 | ((u8)playerIdx << 24) | ((u8)a << 16) | ((u8)b << 8) | ((u8)c))
|
|
|
|
#define Audio_SeqCmdF(playerIdx, a) Audio_QueueSeqCmd(0xF0000000 | ((u8)playerIdx << 24) | ((u8)a))
|
2021-09-07 17:50:50 +00:00
|
|
|
|
2021-07-27 23:44:58 +00:00
|
|
|
typedef struct {
|
2021-11-07 16:58:50 +00:00
|
|
|
/* 0x0 */ f32 vol;
|
2021-09-01 22:33:37 +00:00
|
|
|
/* 0x4 */ f32 freqScale;
|
|
|
|
/* 0x8 */ s8 reverb;
|
|
|
|
/* 0x9 */ s8 panSigned;
|
|
|
|
/* 0xA */ s8 stereoBits;
|
2021-11-07 16:58:50 +00:00
|
|
|
/* 0xB */ u8 filter;
|
2021-09-01 22:33:37 +00:00
|
|
|
/* 0xC */ u8 unk_0C;
|
2021-11-07 16:58:50 +00:00
|
|
|
} SfxPlayerState;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2021-09-01 22:33:37 +00:00
|
|
|
/* 0x0 */ f32 value;
|
|
|
|
/* 0x4 */ f32 target;
|
|
|
|
/* 0x8 */ f32 step;
|
|
|
|
/* 0xC */ s32 remainingFrames;
|
2021-08-30 00:08:41 +00:00
|
|
|
} FreqLerp;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-12 19:37:37 +00:00
|
|
|
typedef struct {
|
2021-09-07 17:50:50 +00:00
|
|
|
/* 0x0 */ u16 unk_00;
|
|
|
|
/* 0x2 */ u16 unk_02;
|
|
|
|
/* 0x4 */ u8 unk_04[100];
|
2021-08-12 19:37:37 +00:00
|
|
|
} D_801306DC_s; // size = 0x68
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
typedef enum {
|
|
|
|
/* 0x0 */ PAGE_NON,
|
|
|
|
/* 0x1 */ PAGE_SOUND_CONTROL,
|
|
|
|
/* 0x2 */ PAGE_SPEC_INFO, // unused
|
|
|
|
/* 0x3 */ PAGE_HEAP_INFO,
|
|
|
|
/* 0x4 */ PAGE_GROUP_TRACK_INFO, // unused
|
|
|
|
/* 0x5 */ PAGE_SUB_TRACK_INFO,
|
|
|
|
/* 0x6 */ PAGE_CHANNEL_INFO, // unused
|
|
|
|
/* 0x7 */ PAGE_INTERFACE_INFO,
|
2021-11-07 16:58:50 +00:00
|
|
|
/* 0x8 */ PAGE_SFX_SWAP,
|
2021-08-30 00:08:41 +00:00
|
|
|
/* 0x9 */ PAGE_BLOCK_CHANGE_BGM,
|
|
|
|
/* 0xA */ PAGE_NATURAL_SOUND_CONTROL, // unused
|
|
|
|
/* 0xB */ PAGE_OCARINA_TEST,
|
2021-11-07 16:58:50 +00:00
|
|
|
/* 0xC */ PAGE_SFX_PARAMETER_CHANGE,
|
2021-08-30 00:08:41 +00:00
|
|
|
/* 0xD */ PAGE_SCROLL_PRINT,
|
|
|
|
/* 0xE */ PAGE_FREE_AREA,
|
|
|
|
/* 0xF */ PAGE_MAX
|
|
|
|
} AudioDebugPage;
|
|
|
|
|
2021-07-27 23:44:58 +00:00
|
|
|
/** bit field of songs that can be played
|
|
|
|
* 0x0800 storms
|
|
|
|
* 0x0400 song of time
|
|
|
|
* 0x0200 suns
|
|
|
|
* 0x0100 lullaby
|
|
|
|
* 0x0080 epona
|
|
|
|
* 0x0040 sarias
|
|
|
|
* 0x0020 prelude
|
|
|
|
* 0x0010 nocturne
|
|
|
|
* 0x0008 requiem
|
|
|
|
* 0x0004 serenade
|
|
|
|
* 0x0002 bolero
|
|
|
|
* 0x0001 minuet
|
|
|
|
*/
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
#define SCROLL_PRINT_BUF_SIZE 25
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
#define OCA_SONGS_SCARECROW 12
|
|
|
|
#define OCA_SONGS_MEMORYGAME 13
|
|
|
|
|
|
|
|
#define SFX_PLAYER_CHANNEL_OCARINA 13
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
extern f32 D_8012F6B4[]; // from audio_synthesis
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 gIsLargeSoundBank[7] = { 0, 0, 0, 1, 0, 0, 0 };
|
|
|
|
|
|
|
|
// Only the first row of these is supported by sequence 0. (gSfxChannelLayout is always 0.)
|
|
|
|
u8 gChannelsPerBank[4][7] = {
|
2021-09-01 22:33:37 +00:00
|
|
|
{ 3, 2, 3, 3, 2, 1, 2 },
|
|
|
|
{ 3, 2, 2, 2, 2, 2, 2 },
|
|
|
|
{ 3, 2, 2, 2, 2, 2, 2 },
|
|
|
|
{ 4, 1, 0, 0, 2, 2, 2 },
|
|
|
|
};
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 gUsedChannelsPerBank[4][7] = {
|
2021-09-01 22:33:37 +00:00
|
|
|
{ 3, 2, 3, 2, 2, 1, 1 },
|
|
|
|
{ 3, 1, 1, 1, 2, 1, 1 },
|
|
|
|
{ 3, 1, 1, 1, 2, 1, 1 },
|
|
|
|
{ 2, 1, 0, 0, 1, 1, 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
f32 D_801305B0 = 0.7950898f;
|
|
|
|
s8 D_801305B4 = 35;
|
|
|
|
s8 D_801305B8 = 20;
|
|
|
|
s8 D_801305BC = 30;
|
|
|
|
s8 D_801305C0 = 20;
|
2021-11-07 16:58:50 +00:00
|
|
|
f32 sBehindScreenZ[2] = { -15.0f, -65.0f };
|
2021-09-01 22:33:37 +00:00
|
|
|
u8 sAudioIncreasingTranspose = 0;
|
|
|
|
u8 gMorphaTransposeTable[16] = { 0, 0, 0, 1, 1, 2, 4, 6, 8, 8, 8, 8, 8, 8, 8, 8 };
|
|
|
|
u8 sPrevChargeLevel = 0;
|
|
|
|
f32 D_801305E4[4] = { 1.0f, 1.12246f, 1.33484f, 1.33484f }; // 2**({0, 2, 5, 5}/12)
|
|
|
|
f32 D_801305F4 = 1.0f;
|
|
|
|
u8 D_801305F8[8] = { 127, 80, 75, 73, 70, 68, 65, 60 };
|
|
|
|
u8 D_80130600 = 0;
|
|
|
|
s8 D_80130604 = 2;
|
|
|
|
s8 D_80130608 = 0;
|
|
|
|
s8 sAudioCutsceneFlag = 0;
|
|
|
|
s8 sSpecReverb = 0;
|
|
|
|
s8 sAudioEnvReverb = 0;
|
|
|
|
s8 sAudioCodeReverb = 0;
|
|
|
|
u8 D_8013061C = 0;
|
|
|
|
f32 sAudioEnemyDist = 0.0f;
|
|
|
|
s8 sAudioEnemyVol = 127;
|
2021-11-01 17:54:19 +00:00
|
|
|
u16 D_80130628 = NA_BGM_DISABLED;
|
2021-09-01 22:33:37 +00:00
|
|
|
u8 D_8013062C = 0;
|
2021-11-01 17:54:19 +00:00
|
|
|
u8 D_80130630 = NA_BGM_GENERAL_SFX;
|
2021-09-01 22:33:37 +00:00
|
|
|
u32 D_80130634 = 0;
|
|
|
|
u32 D_80130638 = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 sAudioBaseFilter = 0;
|
|
|
|
u8 sAudioExtraFilter = 0;
|
|
|
|
u8 sAudioBaseFilter2 = 0;
|
|
|
|
u8 sAudioExtraFilter2 = 0;
|
2021-09-01 22:33:37 +00:00
|
|
|
Vec3f* sSariaBgmPtr = NULL;
|
|
|
|
f32 D_80130650 = 2000.0f;
|
|
|
|
u8 D_80130654 = 0;
|
|
|
|
u8 D_80130658[0x70] = {
|
|
|
|
2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 16, 0, 136,
|
|
|
|
1, 0, 0, 32, 0, 0, 2, 4, 2, 2, 1, 16, 0, 0, 1, 2, 1, 0, 128, 0, 128, 0, 2, 2, 2, 2, 2, 2,
|
|
|
|
136, 2, 0, 2, 17, 2, 1, 1, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 32, 0, 16, 2, 0, 0,
|
|
|
|
4, 32, 64, 64, 1, 2, 2, 1, 1, 2, 0, 17, 0, 0, 128, 0, 128, 128, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0,
|
|
|
|
};
|
|
|
|
s8 sSpecReverbs[20] = { 0, 0, 0, 0, 0, 0, 0, 40, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
D_801306DC_s D_801306DC[20] = {
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC0FF, 0XC0FE, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3,
|
2021-09-01 22:33:37 +00:00
|
|
|
0, 2, 4, 1, 2, 5, 16, 3, 2, 10, 3, 3, 112, 3, 4, 1, 3, 5, 48, 4, 2, 14, 4,
|
|
|
|
3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, 6, 2, 1,
|
|
|
|
6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } },
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC0FB, 0xC0FA, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1,
|
2021-09-01 22:33:37 +00:00
|
|
|
3, 5, 48, 4, 2, 14, 4, 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16,
|
|
|
|
6, 2, 1, 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } },
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC001, 0x4000, { 0, 2, 0, 0, 3, 0, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } },
|
|
|
|
{ 0xC005, 0x4000, { 0, 2, 1, 0, 3, 32, 2, 2, 11, 2, 3, 48, 2, 4, 1, 2, 5, 32, 0xFF } },
|
|
|
|
{ 0xC01F,
|
|
|
|
0xC000,
|
2021-09-01 22:33:37 +00:00
|
|
|
{ 0, 2, 0, 0, 3, 47, 1, 2, 13, 1, 3, 0, 1, 4, 1, 1, 5, 16, 2, 2, 16, 2, 3, 0, 2, 4, 1, 2,
|
|
|
|
5, 32, 3, 2, 14, 3, 3, 0, 3, 4, 0, 3, 5, 44, 4, 2, 11, 4, 3, 63, 4, 4, 1, 4, 5, 44, 0xFF } },
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC0FB, 0xC0FA, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 3, 2, 11, 3, 3, 112, 3, 4, 1,
|
2021-09-01 22:33:37 +00:00
|
|
|
3, 5, 48, 4, 2, 14, 4, 3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16,
|
|
|
|
6, 2, 1, 6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } },
|
|
|
|
{ 0x8001, 0x0, { 0, 2, 1, 0, 3, 32, 0xFF } },
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC001, 0xC000, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 0xFF } },
|
|
|
|
{ 0xC02F, 0xC02E, { 0, 2, 2, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5,
|
2021-09-01 22:33:37 +00:00
|
|
|
32, 2, 2, 15, 2, 3, 112, 2, 4, 1, 2, 5, 48, 3, 2, 14, 3, 3, 127, 3,
|
|
|
|
4, 0, 3, 5, 16, 5, 2, 4, 5, 3, 127, 5, 4, 0, 5, 5, 16, 0xFF } },
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC07F, 0xC07E, { 0, 2, 0, 0, 3, 0, 0, 4, 0, 1, 2, 10, 1, 3, 64, 1, 4, 0, 1, 5, 32,
|
2021-09-01 22:33:37 +00:00
|
|
|
2, 2, 11, 2, 3, 112, 2, 4, 1, 2, 5, 48, 3, 2, 12, 3, 3, 127, 3, 4, 0,
|
|
|
|
3, 5, 16, 4, 2, 6, 4, 3, 0, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 0,
|
|
|
|
5, 4, 0, 5, 5, 16, 6, 2, 1, 6, 3, 0, 6, 4, 0, 6, 5, 16, 0xFF } },
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC01F, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 0, 1, 3, 80, 1, 4, 1, 1, 5, 8, 2, 2, 10, 2, 3, 80, 2, 4, 1, 2,
|
2021-09-01 22:33:37 +00:00
|
|
|
5, 48, 3, 2, 6, 3, 3, 0, 3, 4, 0, 3, 5, 0, 4, 2, 11, 4, 3, 96, 4, 4, 0, 4, 5, 32, 0xFF } },
|
2021-10-03 03:17:09 +00:00
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
|
|
|
{ 0xC003, 0xC000, { 0, 2, 0, 0, 3, 0, 1, 2, 4, 1, 3, 0, 1, 4, 1, 1, 5, 16, 0xFF } },
|
2021-09-01 22:33:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
u32 sOcarinaAllowedBtnMask = 0x800F;
|
|
|
|
s32 sOcarinaABtnMap = 0x8000;
|
|
|
|
s32 sOcarinaCUPBtnMap = 8;
|
|
|
|
s32 sOcarinaCDownBtnMap = 4;
|
|
|
|
u8 sOcarinaInpEnabled = 0;
|
|
|
|
s8 D_80130F10 = 0; // "OCA", ocarina active?
|
|
|
|
u8 sCurOcarinaBtnVal = 0xFF;
|
|
|
|
u8 sPrevOcarinaNoteVal = 0;
|
|
|
|
u8 sCurOcarinaBtnIdx = 0; // note index?
|
|
|
|
u8 sLearnSongLastBtn = 0;
|
|
|
|
f32 D_80130F24 = 1.0f;
|
2021-11-01 23:29:47 +00:00
|
|
|
f32 D_80130F28 = 87.0f / 127.0f;
|
2021-09-01 22:33:37 +00:00
|
|
|
s8 D_80130F2C = 0; // pitch?
|
|
|
|
s8 D_80130F30 = 0x57;
|
|
|
|
s8 D_80130F34 = 0;
|
|
|
|
u8 sPlaybackState = 0; // 80130F38
|
|
|
|
u32 D_80130F3C = 0; // "SEQ"
|
|
|
|
u32 sNotePlaybackTimer = 0;
|
|
|
|
u16 sPlaybackNotePos = 0;
|
|
|
|
u16 sStaffPlaybackPos = 0;
|
|
|
|
u16 D_80130F4C = 0;
|
|
|
|
u8 sDisplayedNoteValue = 0xFF; // Note to display on screen?
|
|
|
|
u8 sNotePlaybackVolume = 0;
|
|
|
|
u8 sNotePlaybackVibrato = 0;
|
|
|
|
s8 sNotePlaybackTone = 0;
|
|
|
|
f32 sNormalizedNotePlaybackTone = 1.0f;
|
|
|
|
f32 sNormalizedNotePlaybackVolume = 1.0f;
|
|
|
|
s32 D_80130F68 = 0;
|
|
|
|
u8 sOcarinaNoteValues[5] = { 2, 5, 9, 11, 14 };
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 sOcaMinigameAppendPos = 0;
|
2021-09-01 22:33:37 +00:00
|
|
|
u8 sOcaMinigameEndPos = 0;
|
|
|
|
u8 sOcaMinigameNoteCnts[] = { 5, 6, 8 };
|
|
|
|
|
|
|
|
OcarinaNote sOcarinaSongs[14][20] = {
|
|
|
|
// minuet
|
|
|
|
{
|
|
|
|
{ 2, 0, 18, 86, 0, 0, 0 },
|
|
|
|
{ 14, 0, 18, 92, 0, 0, 0 },
|
|
|
|
{ 11, 0, 72, 86, 0, 0, 0 },
|
|
|
|
{ 9, 0, 18, 80, 0, 0, 0 },
|
|
|
|
{ 11, 0, 18, 88, 0, 0, 0 },
|
|
|
|
{ 9, 0, 144, 86, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 86, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// bolero
|
|
|
|
{
|
|
|
|
{ 5, 0, 15, 80, 0, 0, 0 },
|
|
|
|
{ 2, 0, 15, 72, 0, 0, 0 },
|
|
|
|
{ 5, 0, 15, 84, 0, 0, 0 },
|
|
|
|
{ 2, 0, 15, 76, 0, 0, 0 },
|
|
|
|
{ 9, 0, 15, 84, 0, 0, 0 },
|
|
|
|
{ 5, 0, 15, 74, 0, 0, 0 },
|
|
|
|
{ 9, 0, 15, 78, 0, 0, 0 },
|
|
|
|
{ 5, 0, 135, 66, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 66, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// serenade
|
|
|
|
{
|
|
|
|
{ 2, 0, 36, 60, 0, 0, 0 },
|
|
|
|
{ 5, 0, 36, 78, 0, 0, 0 },
|
|
|
|
{ 9, 0, 33, 82, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 3, 82, 0, 0, 0 },
|
|
|
|
{ 9, 0, 36, 84, 0, 0, 0 },
|
|
|
|
{ 11, 0, 144, 90, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// requiem
|
|
|
|
{
|
|
|
|
{ 2, 0, 45, 88, 0, 0, 0 },
|
|
|
|
{ 5, 0, 23, 86, 0, 0, 0 },
|
|
|
|
{ 2, 0, 22, 84, 0, 0, 0 },
|
|
|
|
{ 9, 0, 45, 86, 0, 0, 0 },
|
|
|
|
{ 5, 0, 45, 94, 0, 0, 0 },
|
|
|
|
{ 2, 0, 180, 94, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 94, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// nocturne
|
|
|
|
{
|
|
|
|
{ 11, 0, 36, 88, 0, 0, 0 },
|
|
|
|
{ 9, 0, 33, 84, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 3, 84, 0, 0, 0 },
|
|
|
|
{ 9, 0, 18, 82, 0, 0, 0 },
|
|
|
|
{ 2, 0, 18, 60, 0, 0, 0 },
|
|
|
|
{ 11, 0, 18, 90, 0, 0, 0 },
|
|
|
|
{ 9, 0, 18, 88, 0, 0, 0 },
|
|
|
|
{ 5, 0, 144, 96, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 96, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// prelude
|
|
|
|
{
|
|
|
|
{ 14, 0, 15, 84, 0, 0, 0 },
|
|
|
|
{ 9, 0, 45, 88, 0, 0, 0 },
|
|
|
|
{ 14, 0, 15, 88, 0, 0, 0 },
|
|
|
|
{ 9, 0, 15, 82, 0, 0, 0 },
|
|
|
|
{ 11, 0, 15, 86, 0, 0, 0 },
|
|
|
|
{ 14, 0, 60, 90, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 75, 90, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// sarias
|
|
|
|
{
|
|
|
|
{ 5, 0, 17, 84, 0, 0, 0 },
|
|
|
|
{ 9, 0, 17, 88, 0, 0, 0 },
|
|
|
|
{ 11, 0, 34, 80, 0, 0, 0 },
|
|
|
|
{ 5, 0, 17, 84, 0, 0, 0 },
|
|
|
|
{ 9, 0, 17, 88, 0, 0, 0 },
|
|
|
|
{ 11, 0, 136, 80, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// epona
|
|
|
|
{
|
|
|
|
{ 14, 0, 18, 84, 0, 0, 0 },
|
|
|
|
{ 11, 0, 18, 88, 0, 0, 0 },
|
|
|
|
{ 9, 0, 72, 80, 0, 0, 0 },
|
|
|
|
{ 14, 0, 18, 84, 0, 0, 0 },
|
|
|
|
{ 11, 0, 18, 88, 0, 0, 0 },
|
|
|
|
{ 9, 0, 144, 80, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// lullaby
|
|
|
|
{
|
|
|
|
{ 11, 0, 51, 84, 0, 0, 0 },
|
|
|
|
{ 14, 0, 25, 88, 0, 0, 0 },
|
|
|
|
{ 9, 0, 78, 80, 0, 0, 0 },
|
|
|
|
{ 11, 0, 51, 84, 0, 0, 0 },
|
|
|
|
{ 14, 0, 25, 88, 0, 0, 0 },
|
|
|
|
{ 9, 0, 100, 80, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// suns
|
|
|
|
{
|
|
|
|
{ 9, 0, 12, 84, 0, 0, 0 },
|
|
|
|
{ 5, 0, 13, 88, 0, 0, 0 },
|
|
|
|
{ 14, 0, 29, 80, 2, 0, 0 },
|
|
|
|
{ 0xFF, 0, 9, 84, 0, 0, 0 },
|
|
|
|
{ 9, 0, 12, 84, 0, 0, 0 },
|
|
|
|
{ 5, 0, 13, 88, 0, 0, 0 },
|
|
|
|
{ 14, 0, 120, 80, 3, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// song of time
|
|
|
|
{
|
|
|
|
{ 9, 0, 32, 84, 0, 0, 0 },
|
|
|
|
{ 2, 0, 65, 88, 0, 0, 0 },
|
|
|
|
{ 5, 0, 33, 80, 0, 0, 0 },
|
|
|
|
{ 9, 0, 32, 84, 0, 0, 0 },
|
|
|
|
{ 2, 0, 65, 88, 0, 0, 0 },
|
|
|
|
{ 5, 0, 99, 80, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// storms
|
|
|
|
{
|
|
|
|
{ 2, 0, 11, 84, 0, 0, 0 },
|
|
|
|
{ 5, 0, 11, 88, 0, 0, 0 },
|
|
|
|
{ 14, 0, 45, 80, 0, 0, 0 },
|
|
|
|
{ 2, 0, 11, 84, 0, 0, 0 },
|
|
|
|
{ 5, 0, 11, 88, 0, 0, 0 },
|
|
|
|
{ 14, 0, 90, 80, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 90, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
|
|
|
// scarecrow
|
|
|
|
{
|
|
|
|
{ 2, 0, 3, 0, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 255, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
// OCA_SONGS_MEMORYGAME
|
2021-09-01 22:33:37 +00:00
|
|
|
{
|
|
|
|
{ 2, 0, 3, 0, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 0, 0, 0, 0 },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
OcarinaNote* sPlaybackSong = sOcarinaSongs[0];
|
|
|
|
u8 D_80131844[14] = { 0, 3, 2, 1, 3, 2, 1, 0, 1, 0, 1, 2, 3, 0 };
|
|
|
|
u8* gFrogsSongPtr = D_80131844;
|
|
|
|
u8 D_80131858 = 0; // "REC"
|
|
|
|
u8 sRecordSongPos = 0;
|
|
|
|
u32 D_80131860 = 0;
|
|
|
|
u8 D_80131864 = 0;
|
|
|
|
u8 D_80131868 = 0;
|
|
|
|
u8 D_8013186C = 0;
|
|
|
|
s8 D_80131870 = 0;
|
|
|
|
u8 D_80131874 = 0;
|
|
|
|
u8 D_80131878 = 0;
|
|
|
|
u8 D_8013187C = 0;
|
|
|
|
u8 D_80131880 = 0;
|
|
|
|
|
|
|
|
OcarinaNote sPierresSong[108] = {
|
|
|
|
{ 0xFF, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0xFF, 0, 0, 0, 0, 0, 0 },
|
|
|
|
};
|
|
|
|
OcarinaNote* gScarecrowCustomSongPtr = sPierresSong;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
u8* gScarecrowSpawnSongPtr = (u8*)&sOcarinaSongs[OCA_SONGS_SCARECROW];
|
|
|
|
OcarinaNote* D_80131BEC = sOcarinaSongs[OCA_SONGS_MEMORYGAME];
|
2021-09-01 22:33:37 +00:00
|
|
|
u8 sNoteValueIndexMap[16] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 5, 3, 3, 4, 4, 4 };
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
OcarinaSongInfo gOcarinaSongNotes[14] = {
|
|
|
|
{ 6, { 0, 4, 3, 2, 3, 2 }},
|
|
|
|
{ 8, { 1, 0, 1, 0, 2, 1, 2, 1 }},
|
|
|
|
{ 5, { 0, 1, 2, 2, 3 }},
|
|
|
|
{ 6, { 0, 1, 0, 2, 1, 0 }},
|
|
|
|
{ 7, { 3, 2, 2, 0, 3, 2, 1 }},
|
|
|
|
{ 6, { 4, 2, 4, 2, 3, 4 }},
|
|
|
|
{ 6, { 1, 2, 3, 1, 2, 3 }},
|
|
|
|
{ 6, { 4, 3, 2, 4, 3, 2 }},
|
|
|
|
{ 6, { 3, 4, 2, 3, 4, 2 }},
|
|
|
|
{ 6, { 2, 1, 4, 2, 1, 4 }},
|
|
|
|
{ 6, { 2, 0, 1, 2, 0, 1 }},
|
|
|
|
{ 6, { 0, 1, 4, 0, 1, 4 }},
|
|
|
|
{ 8, { 0, 0, 0, 0, 0, 0, 0, 0 }},
|
|
|
|
{ 0, { 0, 0, 0, 0, 0, 0, 0, 0 }},
|
|
|
|
};
|
|
|
|
// clang-format on
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
extern u8 D_801333F0;
|
2021-11-07 16:58:50 +00:00
|
|
|
extern u8 gAudioSfxSwapOff;
|
2021-08-12 19:37:37 +00:00
|
|
|
extern u8 D_80133408;
|
|
|
|
extern u8 D_80133418;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* BSS
|
|
|
|
*/
|
|
|
|
u32 sAudioUpdateStartTime; // 8016B7A0
|
|
|
|
u32 sAudioUpdateEndTime;
|
|
|
|
f32 D_8016B7A8;
|
2021-08-30 00:08:41 +00:00
|
|
|
f32 D_8016B7AC;
|
2021-07-27 23:44:58 +00:00
|
|
|
f32 D_8016B7B0;
|
|
|
|
f32 D_8016B7B4;
|
2021-08-30 00:08:41 +00:00
|
|
|
FreqLerp sRiverFreqScaleLerp;
|
|
|
|
FreqLerp sWaterfallFreqScaleLerp;
|
2021-07-27 23:44:58 +00:00
|
|
|
f32 D_8016B7D8;
|
|
|
|
s8 D_8016B7DC;
|
|
|
|
f32 D_8016B7E0;
|
|
|
|
u16 D_8016B7E4;
|
2021-08-30 00:08:41 +00:00
|
|
|
struct {
|
2021-08-12 19:37:37 +00:00
|
|
|
s8 str[5];
|
|
|
|
u16 num;
|
2021-08-30 00:08:41 +00:00
|
|
|
} sAudioScrPrtBuf[SCROLL_PRINT_BUF_SIZE];
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 D_8016B8B0;
|
|
|
|
u8 D_8016B8B1;
|
|
|
|
u8 D_8016B8B2;
|
|
|
|
u8 D_8016B8B3;
|
2021-08-30 00:08:41 +00:00
|
|
|
u8 sAudioGanonDistVol;
|
2021-11-07 16:58:50 +00:00
|
|
|
SfxPlayerState sSfxChannelState[0x10];
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
char sBinToStrBuf[0x20];
|
|
|
|
u8 D_8016B9D8;
|
|
|
|
u8 sAudioSpecPeakNumNotes[0x12];
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 D_8016B9F2;
|
|
|
|
u8 D_8016B9F3;
|
|
|
|
u8 D_8016B9F4;
|
|
|
|
u16 D_8016B9F6;
|
|
|
|
|
|
|
|
OcarinaStaff D_8016B9F8; // playing along staff?
|
|
|
|
OcarinaStaff sDisplayedStaff; // displayed staff?
|
|
|
|
OcarinaStaff D_8016BA00; // ?? note and status not updated, pos updated as you play
|
|
|
|
u32 D_8016BA04;
|
|
|
|
typedef struct {
|
|
|
|
s8 x;
|
|
|
|
s8 y;
|
|
|
|
} OcarinaStick;
|
|
|
|
OcarinaStick sCurOcaStick;
|
|
|
|
u32 sCurOcarinaBtnPress;
|
|
|
|
u32 D_8016BA10;
|
|
|
|
u32 sPrevOcarinaBtnPress;
|
|
|
|
s32 D_8016BA18;
|
|
|
|
s32 D_8016BA1C;
|
|
|
|
u8 sCurOcarinaSong[8];
|
|
|
|
u8 sOcarinaSongAppendPos;
|
|
|
|
u8 sOcarinaHasStartedSong;
|
2021-08-30 00:08:41 +00:00
|
|
|
u8 sOcarinaSongNoteStartIdx;
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 sOcarinaSongCnt;
|
|
|
|
u16 sOcarinaAvailSongs;
|
|
|
|
u8 D_8016BA2E;
|
|
|
|
u16 sLearnSongPos[0x10];
|
|
|
|
u16 D_8016BA50[0x10];
|
|
|
|
u16 D_8016BA70[0x10];
|
|
|
|
u8 sLearnSongExpectedNote[0x10];
|
|
|
|
OcarinaNote D_8016BAA0;
|
2021-08-30 00:08:41 +00:00
|
|
|
u8 sAudioHasMalonBgm;
|
|
|
|
f32 sAudioMalonBgmDist;
|
|
|
|
|
|
|
|
// Start debug bss
|
|
|
|
u32 sDebugPadHold;
|
|
|
|
u32 sDebugPadBtnLast;
|
2021-07-27 23:44:58 +00:00
|
|
|
u32 sDebugPadPress;
|
|
|
|
s32 sAudioUpdateTaskStart;
|
|
|
|
s32 sAudioUpdateTaskEnd;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
extern u16 gAudioSfxSwapSource[];
|
|
|
|
extern u16 gAudioSfxSwapTarget[];
|
|
|
|
extern u8 gAudioSfxSwapMode[];
|
2021-08-30 00:08:41 +00:00
|
|
|
|
|
|
|
void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode);
|
|
|
|
|
|
|
|
void Audio_StepFreqLerp(FreqLerp* lerp);
|
|
|
|
void func_800F56A8(void);
|
|
|
|
void func_800F6FB4(u8);
|
|
|
|
s32 Audio_SetGanonDistVol(u8 targetVol);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-07-27 23:44:58 +00:00
|
|
|
void func_800EC960(u8 custom) {
|
|
|
|
if (!custom) {
|
|
|
|
osSyncPrintf("AUDIO : Ocarina Control Assign Normal\n");
|
|
|
|
sOcarinaAllowedBtnMask = (BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT);
|
|
|
|
sOcarinaABtnMap = BTN_A;
|
|
|
|
sOcarinaCUPBtnMap = BTN_CUP;
|
|
|
|
sOcarinaCDownBtnMap = BTN_CDOWN;
|
|
|
|
} else {
|
|
|
|
osSyncPrintf("AUDIO : Ocarina Control Assign Custom\n");
|
|
|
|
sOcarinaAllowedBtnMask = (BTN_A | BTN_B | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT);
|
|
|
|
sOcarinaABtnMap = BTN_B;
|
|
|
|
sOcarinaCUPBtnMap = BTN_CDOWN;
|
|
|
|
sOcarinaCDownBtnMap = BTN_A;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Audio_GetOcaInput(void) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Input inputs[4];
|
|
|
|
Input* controller1 = &inputs[0];
|
2021-07-27 23:44:58 +00:00
|
|
|
u32 sp18;
|
|
|
|
|
|
|
|
sp18 = sCurOcarinaBtnPress;
|
2021-08-30 00:08:41 +00:00
|
|
|
PadMgr_RequestPadData(&gPadMgr, inputs, 0);
|
|
|
|
sCurOcarinaBtnPress = controller1->cur.button;
|
2021-07-27 23:44:58 +00:00
|
|
|
sPrevOcarinaBtnPress = sp18;
|
2021-08-30 00:08:41 +00:00
|
|
|
sCurOcaStick.x = controller1->rel.stick_x;
|
|
|
|
sCurOcaStick.y = controller1->rel.stick_y;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
f32 Audio_OcaAdjStick(s8 inp) {
|
|
|
|
s8 inpAdj;
|
|
|
|
f32 ret;
|
|
|
|
|
|
|
|
if (inp > 0x40) {
|
|
|
|
inpAdj = 127;
|
|
|
|
} else if (inp < -0x40) {
|
|
|
|
inpAdj = -128;
|
|
|
|
} else if (inp >= 0) {
|
|
|
|
inpAdj = (inp * 127) / 64;
|
|
|
|
} else {
|
|
|
|
inpAdj = (inp * 128) / 64;
|
|
|
|
}
|
|
|
|
ret = D_8012F6B4[inpAdj];
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 func_800ECAF0(void) {
|
|
|
|
u8 ret;
|
|
|
|
|
|
|
|
if (D_80131878 != 0) {
|
|
|
|
ret = D_80131878 - 1;
|
|
|
|
D_80131878 = 0;
|
|
|
|
} else if (D_80130F3C != 0) {
|
|
|
|
ret = 0xFE;
|
|
|
|
} else {
|
|
|
|
ret = 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 Audio_OcaMapNoteValue(u8 arg0) {
|
|
|
|
u8 temp_v1;
|
|
|
|
|
|
|
|
temp_v1 = sNoteValueIndexMap[arg0 & 0x3F];
|
|
|
|
if (temp_v1 == 5) {
|
|
|
|
if (arg0 & 0x80) {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
return temp_v1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ECB7C(u8 songIdx) {
|
|
|
|
u8 savedSongIdx;
|
|
|
|
u8 scarecrowSongIdx;
|
|
|
|
u8 noteIdx;
|
|
|
|
|
|
|
|
savedSongIdx = 0;
|
|
|
|
scarecrowSongIdx = 0;
|
|
|
|
while (savedSongIdx < 8 && scarecrowSongIdx < 0x10) {
|
2021-09-01 22:33:37 +00:00
|
|
|
noteIdx = sOcarinaSongs[songIdx][scarecrowSongIdx++].noteIdx;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (noteIdx != 0xFF) {
|
2021-11-07 16:58:50 +00:00
|
|
|
gOcarinaSongNotes[OCA_SONGS_SCARECROW].notesIdx[savedSongIdx++] = sNoteValueIndexMap[noteIdx];
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// start ocarina.
|
|
|
|
void func_800ECC04(u16 flg) {
|
|
|
|
u8 i;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((sOcarinaSongs[OCA_SONGS_SCARECROW][1].volume != 0xFF) && ((flg & 0xFFF) == 0xFFF)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
flg |= 0x1000;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((flg == 0xCFFF) && (sOcarinaSongs[OCA_SONGS_SCARECROW][1].volume != 0xFF)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
flg = 0xDFFF;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((flg == 0xFFF) && (sOcarinaSongs[OCA_SONGS_SCARECROW][1].volume != 0xFF)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
flg = 0x1FFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flg != 0xFFFF) {
|
|
|
|
D_80130F3C = 0x80000000 + (u32)flg;
|
2021-08-30 00:08:41 +00:00
|
|
|
sOcarinaSongNoteStartIdx = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
sOcarinaSongCnt = 0xE;
|
|
|
|
if (flg != 0xA000) {
|
|
|
|
sOcarinaSongCnt--;
|
|
|
|
}
|
|
|
|
sOcarinaAvailSongs = flg & 0x3FFF;
|
|
|
|
D_8013187C = 8;
|
|
|
|
sOcarinaHasStartedSong = 0;
|
|
|
|
D_80131878 = 0;
|
|
|
|
D_8016BA2E = 0;
|
|
|
|
D_8016B9F8.state = func_800ECAF0();
|
|
|
|
sOcarinaInpEnabled = 1;
|
|
|
|
D_80130F4C = 0;
|
|
|
|
for (i = 0; i < 0xE; i++) {
|
|
|
|
sLearnSongPos[i] = 0;
|
|
|
|
D_8016BA50[i] = 0;
|
|
|
|
D_8016BA70[i] = 0;
|
|
|
|
sLearnSongExpectedNote[i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flg & 0x8000) {
|
|
|
|
D_8013187C = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flg & 0x4000) {
|
|
|
|
sOcarinaSongAppendPos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flg & 0xD000) {
|
|
|
|
func_800ECB7C(0xC);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
D_80130F3C = 0;
|
|
|
|
sOcarinaInpEnabled = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ECDBC(void) {
|
|
|
|
if (sCurOcarinaBtnVal != 0xFF && sOcarinaHasStartedSong == 0) {
|
|
|
|
sOcarinaHasStartedSong = 1;
|
|
|
|
sLearnSongLastBtn = 0xFF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ECDF8(void) {
|
|
|
|
u16 sh;
|
|
|
|
u16 pad;
|
|
|
|
u8 inputChanged = 0;
|
|
|
|
u16 pad2;
|
|
|
|
s8 sp57 = 0;
|
|
|
|
u8 i;
|
|
|
|
OcarinaNote* prevNote;
|
|
|
|
OcarinaNote* note;
|
|
|
|
|
|
|
|
func_800ECDBC();
|
|
|
|
|
|
|
|
if (sOcarinaHasStartedSong) {
|
|
|
|
if ((D_80130F2C < 0 ? -D_80130F2C : D_80130F2C) >= 0x15) {
|
|
|
|
D_80130F3C = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-12 19:37:37 +00:00
|
|
|
// clang-format off
|
|
|
|
if (sPrevOcarinaNoteVal == sCurOcarinaBtnVal || sCurOcarinaBtnVal == 0xFF) { inputChanged = 1; }
|
|
|
|
// clang-format on
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
for (i = sOcarinaSongNoteStartIdx; i < sOcarinaSongCnt; i++) {
|
2021-07-27 23:44:58 +00:00
|
|
|
sh = 1 << i;
|
|
|
|
if (sOcarinaAvailSongs & sh) {
|
|
|
|
D_8016BA50[i] = D_8016BA70[i] + 0x12;
|
|
|
|
if (inputChanged) {
|
2021-08-12 19:37:37 +00:00
|
|
|
// (pointless if check, this is always true)
|
|
|
|
if ((D_8016BA50[i] >= D_8016BA70[i] - 0x12) && (D_8016BA50[i] >= D_8016BA70[i] + 0x12) &&
|
2021-09-01 22:33:37 +00:00
|
|
|
(sOcarinaSongs[i][sLearnSongPos[i]].unk_02 == 0) &&
|
2021-07-27 23:44:58 +00:00
|
|
|
(sLearnSongLastBtn == sLearnSongExpectedNote[i])) {
|
|
|
|
D_80131878 = i + 1;
|
|
|
|
sOcarinaInpEnabled = 0;
|
|
|
|
D_80130F3C = 0;
|
|
|
|
}
|
|
|
|
} else if (D_8016BA50[i] >= (D_8016BA70[i] - 0x12)) {
|
|
|
|
if (sLearnSongLastBtn != 0xFF) {
|
|
|
|
if (sLearnSongLastBtn == sLearnSongExpectedNote[i]) {
|
2021-09-01 22:33:37 +00:00
|
|
|
if (i == 12) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016BA50[i] = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sOcarinaAvailSongs ^= sh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
prevNote = &sOcarinaSongs[i][sLearnSongPos[i]];
|
|
|
|
note = &sOcarinaSongs[i][++sLearnSongPos[i]];
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016BA70[i] = prevNote->unk_02;
|
|
|
|
sLearnSongExpectedNote[i] = prevNote->noteIdx;
|
|
|
|
|
|
|
|
if (sCurOcarinaBtnVal != sLearnSongExpectedNote[i]) {
|
|
|
|
sOcarinaAvailSongs ^= sh;
|
|
|
|
}
|
2021-08-12 19:37:37 +00:00
|
|
|
while (prevNote->noteIdx == note->noteIdx || (note->noteIdx == 0xFF && note->unk_02 != 0)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016BA70[i] += note->unk_02;
|
2021-09-01 22:33:37 +00:00
|
|
|
prevNote = &sOcarinaSongs[i][sLearnSongPos[i]];
|
|
|
|
note = &sOcarinaSongs[i][sLearnSongPos[i] + 1];
|
2021-08-12 19:37:37 +00:00
|
|
|
sLearnSongPos[i]++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else if (D_8016BA50[i] < 0xA) {
|
|
|
|
sp57 = -1;
|
|
|
|
D_8016BA50[i] = 0;
|
|
|
|
sLearnSongLastBtn = sCurOcarinaBtnVal;
|
|
|
|
} else {
|
|
|
|
sOcarinaAvailSongs ^= sh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sOcarinaAvailSongs == 0 && D_8016BA2E >= D_8013187C) {
|
|
|
|
sOcarinaInpEnabled = 0;
|
2021-09-01 22:33:37 +00:00
|
|
|
if (CHECK_BTN_ANY(D_80130F3C, BTN_B) && sCurOcarinaBtnVal == sOcarinaSongs[i][0].noteIdx) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80130F4C = D_80130F3C;
|
|
|
|
}
|
|
|
|
D_80130F3C = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!inputChanged) {
|
|
|
|
sLearnSongLastBtn = sCurOcarinaBtnVal;
|
|
|
|
D_8016BA2E += sp57 + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ED200(void) {
|
|
|
|
u32 temp_v0;
|
|
|
|
u8 i;
|
|
|
|
u8 j;
|
|
|
|
u8 k;
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sCurOcarinaBtnPress, BTN_L) && CHECK_BTN_ANY(sCurOcarinaBtnPress, sOcarinaAllowedBtnMask)) {
|
2021-08-12 19:37:37 +00:00
|
|
|
func_800ECC04((u16)D_80130F3C);
|
2021-07-27 23:44:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
func_800ECDBC();
|
|
|
|
|
|
|
|
if (sOcarinaHasStartedSong) {
|
|
|
|
if ((sPrevOcarinaNoteVal != sCurOcarinaBtnVal) && (sCurOcarinaBtnVal != 0xFF)) {
|
|
|
|
D_8016BA2E++;
|
|
|
|
if (D_8016BA2E >= 9) {
|
|
|
|
D_8016BA2E = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sOcarinaSongAppendPos == 8) {
|
|
|
|
for (i = 0; i < 7; i++) {
|
|
|
|
sCurOcarinaSong[i] = sCurOcarinaSong[i + 1];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sOcarinaSongAppendPos++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((D_80130F2C < 0 ? -D_80130F2C : D_80130F2C) >= 0x15) {
|
|
|
|
sCurOcarinaSong[sOcarinaSongAppendPos - 1] = 0xFF;
|
|
|
|
} else {
|
|
|
|
sCurOcarinaSong[sOcarinaSongAppendPos - 1] = sCurOcarinaBtnVal;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
for (i = sOcarinaSongNoteStartIdx; i < sOcarinaSongCnt; i++) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (sOcarinaAvailSongs & (u16)(1 << i)) {
|
|
|
|
for (j = 0, k = 0;
|
|
|
|
j < gOcarinaSongNotes[i].len && k == 0 && sOcarinaSongAppendPos >= gOcarinaSongNotes[i].len;) {
|
|
|
|
temp_v0 = sCurOcarinaSong[(sOcarinaSongAppendPos - gOcarinaSongNotes[i].len) + j];
|
|
|
|
if (temp_v0 == sOcarinaNoteValues[gOcarinaSongNotes[i].notesIdx[j]]) {
|
|
|
|
j++;
|
|
|
|
} else {
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j == gOcarinaSongNotes[i].len) {
|
|
|
|
D_80131878 = i + 1;
|
|
|
|
sOcarinaInpEnabled = 0;
|
|
|
|
D_80130F3C = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ED458(s32 arg0) {
|
|
|
|
u32 phi_v1_2;
|
|
|
|
|
|
|
|
if (D_80130F3C != 0 && D_80131880 != 0) {
|
|
|
|
D_80131880--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((D_8016BA10 == 0) ||
|
2021-08-12 19:37:37 +00:00
|
|
|
((D_8016BA10 & sOcarinaAllowedBtnMask) != (sCurOcarinaBtnPress & sOcarinaAllowedBtnMask))) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016BA10 = 0;
|
|
|
|
if (1) {}
|
|
|
|
sCurOcarinaBtnVal = 0xFF;
|
|
|
|
sCurOcarinaBtnIdx = 0xFF;
|
|
|
|
phi_v1_2 = (sCurOcarinaBtnPress & sOcarinaAllowedBtnMask) & (sPrevOcarinaBtnPress & sOcarinaAllowedBtnMask);
|
|
|
|
if (!(D_8016BA18 & phi_v1_2) && (sCurOcarinaBtnPress != 0)) {
|
|
|
|
D_8016BA18 = sCurOcarinaBtnPress;
|
|
|
|
} else {
|
|
|
|
D_8016BA18 &= phi_v1_2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (D_8016BA18 & sOcarinaABtnMap) {
|
|
|
|
osSyncPrintf("Presss NA_KEY_D4 %08x\n", sOcarinaABtnMap);
|
|
|
|
sCurOcarinaBtnVal = 2;
|
|
|
|
sCurOcarinaBtnIdx = 0;
|
|
|
|
} else if (D_8016BA18 & sOcarinaCDownBtnMap) {
|
|
|
|
osSyncPrintf("Presss NA_KEY_F4 %08x\n", sOcarinaCDownBtnMap);
|
|
|
|
sCurOcarinaBtnVal = 5;
|
|
|
|
sCurOcarinaBtnIdx = 1;
|
|
|
|
} else if (D_8016BA18 & 1) {
|
|
|
|
osSyncPrintf("Presss NA_KEY_A4 %08x\n", 1);
|
|
|
|
sCurOcarinaBtnVal = 9;
|
|
|
|
sCurOcarinaBtnIdx = 2;
|
|
|
|
} else if (D_8016BA18 & 2) {
|
|
|
|
osSyncPrintf("Presss NA_KEY_B4 %08x\n", 2);
|
|
|
|
sCurOcarinaBtnVal = 0xB;
|
|
|
|
sCurOcarinaBtnIdx = 3;
|
|
|
|
} else if (D_8016BA18 & sOcarinaCUPBtnMap) {
|
|
|
|
osSyncPrintf("Presss NA_KEY_D5 %08x\n", sOcarinaCUPBtnMap);
|
|
|
|
sCurOcarinaBtnVal = 0xE;
|
|
|
|
sCurOcarinaBtnIdx = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sCurOcarinaBtnVal != 0xFF && sCurOcarinaBtnPress & 0x10 && D_80131858 != 2) {
|
|
|
|
sCurOcarinaBtnIdx += 0x80;
|
|
|
|
sCurOcarinaBtnVal++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((sCurOcarinaBtnVal != 0xFF) && (sCurOcarinaBtnPress & 0x2000) && (D_80131858 != 2)) {
|
|
|
|
sCurOcarinaBtnIdx += 0x40;
|
|
|
|
sCurOcarinaBtnVal--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (D_80131858 != 2) {
|
|
|
|
D_80130F2C = sCurOcaStick.y;
|
|
|
|
D_80130F24 = Audio_OcaAdjStick(D_80130F2C);
|
|
|
|
|
|
|
|
D_80130F34 = (sCurOcaStick.x < 0 ? -sCurOcaStick.x : sCurOcaStick.x) >> 2;
|
|
|
|
Audio_QueueCmdS8(0x6020D06, D_80130F34);
|
|
|
|
} else {
|
|
|
|
D_80130F2C = 0;
|
|
|
|
D_80130F24 = 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((sCurOcarinaBtnVal != 0xFF) && (sPrevOcarinaNoteVal != sCurOcarinaBtnVal)) {
|
|
|
|
Audio_QueueCmdS8(0x6020D07, D_80130F10 - 1);
|
|
|
|
Audio_QueueCmdS8(0x6020D05, sCurOcarinaBtnVal);
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &D_801333D4, 4, &D_80130F24, &D_80130F28, &D_801333E8);
|
|
|
|
} else if ((sPrevOcarinaNoteVal != 0xFF) && (sCurOcarinaBtnVal == 0xFF)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StopSfxById(NA_SE_OC_OCARINA);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ED848(u8 inputEnabled) {
|
|
|
|
sOcarinaInpEnabled = inputEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ED858(u8 arg0) {
|
|
|
|
if (D_80130F10 == arg0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SeqCmd8(2, 1, SFX_PLAYER_CHANNEL_OCARINA, arg0);
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80130F10 = arg0;
|
|
|
|
if (arg0 == 0) {
|
|
|
|
sCurOcarinaBtnPress = 0;
|
|
|
|
sPrevOcarinaBtnPress = 0;
|
|
|
|
D_8016BA18 = 0;
|
|
|
|
D_8016BA10 = 0xFFFF;
|
|
|
|
func_800ED458(0);
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StopSfxById(NA_SE_OC_OCARINA);
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetSoundBanksMute(0);
|
2021-07-27 23:44:58 +00:00
|
|
|
sPlaybackState = 0;
|
|
|
|
sStaffPlaybackPos = 0;
|
|
|
|
sOcarinaInpEnabled = 0;
|
|
|
|
D_80130F3C = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_ClearBGMMute(SFX_PLAYER_CHANNEL_OCARINA);
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
|
|
|
sCurOcarinaBtnPress = 0;
|
|
|
|
Audio_GetOcaInput();
|
|
|
|
D_8016BA10 = sCurOcarinaBtnPress;
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_QueueSeqCmdMute(SFX_PLAYER_CHANNEL_OCARINA);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800ED93C(s8 songIdx, s8 arg1) {
|
|
|
|
if (songIdx == 0) {
|
|
|
|
sPlaybackState = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StopSfxById(NA_SE_OC_OCARINA);
|
2021-07-27 23:44:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (songIdx < 0xF) {
|
2021-09-01 22:33:37 +00:00
|
|
|
sPlaybackSong = sOcarinaSongs[songIdx - 1];
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-09-01 22:33:37 +00:00
|
|
|
sPlaybackSong = sPierresSong;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sPlaybackState = arg1;
|
|
|
|
sNotePlaybackTimer = 0;
|
|
|
|
sDisplayedNoteValue = 0xFF;
|
|
|
|
sPlaybackNotePos = 0;
|
|
|
|
sStaffPlaybackPos = 0;
|
2021-09-01 22:33:37 +00:00
|
|
|
while (sPlaybackSong[sPlaybackNotePos].noteIdx == 0xFF) {
|
2021-07-27 23:44:58 +00:00
|
|
|
sPlaybackNotePos++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Audio_OcaPlayback(void) {
|
2021-08-30 00:08:41 +00:00
|
|
|
u32 noteTimerStep;
|
|
|
|
u32 nextNoteTimerStep;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (sPlaybackState != 0) {
|
|
|
|
if (sStaffPlaybackPos == 0) {
|
|
|
|
noteTimerStep = 3;
|
|
|
|
} else {
|
|
|
|
noteTimerStep = D_8016BA04 - D_80130F68;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (noteTimerStep < sNotePlaybackTimer) {
|
|
|
|
sNotePlaybackTimer -= noteTimerStep;
|
|
|
|
} else {
|
|
|
|
nextNoteTimerStep = noteTimerStep - sNotePlaybackTimer;
|
|
|
|
sNotePlaybackTimer = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sNotePlaybackTimer == 0) {
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
sNotePlaybackTimer = sPlaybackSong[sPlaybackNotePos].unk_02;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (sPlaybackNotePos == 1) {
|
|
|
|
sNotePlaybackTimer++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sNotePlaybackTimer == 0) {
|
|
|
|
sPlaybackState--;
|
|
|
|
if (sPlaybackState != 0) {
|
|
|
|
sPlaybackNotePos = 0;
|
|
|
|
sStaffPlaybackPos = 0;
|
|
|
|
sDisplayedNoteValue = 0xFF;
|
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StopSfxById(NA_SE_OC_OCARINA);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
sNotePlaybackTimer -= nextNoteTimerStep;
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (sNotePlaybackVolume != sPlaybackSong[sPlaybackNotePos].volume) {
|
|
|
|
sNotePlaybackVolume = sPlaybackSong[sPlaybackNotePos].volume;
|
2021-07-27 23:44:58 +00:00
|
|
|
sNormalizedNotePlaybackVolume = sNotePlaybackVolume / 127.0f;
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (sNotePlaybackVibrato != sPlaybackSong[sPlaybackNotePos].vibrato) {
|
|
|
|
sNotePlaybackVibrato = sPlaybackSong[sPlaybackNotePos].vibrato;
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdS8(0x06020D06, sNotePlaybackVibrato);
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (sNotePlaybackTone != sPlaybackSong[sPlaybackNotePos].tone) {
|
|
|
|
sNotePlaybackTone = sPlaybackSong[sPlaybackNotePos].tone;
|
2021-07-27 23:44:58 +00:00
|
|
|
sNormalizedNotePlaybackTone = Audio_OcaAdjStick(sNotePlaybackTone);
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if ((sPlaybackSong[sPlaybackNotePos].volume == sPlaybackSong[sPlaybackNotePos - 1].volume &&
|
|
|
|
(sPlaybackSong[sPlaybackNotePos].vibrato == sPlaybackSong[sPlaybackNotePos - 1].vibrato) &&
|
|
|
|
(sPlaybackSong[sPlaybackNotePos].tone == sPlaybackSong[sPlaybackNotePos - 1].tone))) {
|
2021-07-27 23:44:58 +00:00
|
|
|
sDisplayedNoteValue = 0xFE;
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (sDisplayedNoteValue != sPlaybackSong[sPlaybackNotePos].noteIdx) {
|
|
|
|
u8 tmp = sPlaybackSong[sPlaybackNotePos].noteIdx;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (tmp == 0xA) {
|
2021-09-01 22:33:37 +00:00
|
|
|
sDisplayedNoteValue = tmp + sPlaybackSong[sPlaybackNotePos].semitone;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
|
|
|
sDisplayedNoteValue = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sDisplayedNoteValue != 0xFF) {
|
|
|
|
sStaffPlaybackPos++;
|
|
|
|
Audio_QueueCmdS8(0x6020D07, D_80130F10 - 1);
|
|
|
|
Audio_QueueCmdS8(0x6020D05, sDisplayedNoteValue & 0x3F);
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &D_801333D4, 4, &sNormalizedNotePlaybackTone,
|
|
|
|
&sNormalizedNotePlaybackVolume, &D_801333E8);
|
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StopSfxById(NA_SE_OC_OCARINA);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
sPlaybackNotePos++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EDD68(u8 arg0) {
|
|
|
|
u16 i;
|
|
|
|
u16 i2;
|
2021-11-07 16:58:50 +00:00
|
|
|
u16 pad;
|
|
|
|
u8 lastNote;
|
2021-07-27 23:44:58 +00:00
|
|
|
OcarinaNote* note;
|
|
|
|
u8 j;
|
|
|
|
u8 k;
|
|
|
|
s32 t;
|
2021-09-01 22:33:37 +00:00
|
|
|
OcarinaNote* song;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (D_80131858 == 1) {
|
|
|
|
song = gScarecrowCustomSongPtr;
|
|
|
|
} else {
|
|
|
|
song = D_80131BEC;
|
|
|
|
}
|
2021-09-01 22:33:37 +00:00
|
|
|
song[sRecordSongPos].noteIdx = D_80131864;
|
|
|
|
song[sRecordSongPos].unk_02 = D_8016BA04 - D_80131860;
|
|
|
|
song[sRecordSongPos].volume = D_80131868;
|
|
|
|
song[sRecordSongPos].vibrato = D_8013186C;
|
|
|
|
song[sRecordSongPos].tone = D_80131870;
|
|
|
|
song[sRecordSongPos].semitone = D_80131874 & 0xC0;
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80131864 = sCurOcarinaBtnVal;
|
|
|
|
D_80131868 = D_80130F30;
|
|
|
|
D_8013186C = D_80130F34;
|
|
|
|
D_80131870 = D_80130F2C;
|
|
|
|
D_80131874 = sCurOcarinaBtnIdx;
|
|
|
|
sRecordSongPos++;
|
|
|
|
|
|
|
|
if ((sRecordSongPos != 107) && (arg0 == 0)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = sRecordSongPos;
|
2021-11-07 16:58:50 +00:00
|
|
|
lastNote = 0xFF;
|
|
|
|
while (i != 0 && lastNote == 0xFF) {
|
2021-07-27 23:44:58 +00:00
|
|
|
i--;
|
2021-11-07 16:58:50 +00:00
|
|
|
lastNote = song[i].noteIdx;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (1) {}
|
|
|
|
|
|
|
|
if (sRecordSongPos != (i + 1)) {
|
|
|
|
sRecordSongPos = i + 2;
|
2021-09-01 22:33:37 +00:00
|
|
|
song[sRecordSongPos - 1].unk_02 = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
song[sRecordSongPos].unk_02 = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (D_80131858 == 2) {
|
|
|
|
if (D_8016BA2E >= 8) {
|
|
|
|
for (i = 0; i < sRecordSongPos; i++) {
|
2021-09-01 22:33:37 +00:00
|
|
|
song[i] = song[i + 1];
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
func_800ECB7C(OCA_SONGS_MEMORYGAME);
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
for (i = 0; i < OCA_SONGS_SCARECROW; i++) {
|
2021-07-27 23:44:58 +00:00
|
|
|
for (j = 0; j < 9 - gOcarinaSongNotes[i].len; j++) {
|
2021-11-07 16:58:50 +00:00
|
|
|
for (k = 0;
|
|
|
|
k < gOcarinaSongNotes[i].len && k + j < 8 &&
|
|
|
|
gOcarinaSongNotes[i].notesIdx[k] == gOcarinaSongNotes[OCA_SONGS_SCARECROW].notesIdx[k + j];
|
2021-07-28 21:59:52 +00:00
|
|
|
k++) {
|
2021-07-27 23:44:58 +00:00
|
|
|
;
|
2021-07-28 21:59:52 +00:00
|
|
|
}
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (k == gOcarinaSongNotes[i].len) {
|
|
|
|
D_80131858 = 0xFF;
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcarinaSongs[OCA_SONGS_SCARECROW][1].volume = 0xFF;
|
2021-07-27 23:44:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
while (i < 8) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (gOcarinaSongNotes[OCA_SONGS_SCARECROW].notesIdx[0] !=
|
|
|
|
gOcarinaSongNotes[OCA_SONGS_SCARECROW].notesIdx[i]) {
|
2021-07-27 23:44:58 +00:00
|
|
|
i = 9;
|
|
|
|
} else {
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 8) {
|
|
|
|
D_80131858 = 0xFF;
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcarinaSongs[OCA_SONGS_SCARECROW][1].volume = 0xFF;
|
2021-07-27 23:44:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < sRecordSongPos; i++) {
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcarinaSongs[OCA_SONGS_SCARECROW][i] = sOcarinaSongs[OCA_SONGS_MEMORYGAME][i];
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sOcarinaInpEnabled = 0;
|
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcarinaSongs[OCA_SONGS_SCARECROW][1].volume = 0xFF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
D_80131858 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// start custom song?
|
|
|
|
/**
|
|
|
|
* arg0 = 1, start
|
|
|
|
* arg0 = 0, finish
|
|
|
|
* arg0 = 2, also start?
|
|
|
|
*/
|
|
|
|
void func_800EE170(u8 arg0) {
|
|
|
|
if ((u32)arg0 == D_80131858) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg0 != 0) {
|
|
|
|
D_80131860 = D_8016BA04;
|
|
|
|
D_80131864 = 0xFF;
|
|
|
|
D_80131868 = 0x57;
|
|
|
|
D_8013186C = 0;
|
|
|
|
D_80131870 = 0;
|
|
|
|
D_80131874 = 0;
|
|
|
|
sRecordSongPos = 0;
|
|
|
|
sOcarinaInpEnabled = 1;
|
|
|
|
D_8016BA2E = 0;
|
2021-09-01 22:33:37 +00:00
|
|
|
D_8016BAA0 = sPierresSong[1];
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
|
|
|
if (sRecordSongPos == 0) {
|
2021-09-01 22:33:37 +00:00
|
|
|
sPierresSong[1] = D_8016BAA0;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
|
|
|
if (D_80131858 == 2) {
|
|
|
|
D_8016BA2E = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
func_800EDD68(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
sOcarinaInpEnabled = 0;
|
|
|
|
D_8016BA2E = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
D_80131858 = arg0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EE29C(void) {
|
|
|
|
D_8016BA00.state = D_80131858;
|
|
|
|
D_8016BA00.pos = D_8016BA2E;
|
|
|
|
if (D_80131858 == 0xFF) {
|
|
|
|
D_80131858 = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EE2D4(void) {
|
|
|
|
D_8016B9F8.noteIdx = sCurOcarinaBtnIdx & 0x3F;
|
|
|
|
D_8016B9F8.state = func_800ECAF0();
|
|
|
|
D_8016B9F8.pos = D_8016BA2E;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EE318(void) {
|
|
|
|
if ((sDisplayedNoteValue & 0x3F) < 0x10) {
|
|
|
|
sDisplayedStaff.noteIdx = Audio_OcaMapNoteValue(sDisplayedNoteValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
sDisplayedStaff.state = sPlaybackState;
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (sPlaybackSong != sPierresSong) {
|
2021-07-27 23:44:58 +00:00
|
|
|
sDisplayedStaff.pos = sStaffPlaybackPos;
|
|
|
|
} else if (sStaffPlaybackPos == 0) {
|
|
|
|
sDisplayedStaff.pos = 0;
|
|
|
|
} else {
|
|
|
|
sDisplayedStaff.pos = ((sStaffPlaybackPos - 1) % 8) + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OcarinaStaff* func_800EE3C8(void) {
|
|
|
|
return &D_8016BA00;
|
|
|
|
}
|
|
|
|
|
|
|
|
OcarinaStaff* func_800EE3D4(void) {
|
|
|
|
if (D_8016B9F8.state < 0xFE) {
|
|
|
|
D_80130F3C = 0;
|
|
|
|
}
|
|
|
|
return &D_8016B9F8;
|
|
|
|
}
|
|
|
|
|
|
|
|
OcarinaStaff* Audio_OcaGetDisplayStaff(void) {
|
|
|
|
return &sDisplayedStaff;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EE404(void) {
|
|
|
|
s32 noteChanged;
|
|
|
|
|
|
|
|
if ((D_80131858 != 0) && ((D_8016BA04 - D_80131860) >= 3)) {
|
|
|
|
noteChanged = false;
|
|
|
|
if (D_80131864 != sCurOcarinaBtnVal) {
|
|
|
|
if (sCurOcarinaBtnVal != 0xFF) {
|
|
|
|
D_8016BA00.noteIdx = sCurOcarinaBtnIdx & 0x3F;
|
|
|
|
D_8016BA2E++;
|
|
|
|
} else if ((D_80131858 == 2) && (D_8016BA2E == 8)) {
|
|
|
|
func_800EDD68(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (D_8016BA2E > 8) {
|
|
|
|
if (D_80131858 == 2) {
|
|
|
|
// notes played are over 8 and in recording mode.
|
|
|
|
func_800EDD68(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
D_8016BA2E = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
noteChanged = true;
|
|
|
|
} else if (D_80131868 != D_80130F30) {
|
|
|
|
noteChanged = true;
|
|
|
|
} else if (D_8013186C != D_80130F34) {
|
|
|
|
noteChanged = true;
|
|
|
|
} else if (D_80131870 != D_80130F2C) {
|
|
|
|
noteChanged = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (noteChanged) {
|
|
|
|
func_800EDD68(0);
|
|
|
|
D_80131860 = D_8016BA04;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EE57C(u8 minigameIdx) {
|
|
|
|
u8 i;
|
|
|
|
|
|
|
|
if (minigameIdx > 2) {
|
|
|
|
minigameIdx = 2;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcaMinigameAppendPos = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
sOcaMinigameEndPos = sOcaMinigameNoteCnts[minigameIdx];
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
func_800EE5EC();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 func_800EE5EC(void) {
|
|
|
|
u32 rnd;
|
|
|
|
u8 rndNote;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sOcaMinigameAppendPos == sOcaMinigameEndPos) {
|
2021-07-27 23:44:58 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
rnd = Audio_NextRandom();
|
|
|
|
rndNote = sOcarinaNoteValues[rnd % 5];
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos - 1].noteIdx == rndNote) {
|
2021-07-27 23:44:58 +00:00
|
|
|
rndNote = sOcarinaNoteValues[(rnd + 1) % 5];
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos].noteIdx = rndNote;
|
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos].unk_02 = 0x2D;
|
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos].volume = 0x50;
|
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos].vibrato = 0;
|
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos].tone = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcaMinigameAppendPos++;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos].noteIdx = 0xFF;
|
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos].unk_02 = 0;
|
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos + 1].noteIdx = 0xFF;
|
|
|
|
sOcarinaSongs[OCA_SONGS_MEMORYGAME][sOcaMinigameAppendPos + 1].unk_02 = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (1) {}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// input update?
|
|
|
|
void func_800EE6F4(void) {
|
|
|
|
D_8016BA04 = gAudioContext.totalTaskCnt;
|
|
|
|
if (D_80130F10 != 0) {
|
|
|
|
if (sOcarinaInpEnabled == 1) {
|
|
|
|
Audio_GetOcaInput();
|
|
|
|
}
|
|
|
|
if ((sPlaybackState == 0) && (sOcarinaInpEnabled == 1)) {
|
|
|
|
func_800ED458(0);
|
|
|
|
}
|
|
|
|
if (D_80130F3C != 0) {
|
|
|
|
if (D_80130F3C & 0x4000) {
|
|
|
|
func_800ED200();
|
|
|
|
} else {
|
|
|
|
func_800ECDF8();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Audio_OcaPlayback();
|
|
|
|
D_80130F68 = D_8016BA04;
|
|
|
|
|
|
|
|
if (sPlaybackState == 0) {
|
|
|
|
func_800EE404();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((D_80130F3C != 0) && (sPrevOcarinaNoteVal != sCurOcarinaBtnVal)) {
|
|
|
|
D_80131880 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sPrevOcarinaNoteVal = sCurOcarinaBtnVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
func_800EE2D4();
|
|
|
|
func_800EE318();
|
|
|
|
func_800EE29C();
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EE824(void) {
|
|
|
|
static u8 D_80131C80 = 0;
|
|
|
|
static u8 D_80131C84 = 1;
|
2021-08-30 00:08:41 +00:00
|
|
|
static u16 D_80131C88 = 1200;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
switch (D_80131C80) {
|
|
|
|
case 0:
|
|
|
|
if (D_80131C88-- == 0) {
|
|
|
|
if (D_80131C84 < 7) {
|
|
|
|
D_80131C80++;
|
|
|
|
} else {
|
|
|
|
D_80131C80 = 3;
|
|
|
|
func_800ED858(0);
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
D_80131C88 = 1200;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetSoundBanksMute(0);
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800ED858(D_80131C84);
|
|
|
|
func_800ED93C(0xF, 1);
|
|
|
|
D_80131C84++;
|
|
|
|
D_80131C80++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (Audio_OcaGetDisplayStaff()->state == 0) {
|
|
|
|
D_80131C80 = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800EE930(void) {
|
|
|
|
D_8016B9F8.noteIdx = 0xFF;
|
|
|
|
D_8016B9F8.state = 0xFF;
|
|
|
|
D_8016B9F8.pos = 0;
|
|
|
|
sDisplayedStaff.noteIdx = 0xFF;
|
|
|
|
sDisplayedStaff.state = 0;
|
|
|
|
sDisplayedStaff.pos = 0;
|
|
|
|
D_8016BA00.noteIdx = 0xFF;
|
|
|
|
D_8016BA00.state = 0xFF;
|
|
|
|
D_8016BA00.pos = 0;
|
|
|
|
D_80131880 = 0;
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
f32 D_80131C8C = 0.0f;
|
|
|
|
|
|
|
|
// === Audio Debugging ===
|
|
|
|
|
|
|
|
// These variables come between in-function statics in func_800EE824 and func_800F510C
|
|
|
|
|
|
|
|
f32 sAudioUpdateDuration = 0.0f;
|
|
|
|
f32 sAudioUpdateDurationMax = 0.0f;
|
|
|
|
u8 sAudioDebugEverOpened = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 sAudioSfxMuted = 0;
|
2021-09-01 22:33:37 +00:00
|
|
|
u8 sAudioDebugPage = 0;
|
|
|
|
u8 sAudioSndContSel = 0;
|
|
|
|
u8 sAudioDebugTextColor = 7;
|
|
|
|
char sAudioDebugPageNames[15][23] = {
|
|
|
|
"Non",
|
|
|
|
"Sound Control",
|
|
|
|
"Spec Info",
|
|
|
|
"Heap Info",
|
|
|
|
"Grp Track Info",
|
|
|
|
"Sub Track Info",
|
|
|
|
"Channel Info",
|
|
|
|
"Interface Info",
|
|
|
|
"SE Flag Swap",
|
|
|
|
"Block Change BGM",
|
|
|
|
"Natural Sound Control",
|
|
|
|
"Ocarina Test",
|
|
|
|
"SE Parameter Change",
|
|
|
|
"Scroll Print",
|
|
|
|
"Free Area",
|
|
|
|
};
|
|
|
|
u16 sAudioSndContWork[11] = { 0 };
|
|
|
|
u16 sAudioSndContWorkLims[11] = { 128, 128, 7, 512, 4, 2, 16, 32, 2, 2, 2 };
|
|
|
|
char sSoundBankNames[7][11] = { "PLAYER", "ITEM", "ENVIROMENT", "ENEMY", "SYSTEM", "OCARINA", "VOICE" };
|
|
|
|
char sSoundModeNames[5][10] = { "W-STEREO", "HEADPHONE", "3D SOUND", "MONO", "" };
|
|
|
|
s8 sAudioIntInfoX = 0;
|
|
|
|
s8 sAudioIntInfoY = 0;
|
|
|
|
s8 sAudioIntInfoSel = 0;
|
|
|
|
s8 sAudioIntInfoBankPage[7] = { 0, 0, 2, 2, 0, 0, 0 };
|
|
|
|
u8 sAudioScrPrtSel = 0;
|
|
|
|
u8 sAudioScrPrtInd = 0;
|
|
|
|
u8 sAudioScrPrtOverflow = 0;
|
|
|
|
s8 sAudioScrPrtX = 26;
|
|
|
|
s8 sAudioScrPrtY = 1;
|
|
|
|
u8 sAudioScrPrtWork[11] = { 1, 19, 6, 0, 0, 0, 0, 0, 0, 0, 1 };
|
|
|
|
u8 sAudioScrPrtWorkLims[11] = { 2, SCROLL_PRINT_BUF_SIZE, 8, 2, 2, 2, 2, 2, 2, 2, 2 };
|
|
|
|
u8 sAudioSubTrackInfoSpec = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 sAudioSfxSwapIsEditing = 0;
|
|
|
|
u8 sAudioSfxSwapSel = 0;
|
|
|
|
u8 sAudioSfxSwapNibbleSel = 0;
|
|
|
|
char sAudioSfxSwapModeNames[2][5] = { "SWAP", "ADD" };
|
|
|
|
u8 sAudioSfxParamChgSel = 0;
|
|
|
|
u8 sAudioSfxParamChgBitSel = 0;
|
|
|
|
u16 sAudioSfxParamChgWork[4] = { 0 };
|
2021-09-01 22:33:37 +00:00
|
|
|
u8 sAudioSubTrackInfoPlayerSel = 0;
|
|
|
|
u8 sAudioSubTrackInfoChannelSel = 0;
|
|
|
|
u8 sSeqPlayerPeakNumLayers[20] = { 0 };
|
|
|
|
char sAudioSceneNames[3][2] = { "A", "S", "X" };
|
|
|
|
u8 sAudioBlkChgBgmWork[2] = { 0 };
|
|
|
|
u8 sAudioBlkChgBgmSel = 0;
|
|
|
|
char sBoolStrs[3][5] = { "OFF", "ON", "STBY" };
|
|
|
|
u8 sAudioNatureFailed = 0;
|
|
|
|
u8 sPeakNumNotes = 0;
|
|
|
|
|
|
|
|
void AudioDebug_SetInput(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Input inputs[4];
|
|
|
|
u32 btn;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
PadMgr_RequestPadData(&gPadMgr, inputs, 0);
|
2021-07-27 23:44:58 +00:00
|
|
|
btn = inputs[3].cur.button;
|
2021-08-30 00:08:41 +00:00
|
|
|
sDebugPadHold = btn & 0xFFFF;
|
|
|
|
sDebugPadPress = (btn ^ sDebugPadBtnLast) & btn;
|
|
|
|
sDebugPadBtnLast = btn;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
char* AudioDebug_ToStringBinary(u32 num, u8 bits) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 i;
|
|
|
|
u32 flg = 1;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
for (i = 0; i < bits; flg *= 2, i++) {
|
|
|
|
if (num & flg) {
|
|
|
|
sBinToStrBuf[bits - i - 1] = '1';
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sBinToStrBuf[bits - i - 1] = '0';
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
sBinToStrBuf[bits] = '\0';
|
|
|
|
return sBinToStrBuf;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_Draw(GfxPrint* printer) {
|
|
|
|
s32 pad[3];
|
2021-08-12 19:37:37 +00:00
|
|
|
u8 i;
|
|
|
|
u8 j;
|
2021-08-30 00:08:41 +00:00
|
|
|
u8 ctr;
|
|
|
|
u8 ctr2;
|
|
|
|
s8 k;
|
|
|
|
s8 k2;
|
2021-08-12 19:37:37 +00:00
|
|
|
s8 ind;
|
2021-08-30 00:08:41 +00:00
|
|
|
u8 numEnabledNotes = 0;
|
|
|
|
char digitStr[2] = "1";
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
#define SETCOL_COMMON(v, r, g, b) \
|
|
|
|
GfxPrint_SetColor(printer, ((v & 4) >> 2) * (r), ((v & 2) >> 1) * (g), (v & 1) * (b), 255)
|
2021-08-30 00:08:41 +00:00
|
|
|
#define SETCOL(r, g, b) SETCOL_COMMON(sAudioDebugTextColor, r, g, b)
|
|
|
|
#define SETCOL_SCROLLPRINT(r, g, b) SETCOL_COMMON(sAudioScrPrtWork[2], r, g, b)
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioDebugEverOpened = true;
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_SetPos(printer, 3, 2);
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_Printf(printer, "Audio Debug Mode");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 3);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "- %s -", sAudioDebugPageNames[sAudioDebugPage]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
for (i = 0; i < gAudioSpecs[gAudioSpecId].numNotes; i++) {
|
|
|
|
if (gAudioContext.notes[i].noteSubEu.bitField0.enabled == 1) {
|
2021-08-12 19:37:37 +00:00
|
|
|
numEnabledNotes++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sPeakNumNotes < numEnabledNotes) {
|
|
|
|
sPeakNumNotes = numEnabledNotes;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSpecPeakNumNotes[gAudioSpecId] < numEnabledNotes) {
|
|
|
|
sAudioSpecPeakNumNotes[gAudioSpecId] = numEnabledNotes;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioScrPrtWork[0] != 0) {
|
|
|
|
GfxPrint_SetPos(printer, sAudioScrPrtX, sAudioScrPrtY);
|
|
|
|
SETCOL_SCROLLPRINT(200, 200, 200);
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "Audio ScrPrt");
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
ind = sAudioScrPrtInd;
|
|
|
|
for (k = 0; k < sAudioScrPrtWork[1] + 1; k++) {
|
2021-08-12 19:37:37 +00:00
|
|
|
if (ind == 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioScrPrtOverflow == 1) {
|
|
|
|
ind = SCROLL_PRINT_BUF_SIZE - 1;
|
2021-08-12 19:37:37 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
k = sAudioScrPrtWork[1] + 1; // "break;"
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ind--;
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
if (k != sAudioScrPrtWork[1] + 1) {
|
2021-08-12 19:37:37 +00:00
|
|
|
if ((ind % 5) != 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
SETCOL_SCROLLPRINT(180, 180, 180);
|
2021-08-12 19:37:37 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
SETCOL_SCROLLPRINT(120, 120, 120);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 2 + sAudioScrPrtX, sAudioScrPrtY + sAudioScrPrtWork[1] + 1 - k);
|
|
|
|
GfxPrint_Printf(printer, "%s", sAudioScrPrtBuf[ind].str);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 7 + sAudioScrPrtX, sAudioScrPrtY + sAudioScrPrtWork[1] + 1 - k);
|
|
|
|
GfxPrint_Printf(printer, "%04X", sAudioScrPrtBuf[ind].num);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
switch (sAudioDebugPage) {
|
|
|
|
case PAGE_NON:
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
2021-08-30 00:08:41 +00:00
|
|
|
SETCOL(255, 64, 64);
|
|
|
|
GfxPrint_Printf(printer, "BGM CANCEL:%s", sBoolStrs[sAudioSndContWork[5]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "SE MUTE:%s", sBoolStrs[sAudioSfxMuted]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 18, 4);
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_Printf(printer, "PUSH CONT-4 A-BTN");
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
ind = (s8)sAudioSndContWork[2];
|
|
|
|
i = gSoundBanks[ind][0].next;
|
|
|
|
j = 0;
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SE HANDLE:%s", sSoundBankNames[ind]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
while (i != 0xFF) {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 3, 7 + j++);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "%02x %04x %02x %08x", i, gSoundBanks[ind][i].sfxId, gSoundBanks[ind][i].state,
|
|
|
|
gSoundBanks[ind][i].priority);
|
2021-08-30 00:08:41 +00:00
|
|
|
i = gSoundBanks[ind][i].next;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_SOUND_CONTROL:
|
|
|
|
GfxPrint_SetPos(printer, 2, 4 + sAudioSndContSel);
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(127, 255, 127);
|
|
|
|
GfxPrint_Printf(printer, "*");
|
|
|
|
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Seq 0 : %2x", sAudioSndContWork[0]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Seq 1 : %2x", sAudioSndContWork[1]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SE HD : %2x %s", sAudioSndContWork[2], sSoundBankNames[sAudioSndContWork[2]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 7);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SE No. :%3x", sAudioSndContWork[3]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 8);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "S-Out : %2x %s", sAudioSndContWork[4], sSoundModeNames[sAudioSndContWork[4]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 9);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "BGM Ent: %2x", sAudioSndContWork[5]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 10);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Spec : %2x", sAudioSndContWork[6]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 11);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Na Snd : %2x", sAudioSndContWork[7]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 12);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Cam Wt : %s", sBoolStrs[sAudioSndContWork[8]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 13);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Lnk Wt : %s", sBoolStrs[sAudioSndContWork[9]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 14);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SE Ent : %2x", sAudioSndContWork[10]);
|
2021-08-12 19:37:37 +00:00
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_INTERFACE_INFO:
|
|
|
|
ind = 0;
|
|
|
|
for (k = 0; k < 7; k++) {
|
|
|
|
if (k == sAudioIntInfoSel) {
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 127, 127);
|
|
|
|
} else {
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 2 + sAudioIntInfoX, 4 + ind + sAudioIntInfoY);
|
|
|
|
GfxPrint_Printf(printer, "%s <%d>", sSoundBankNames[k], sAudioIntInfoBankPage[k]);
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
for (k2 = 0; k2 < gChannelsPerBank[gSfxChannelLayout][k]; k2++) {
|
|
|
|
#define entryIndex (gActiveSounds[k][k2].entryIndex)
|
2021-08-30 00:08:41 +00:00
|
|
|
#define entry (&gSoundBanks[k][entryIndex])
|
2021-11-07 16:58:50 +00:00
|
|
|
#define chan (gAudioContext.seqPlayers[2].channels[entry->channelIdx])
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 2 + sAudioIntInfoX, 5 + ind + sAudioIntInfoY);
|
|
|
|
if (sAudioIntInfoBankPage[k] == 1) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((entryIndex != 0xFF) &&
|
|
|
|
((entry->state == SFX_STATE_PLAYING_1) || (entry->state == SFX_STATE_PLAYING_2))) {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%2X %5d %5d %5d %02X %04X %04X", entryIndex, (s32)*entry->posX,
|
2021-09-01 22:33:37 +00:00
|
|
|
(s32)*entry->posY, (s32)*entry->posZ, entry->sfxImportance,
|
|
|
|
entry->sfxParams, entry->sfxId);
|
2021-08-12 19:37:37 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "FF ----- ----- ----- -- ---- ----");
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (sAudioIntInfoBankPage[k] == 2) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((entryIndex != 0xFF) &&
|
|
|
|
((entry->state == SFX_STATE_PLAYING_1) || (entry->state == SFX_STATE_PLAYING_2))) {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%2X %5d %5d %5d %3d %3d %04X", entryIndex, (s32)*entry->posX,
|
2021-08-12 19:37:37 +00:00
|
|
|
(s32)*entry->posY, (s32)*entry->posZ, (s32)(chan->volume * 127.1f),
|
2021-08-31 13:22:56 +00:00
|
|
|
chan->newPan, entry->sfxId);
|
2021-08-12 19:37:37 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "FF ----- ----- ----- --- --- ----");
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (sAudioIntInfoBankPage[k] == 3) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((entryIndex != 0xFF) &&
|
|
|
|
((entry->state == SFX_STATE_PLAYING_1) || (entry->state == SFX_STATE_PLAYING_2))) {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%2X %5d %5d %5d %3d %3d %04X", entryIndex, (s32)*entry->posX,
|
2021-08-12 19:37:37 +00:00
|
|
|
(s32)*entry->posY, (s32)*entry->posZ, (s32)(chan->freqScale * 100.0f),
|
2021-08-31 13:22:56 +00:00
|
|
|
chan->reverb, entry->sfxId);
|
2021-08-12 19:37:37 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "FF ----- ----- ----- --- --- ----");
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (sAudioIntInfoBankPage[k] == 4) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((entryIndex != 0xFF) &&
|
|
|
|
((entry->state == SFX_STATE_PLAYING_1) || (entry->state == SFX_STATE_PLAYING_2))) {
|
2021-08-31 13:22:56 +00:00
|
|
|
GfxPrint_Printf(printer, "%2X %04X", entryIndex, entry->sfxId);
|
2021-08-12 19:37:37 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "FF ----");
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
#undef entryIndex
|
|
|
|
#undef entry
|
|
|
|
#undef chan
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioIntInfoBankPage[k] != 0) {
|
2021-08-12 19:37:37 +00:00
|
|
|
ind++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ind++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_SCROLL_PRINT:
|
|
|
|
GfxPrint_SetPos(printer, 2, 4 + sAudioScrPrtSel);
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_Printf(printer, "*");
|
|
|
|
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Swicth : %d", sAudioScrPrtWork[0]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Lines : %d", sAudioScrPrtWork[1] + 1);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Color : %d", sAudioScrPrtWork[2]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 7);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%s : %d", sSoundBankNames[0], sAudioScrPrtWork[3]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 8);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%s : %d", sSoundBankNames[1], sAudioScrPrtWork[4]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 9);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "ENVRONM : %d", sAudioScrPrtWork[5]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 10);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%s : %d", sSoundBankNames[3], sAudioScrPrtWork[6]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 11);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%s : %d", sSoundBankNames[4], sAudioScrPrtWork[7]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 12);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%s : %d", sSoundBankNames[5], sAudioScrPrtWork[8]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 13);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%s : %d", sSoundBankNames[6], sAudioScrPrtWork[9]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 14);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SEQ ENT : %d", sAudioScrPrtWork[10]);
|
2021-08-12 19:37:37 +00:00
|
|
|
break;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
case PAGE_SFX_SWAP:
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
|
|
|
SETCOL(255, 255, 255);
|
2021-11-07 16:58:50 +00:00
|
|
|
if (gAudioSfxSwapOff) {
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "SWAP OFF");
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapIsEditing == 0) {
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
} else {
|
|
|
|
SETCOL(127, 127, 127);
|
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_SetPos(printer, 2, 6 + sAudioSfxSwapSel);
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "*");
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
ctr = sAudioSfxSwapNibbleSel;
|
|
|
|
if (sAudioSfxSwapNibbleSel >= 4) {
|
2021-08-30 00:08:41 +00:00
|
|
|
ctr++;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapIsEditing == 1) {
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 3 + ctr, 5);
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "V");
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
for (i = 0; i < 10; i++) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (i == sAudioSfxSwapSel) {
|
|
|
|
if (sAudioSfxSwapIsEditing == 0) {
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(192, 192, 192);
|
|
|
|
} else {
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
} else if (sAudioSfxSwapIsEditing == 0) {
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(144, 144, 144);
|
|
|
|
} else {
|
|
|
|
SETCOL(96, 96, 96);
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 3, 6 + i);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "%04x %04x %s", gAudioSfxSwapSource[i], gAudioSfxSwapTarget[i],
|
|
|
|
sAudioSfxSwapModeNames[gAudioSfxSwapMode[i]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_SUB_TRACK_INFO:
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
|
|
|
SETCOL(255, 255, 255);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Group Track:%d", sAudioSubTrackInfoPlayerSel);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "Sub Track :%d", sAudioSubTrackInfoChannelSel);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
|
|
|
GfxPrint_Printf(printer, "TRK NO. ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 7);
|
|
|
|
GfxPrint_Printf(printer, "ENTRY ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 8);
|
|
|
|
GfxPrint_Printf(printer, "MUTE ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 9);
|
|
|
|
GfxPrint_Printf(printer, "OPENNOTE");
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
ctr2 = 0;
|
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
if (i == sAudioSubTrackInfoChannelSel) {
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
} else {
|
|
|
|
SETCOL(200, 200, 200);
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 15 + i, 6);
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "%1X", i);
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 15 + i, 7);
|
|
|
|
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->enabled) {
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "O");
|
|
|
|
} else {
|
|
|
|
GfxPrint_Printf(printer, "X");
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 15 + i, 8);
|
|
|
|
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->stopSomething2) {
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "O");
|
|
|
|
} else {
|
|
|
|
GfxPrint_Printf(printer, "X");
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 15 + i, 9);
|
|
|
|
ctr = 0;
|
|
|
|
for (j = 0; j < 4; j++) {
|
|
|
|
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->layers[j] != NULL) {
|
|
|
|
ctr++;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%1X", ctr);
|
|
|
|
ctr2 += ctr;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SETCOL(255, 255, 255);
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sSeqPlayerPeakNumLayers[sAudioSubTrackInfoPlayerSel] < ctr2) {
|
|
|
|
sSeqPlayerPeakNumLayers[sAudioSubTrackInfoPlayerSel] = ctr2;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 16 + i, 9);
|
|
|
|
GfxPrint_Printf(printer, "%2d,%2d", ctr2, sSeqPlayerPeakNumLayers[sAudioSubTrackInfoPlayerSel]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 11);
|
|
|
|
GfxPrint_Printf(printer, "VOL ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 12);
|
|
|
|
GfxPrint_Printf(printer, "E VOL ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 13);
|
|
|
|
GfxPrint_Printf(printer, "BANK ID ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 14);
|
|
|
|
GfxPrint_Printf(printer, "PROG ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 15);
|
|
|
|
GfxPrint_Printf(printer, "PAN ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 16);
|
|
|
|
GfxPrint_Printf(printer, "PANPOW ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 17);
|
|
|
|
GfxPrint_Printf(printer, "FXMIX ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 18);
|
|
|
|
GfxPrint_Printf(printer, "PRIO ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 19);
|
|
|
|
GfxPrint_Printf(printer, "VIB PIT ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 20);
|
|
|
|
GfxPrint_Printf(printer, "VIB DEP ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 21);
|
|
|
|
GfxPrint_Printf(printer, "TUNE ");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 22);
|
|
|
|
GfxPrint_Printf(printer, "TUNE ");
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
GfxPrint_SetPos(printer, 15 + 3 * i, 22);
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "%02X ",
|
2021-08-30 00:08:41 +00:00
|
|
|
(u8)gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->soundScriptIO[i]);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->enabled) {
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_SetPos(printer, 15, 11);
|
|
|
|
GfxPrint_Printf(printer, "%d",
|
2021-08-30 00:08:41 +00:00
|
|
|
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->volume *
|
|
|
|
127.1));
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 12);
|
|
|
|
GfxPrint_Printf(printer, "%d",
|
2021-08-30 00:08:41 +00:00
|
|
|
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->volumeScale *
|
|
|
|
127.1));
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 13);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%X",
|
|
|
|
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
2021-11-07 16:58:50 +00:00
|
|
|
->fontId);
|
2021-08-30 00:08:41 +00:00
|
|
|
|
|
|
|
ctr = (u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->instOrWave);
|
|
|
|
|
|
|
|
if (ctr == 0) {
|
|
|
|
ctr2 = 0x7F;
|
|
|
|
} else if (ctr < 0x80) {
|
|
|
|
ctr2 = ctr - 1;
|
2021-08-12 19:37:37 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
ctr2 = ctr;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 14);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%d", ctr2);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 15);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%d",
|
|
|
|
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->newPan);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 16);
|
|
|
|
GfxPrint_Printf(printer, "%d",
|
2021-08-30 00:08:41 +00:00
|
|
|
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->panChannelWeight);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 17);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%d",
|
|
|
|
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->reverb);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 18);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%d",
|
|
|
|
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->notePriority);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 19);
|
|
|
|
GfxPrint_Printf(printer, "%d",
|
2021-08-30 00:08:41 +00:00
|
|
|
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->vibratoRateTarget /
|
|
|
|
32));
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 20);
|
|
|
|
GfxPrint_Printf(printer, "%d",
|
2021-08-30 00:08:41 +00:00
|
|
|
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->vibratoExtentTarget /
|
|
|
|
8));
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 15, 21);
|
|
|
|
GfxPrint_Printf(printer, "%d",
|
2021-08-30 00:08:41 +00:00
|
|
|
(u16)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
|
|
|
.channels[sAudioSubTrackInfoChannelSel]
|
|
|
|
->freqScale *
|
|
|
|
100));
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_HEAP_INFO:
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "TOTAL %d", D_8014A6C4.heapSize);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
|
|
|
GfxPrint_Printf(printer, "DRIVER %05X / %05X",
|
|
|
|
gAudioContext.notesAndBuffersPool.cur - gAudioContext.notesAndBuffersPool.start,
|
|
|
|
gAudioContext.notesAndBuffersPool.size);
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
|
|
|
GfxPrint_Printf(
|
2021-11-07 16:58:50 +00:00
|
|
|
printer, "AT-SEQ %02X-%02X (%05X-%05X / %05X)", (u8)gAudioContext.seqCache.temporary.entries[0].id,
|
|
|
|
(u8)gAudioContext.seqCache.temporary.entries[1].id, gAudioContext.seqCache.temporary.entries[0].size,
|
|
|
|
gAudioContext.seqCache.temporary.entries[1].size, gAudioContext.seqCache.temporary.pool.size);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 7);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(
|
|
|
|
printer, "AT-BNK %02X-%02X (%05X-%05X / %05X)", (u8)gAudioContext.fontCache.temporary.entries[0].id,
|
|
|
|
(u8)gAudioContext.fontCache.temporary.entries[1].id, gAudioContext.fontCache.temporary.entries[0].size,
|
|
|
|
gAudioContext.fontCache.temporary.entries[1].size, gAudioContext.fontCache.temporary.pool.size);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 8);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "ST-SEQ %02Xseqs (%05X / %06X)", gAudioContext.seqCache.persistent.numEntries,
|
|
|
|
gAudioContext.seqCache.persistent.pool.cur - gAudioContext.seqCache.persistent.pool.start,
|
|
|
|
gAudioContext.seqCache.persistent.pool.size);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
for (k = 0; (u32)k < gAudioContext.seqCache.persistent.numEntries; k++) {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 3 + 3 * k, 9);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "%02x", gAudioContext.seqCache.persistent.entries[k].id);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 10);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "ST-BNK %02Xbanks (%05X / %06X)", gAudioContext.fontCache.persistent.numEntries,
|
|
|
|
gAudioContext.fontCache.persistent.pool.cur - gAudioContext.fontCache.persistent.pool.start,
|
|
|
|
gAudioContext.fontCache.persistent.pool.size);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
for (k = 0; (u32)k < gAudioContext.fontCache.persistent.numEntries; k++) {
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 3 + 3 * k, 11);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "%02x", gAudioContext.fontCache.persistent.entries[k].id);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 12);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "E-MEM %05X / %05X",
|
|
|
|
gAudioContext.permanentPool.cur - gAudioContext.permanentPool.start,
|
|
|
|
gAudioContext.permanentPool.size);
|
2021-08-12 19:37:37 +00:00
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_BLOCK_CHANGE_BGM:
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "BGM No. %02X", sAudioBlkChgBgmWork[0]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SCENE SET %02X %s", sAudioBlkChgBgmWork[1],
|
|
|
|
sAudioSceneNames[sAudioBlkChgBgmWork[1]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
SETCOL(0x64, 255, 0x64);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_SetPos(printer, 2, 4 + sAudioBlkChgBgmSel);
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_Printf(printer, "*");
|
|
|
|
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 7);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "NEXT SCENE %02X %s", (u8)gAudioContext.seqPlayers[0].soundScriptIO[2],
|
|
|
|
sAudioSceneNames[(u8)gAudioContext.seqPlayers[0].soundScriptIO[2]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 8);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "NOW SCENE %02X %s", (u8)gAudioContext.seqPlayers[0].soundScriptIO[4],
|
|
|
|
sAudioSceneNames[(u8)gAudioContext.seqPlayers[0].soundScriptIO[4]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 9);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "NOW BLOCK %02X", (gAudioContext.seqPlayers[0].soundScriptIO[5] + 1) & 0xFF);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 11);
|
|
|
|
GfxPrint_Printf(printer, "PORT");
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 12);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "%02X %02X %02X %02X", (u8)gAudioContext.seqPlayers[0].soundScriptIO[0],
|
|
|
|
(u8)gAudioContext.seqPlayers[0].soundScriptIO[1],
|
|
|
|
(u8)gAudioContext.seqPlayers[0].soundScriptIO[2],
|
|
|
|
(u8)gAudioContext.seqPlayers[0].soundScriptIO[3]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 13);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "%02X %02X %02X %02X", (u8)gAudioContext.seqPlayers[0].soundScriptIO[4],
|
|
|
|
(u8)gAudioContext.seqPlayers[0].soundScriptIO[5],
|
|
|
|
(u8)gAudioContext.seqPlayers[0].soundScriptIO[6],
|
|
|
|
(u8)gAudioContext.seqPlayers[0].soundScriptIO[7]);
|
2021-08-12 19:37:37 +00:00
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_OCARINA_TEST:
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
|
|
|
GfxPrint_Printf(printer, "SEQ INFO : %2d %02x %d", sDisplayedStaff.noteIdx, sDisplayedStaff.state,
|
|
|
|
sDisplayedStaff.pos);
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
|
|
|
GfxPrint_Printf(printer, "PLAY INFO : %2d %02x %d", D_8016B9F8.noteIdx, D_8016B9F8.state, D_8016B9F8.pos);
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
|
|
|
GfxPrint_Printf(printer, "8note REC POINTER : %08x", gScarecrowSpawnSongPtr);
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
ctr = 0;
|
|
|
|
for (j = 0; j < 4; j++) {
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
GfxPrint_SetPos(printer, 3 + 3 * i, 7 + j);
|
|
|
|
GfxPrint_Printf(printer, "%02x", gScarecrowSpawnSongPtr[ctr++]);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 24);
|
|
|
|
GfxPrint_Printf(printer, "OCA:%02x SEQ:%04x PLAY:%02x REC:%02x", D_80130F10, D_80130F3C, sPlaybackState,
|
|
|
|
D_80131858);
|
|
|
|
break;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
case PAGE_SFX_PARAMETER_CHANGE:
|
|
|
|
GfxPrint_SetPos(printer, 2, 4 + sAudioSfxParamChgSel);
|
2021-08-12 19:37:37 +00:00
|
|
|
SETCOL(127, 255, 127);
|
|
|
|
GfxPrint_Printf(printer, "*");
|
|
|
|
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "SE HD : %02x %s", sAudioSfxParamChgWork[0],
|
|
|
|
sSoundBankNames[sAudioSfxParamChgWork[0]]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 5);
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_Printf(printer, "SE No. : %02x", sAudioSfxParamChgWork[1]);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 20, 6);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, " : %04x",
|
2021-11-07 16:58:50 +00:00
|
|
|
gSoundParams[sAudioSfxParamChgWork[0]][sAudioSfxParamChgWork[1]].params);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(
|
|
|
|
printer, "SE SW %s",
|
2021-11-07 16:58:50 +00:00
|
|
|
AudioDebug_ToStringBinary(gSoundParams[sAudioSfxParamChgWork[0]][sAudioSfxParamChgWork[1]].params, 16));
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
SETCOL(127, 255, 127);
|
2021-11-07 16:58:50 +00:00
|
|
|
digitStr[0] = (char)('0' + ((gSoundParams[sAudioSfxParamChgWork[0]][sAudioSfxParamChgWork[1]].params >>
|
|
|
|
(15 - sAudioSfxParamChgBitSel)) &
|
2021-08-30 00:08:41 +00:00
|
|
|
1));
|
2021-11-07 16:58:50 +00:00
|
|
|
GfxPrint_SetPos(printer, 12 + sAudioSfxParamChgBitSel, 6);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "%s", digitStr);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
SETCOL(255, 255, 255);
|
|
|
|
GfxPrint_SetPos(printer, 3, 7);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SE PR : %02x",
|
2021-11-07 16:58:50 +00:00
|
|
|
gSoundParams[sAudioSfxParamChgWork[0]][sAudioSfxParamChgWork[1]].importance);
|
2021-08-12 19:37:37 +00:00
|
|
|
break;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
case PAGE_FREE_AREA:
|
2021-08-12 19:37:37 +00:00
|
|
|
GfxPrint_SetPos(printer, 3, 4);
|
|
|
|
SETCOL(255, 255, 255);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "env_fx %d code_fx %d SPEC %d", sAudioEnvReverb, sAudioCodeReverb, gAudioSpecId);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioUpdateTaskStart == sAudioUpdateTaskEnd) {
|
|
|
|
sAudioUpdateDuration = OS_CYCLES_TO_NSEC(sAudioUpdateEndTime - sAudioUpdateStartTime) / (1e9f / 20);
|
|
|
|
if (sAudioUpdateDurationMax < sAudioUpdateDuration) {
|
|
|
|
sAudioUpdateDurationMax = sAudioUpdateDuration;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 6);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SOUND GAME FRAME NOW %f", sAudioUpdateDuration);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 7);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "SOUND GAME FRAME MAX %f", sAudioUpdateDurationMax);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 9);
|
|
|
|
GfxPrint_Printf(printer, "SWITCH BGM MODE %d %d %d (FLAG %d)", D_8013061C, D_80130634, D_80130638,
|
|
|
|
D_80130654);
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 10);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "ENEMY DIST %f VOL %3d", sAudioEnemyDist, sAudioEnemyVol);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 11);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "GANON DIST VOL %3d", sAudioGanonDistVol);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 12);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "DEMO FLAG %d", sAudioCutsceneFlag);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 12);
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioHasMalonBgm == true) {
|
|
|
|
GfxPrint_Printf(printer, "MARON BGM DIST %f", sAudioMalonBgmDist);
|
|
|
|
sAudioHasMalonBgm = false;
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 23);
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioNatureFailed != 0) {
|
|
|
|
GfxPrint_Printf(printer, "NATURE FAILED %01x", sAudioNatureFailed);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 24);
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sSariaBgmPtr != 0) {
|
|
|
|
GfxPrint_Printf(printer, "SARIA BGM PTR %08x", sSariaBgmPtr);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GfxPrint_SetPos(printer, 3, 25);
|
2021-08-30 00:08:41 +00:00
|
|
|
GfxPrint_Printf(printer, "POLI %d(%d)", sPeakNumNotes, numEnabledNotes);
|
2021-08-12 19:37:37 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
for (i = 0; i < 11; i++) {
|
|
|
|
GfxPrint_SetPos(printer, 3 + 3 * i, 26);
|
|
|
|
GfxPrint_Printf(printer, "%d", sAudioSpecPeakNumNotes[i]);
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#undef SETCOL_COMMON
|
|
|
|
#undef SETCOL
|
2021-08-30 00:08:41 +00:00
|
|
|
#undef SETCOL_SCROLLPRINT
|
2021-08-12 19:37:37 +00:00
|
|
|
}
|
2020-07-20 01:08:50 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput_SndCont(void) {
|
|
|
|
u16 step = 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadHold, BTN_CDOWN)) {
|
|
|
|
if (sAudioSndContWorkLims[sAudioSndContSel] >= 16) {
|
|
|
|
step = 16;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (CHECK_BTN_ANY(sDebugPadHold, BTN_CLEFT)) {
|
|
|
|
if (sAudioSndContWorkLims[sAudioSndContSel] >= 16) {
|
|
|
|
step = 8;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (CHECK_BTN_ANY(sDebugPadHold, BTN_CUP)) {
|
|
|
|
sAudioSndContWork[sAudioSndContSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContSel > 0) {
|
|
|
|
sAudioSndContSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSndContSel = 10;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContSel < 10) {
|
|
|
|
sAudioSndContSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSndContSel = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContWork[sAudioSndContSel] >= step) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (1) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSndContWork[sAudioSndContSel] -= step;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSndContWork[sAudioSndContSel] += sAudioSndContWorkLims[sAudioSndContSel] - step;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DRIGHT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContWork[sAudioSndContSel] + step < sAudioSndContWorkLims[sAudioSndContSel]) {
|
|
|
|
sAudioSndContWork[sAudioSndContSel] += step;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSndContWork[sAudioSndContSel] += step - sAudioSndContWorkLims[sAudioSndContSel];
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContSel == 8) {
|
|
|
|
if (sAudioSndContWork[sAudioSndContSel] != 0) {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SetExtraFilter(0x20);
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SetExtraFilter(0);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContSel == 9) {
|
|
|
|
if (sAudioSndContWork[sAudioSndContSel] != 0) {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SetBaseFilter(0x20);
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SetBaseFilter(0);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
switch (sAudioSndContSel) {
|
2021-07-27 23:44:58 +00:00
|
|
|
case 0:
|
|
|
|
case 1:
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_StartSeq(sAudioSndContSel, 0, sAudioSndContWork[sAudioSndContSel]);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
2021-09-01 22:33:37 +00:00
|
|
|
Audio_PlaySoundGeneral(((sAudioSndContWork[2] << 12) & 0xFFFF) + sAudioSndContWork[3] + SFX_FLAG,
|
2021-08-30 00:08:41 +00:00
|
|
|
&D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F6700(sAudioSndContWork[sAudioSndContSel]);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SeqCmdE01(0, sAudioSndContWork[sAudioSndContSel]);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SeqCmdF(0, sAudioSndContWork[sAudioSndContSel]);
|
|
|
|
sAudioSubTrackInfoSpec = sAudioSndContWork[6];
|
|
|
|
if (sAudioSubTrackInfoPlayerSel > gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1) {
|
|
|
|
sAudioSubTrackInfoPlayerSel = gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F6FB4(sAudioSndContWork[sAudioSndContSel]);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
break;
|
|
|
|
case 10:
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetSoundBanksMute(sAudioSndContWork[sAudioSndContSel] * 0x7F);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
switch (sAudioSndContSel) {
|
2021-07-27 23:44:58 +00:00
|
|
|
case 0:
|
|
|
|
case 1:
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SeqCmd1(sAudioSndContSel, 0);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
Audio_SeqCmd1(0, 0);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
case 3:
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StopSfxByBank(sAudioSndContWork[2]);
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CDOWN)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContSel == 0) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (1) {}
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F595C(sAudioSndContWork[sAudioSndContSel]);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CRIGHT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSndContSel == 0) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (1) {}
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F5ACC(sAudioSndContWork[sAudioSndContSel]);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput_IntInfo(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CUP)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioIntInfoY--;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CDOWN)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioIntInfoY++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CLEFT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioIntInfoX--;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CRIGHT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioIntInfoX++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioIntInfoX = 0;
|
|
|
|
sAudioIntInfoY = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP) && sAudioIntInfoSel > 0) {
|
|
|
|
sAudioIntInfoSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN) && sAudioIntInfoSel < 6) {
|
|
|
|
sAudioIntInfoSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT) && sAudioIntInfoBankPage[sAudioIntInfoSel] > 0) {
|
|
|
|
sAudioIntInfoBankPage[sAudioIntInfoSel]--;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DRIGHT) && sAudioIntInfoBankPage[sAudioIntInfoSel] < 4) {
|
|
|
|
sAudioIntInfoBankPage[sAudioIntInfoSel]++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput_ScrPrt(void) {
|
|
|
|
if (sAudioScrPrtWork[0] != 0) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CUP)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtY--;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CDOWN)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtY++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CLEFT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtX--;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CRIGHT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtX++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtX = 26;
|
|
|
|
sAudioScrPrtY = 1;
|
|
|
|
sAudioScrPrtWork[2] = 6;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtInd = 0;
|
|
|
|
sAudioScrPrtOverflow = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioScrPrtSel > 0) {
|
|
|
|
sAudioScrPrtSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtSel = 10;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioScrPrtSel < 10) {
|
|
|
|
sAudioScrPrtSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtSel = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioScrPrtWork[sAudioScrPrtSel] > 0) {
|
|
|
|
sAudioScrPrtWork[sAudioScrPrtSel]--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtWork[sAudioScrPrtSel] = sAudioScrPrtWorkLims[sAudioScrPrtSel] - 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DRIGHT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioScrPrtWork[sAudioScrPrtSel] < sAudioScrPrtWorkLims[sAudioScrPrtSel] - 1) {
|
|
|
|
sAudioScrPrtWork[sAudioScrPrtSel]++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtWork[sAudioScrPrtSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
D_801333F0 = sAudioScrPrtWork[3] + (sAudioScrPrtWork[4] * 2) + (sAudioScrPrtWork[5] * 4) +
|
|
|
|
(sAudioScrPrtWork[6] * 8) + (sAudioScrPrtWork[7] * 0x10) + (sAudioScrPrtWork[8] * 0x20);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void AudioDebug_ProcessInput_SfxSwap(void) {
|
2021-08-30 00:08:41 +00:00
|
|
|
s16 step;
|
2021-08-12 19:37:37 +00:00
|
|
|
u16 val;
|
2021-09-01 22:33:37 +00:00
|
|
|
u8 prev;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (!sAudioSfxSwapIsEditing) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapSel > 0) {
|
|
|
|
sAudioSfxSwapSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxSwapSel = 9;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapSel < 9) {
|
|
|
|
sAudioSfxSwapSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxSwapSel = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxSwapIsEditing = true;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
gAudioSfxSwapSource[sAudioSfxSwapSel] = 0;
|
|
|
|
gAudioSfxSwapTarget[sAudioSfxSwapSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_START)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapSel != 0) {
|
|
|
|
prev = sAudioSfxSwapSel - 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
prev = 9;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
gAudioSfxSwapSource[sAudioSfxSwapSel] = gAudioSfxSwapSource[prev];
|
|
|
|
gAudioSfxSwapTarget[sAudioSfxSwapSel] = gAudioSfxSwapTarget[prev];
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapNibbleSel > 0) {
|
|
|
|
sAudioSfxSwapNibbleSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxSwapNibbleSel = 7;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DRIGHT)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapNibbleSel < 7) {
|
|
|
|
sAudioSfxSwapNibbleSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxSwapNibbleSel = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP) || CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP)) {
|
|
|
|
step = CHECK_BTN_ANY(sDebugPadHold, BTN_CUP) ? 8 : 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
|
|
|
step = CHECK_BTN_ANY(sDebugPadHold, BTN_CUP) ? -8 : -1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapNibbleSel < 4) {
|
|
|
|
val = gAudioSfxSwapSource[sAudioSfxSwapSel] >> ((3 - sAudioSfxSwapNibbleSel) * 4);
|
2021-08-30 00:08:41 +00:00
|
|
|
val = (val + step) & 0xF;
|
2021-11-07 16:58:50 +00:00
|
|
|
gAudioSfxSwapSource[sAudioSfxSwapSel] =
|
|
|
|
(gAudioSfxSwapSource[sAudioSfxSwapSel] &
|
|
|
|
((0xF << ((3 - sAudioSfxSwapNibbleSel) * 4)) ^ 0xFFFF)) +
|
|
|
|
(val << ((3 - sAudioSfxSwapNibbleSel) * 4));
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
val = gAudioSfxSwapTarget[sAudioSfxSwapSel] >> ((7 - sAudioSfxSwapNibbleSel) * 4);
|
2021-08-30 00:08:41 +00:00
|
|
|
val = (val + step) & 0xF;
|
2021-11-07 16:58:50 +00:00
|
|
|
gAudioSfxSwapTarget[sAudioSfxSwapSel] =
|
|
|
|
(gAudioSfxSwapTarget[sAudioSfxSwapSel] &
|
|
|
|
((0xF << ((7 - sAudioSfxSwapNibbleSel) * 4)) ^ 0xFFFF)) +
|
|
|
|
(val << ((7 - sAudioSfxSwapNibbleSel) * 4));
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxSwapIsEditing = false;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxSwapNibbleSel < 4) {
|
|
|
|
gAudioSfxSwapSource[sAudioSfxSwapSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
gAudioSfxSwapTarget[sAudioSfxSwapSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CLEFT)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
gAudioSfxSwapOff ^= 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CDOWN)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
gAudioSfxSwapMode[sAudioSfxSwapSel] ^= 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput_SubTrackInfo(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSubTrackInfoPlayerSel != 0) {
|
|
|
|
sAudioSubTrackInfoPlayerSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSubTrackInfoPlayerSel = gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioSubTrackInfoPlayerSel < gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1) {
|
|
|
|
sAudioSubTrackInfoPlayerSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSubTrackInfoPlayerSel = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSubTrackInfoChannelSel = (sAudioSubTrackInfoChannelSel - 1) & 0xF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DRIGHT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioSubTrackInfoChannelSel = (sAudioSubTrackInfoChannelSel + 1) & 0xF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_START)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sSeqPlayerPeakNumLayers[sAudioSubTrackInfoPlayerSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput_HeapInfo(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput_BlkChgBgm(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioBlkChgBgmSel > 0) {
|
|
|
|
sAudioBlkChgBgmSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioBlkChgBgmSel = 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioBlkChgBgmSel <= 0) {
|
|
|
|
sAudioBlkChgBgmSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioBlkChgBgmSel = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioBlkChgBgmWork[sAudioBlkChgBgmSel]--;
|
|
|
|
if (sAudioBlkChgBgmSel == 1) {
|
|
|
|
func_800F5E90(sAudioBlkChgBgmWork[1]);
|
2021-07-27 23:44:58 +00:00
|
|
|
; // might be a fake match?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DRIGHT)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioBlkChgBgmWork[sAudioBlkChgBgmSel]++;
|
|
|
|
if (sAudioBlkChgBgmSel == 1) {
|
|
|
|
func_800F5E90(sAudioBlkChgBgmWork[1]);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_QueueCmdS8(MK_CMD(0x46, 0x00, 0x00, 0x00), sAudioBlkChgBgmWork[1]);
|
|
|
|
Audio_QueueSeqCmd(sAudioBlkChgBgmWork[0] | 0x10000);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
|
|
|
Audio_QueueSeqCmd(0x100100FF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput_OcaTest(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void AudioDebug_ProcessInput_SfxParamChg(void) {
|
2021-08-30 00:08:41 +00:00
|
|
|
s32 step;
|
2021-07-27 23:44:58 +00:00
|
|
|
u16 sfx;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadHold, BTN_CLEFT)) {
|
|
|
|
step = 8;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
step = 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DUP)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxParamChgSel > 0) {
|
|
|
|
sAudioSfxParamChgSel--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgSel = 3;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DDOWN)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxParamChgSel < 3) {
|
|
|
|
sAudioSfxParamChgSel++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgSel = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxParamChgSel < 2) {
|
|
|
|
if (sAudioSfxParamChgSel == 0) {
|
|
|
|
if (sAudioSfxParamChgWork[sAudioSfxParamChgSel] > 0) {
|
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel]--;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel] = sAudioSndContWorkLims[2] - 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel] -= step;
|
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel] &= 0x1FF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
} else if (sAudioSfxParamChgSel == 3) {
|
|
|
|
gSoundParams[sAudioSfxParamChgWork[0]][sAudioSfxParamChgWork[1]].importance -= step;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgBitSel = (sAudioSfxParamChgBitSel - 1) & 0xF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_DRIGHT)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxParamChgSel < 2) {
|
|
|
|
if (sAudioSfxParamChgSel == 0) {
|
|
|
|
if (sAudioSfxParamChgWork[sAudioSfxParamChgSel] < (sAudioSndContWorkLims[2] - 1)) {
|
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel]++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel] += step;
|
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel] &= 0x1FF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
} else if (sAudioSfxParamChgSel == 3) {
|
|
|
|
gSoundParams[sAudioSfxParamChgWork[0]][sAudioSfxParamChgWork[1]].importance += step;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxParamChgBitSel = (sAudioSfxParamChgBitSel + 1) & 0xF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
sfx = (u16)(sAudioSfxParamChgWork[0] << 12) + sAudioSfxParamChgWork[1] + SFX_FLAG;
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_PlaySoundGeneral(sfx, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StopSfxByBank(sAudioSfxParamChgWork[0]);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CDOWN)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxParamChgSel == 2) {
|
|
|
|
gSoundParams[sAudioSfxParamChgWork[0]][sAudioSfxParamChgWork[1]].params ^=
|
|
|
|
(1 << (0xF - sAudioSfxParamChgBitSel));
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
2021-07-27 23:44:58 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_CUP)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxParamChgSel < 2) {
|
|
|
|
sAudioSfxParamChgWork[sAudioSfxParamChgSel] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ScrPrt(const s8* str, u16 num) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 i = 0;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtBuf[sAudioScrPrtInd].num = num;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-12 19:37:37 +00:00
|
|
|
while (str[i] != 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtBuf[sAudioScrPrtInd].str[i] = str[i];
|
2021-07-27 23:44:58 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (i < 5) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtBuf[sAudioScrPrtInd].str[i] = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioScrPrtInd < 25 - 1) {
|
|
|
|
sAudioScrPrtInd++;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioScrPrtInd = 0;
|
|
|
|
sAudioScrPrtOverflow = 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void AudioDebug_ProcessInput(void) {
|
|
|
|
if (!sAudioDebugEverOpened) {
|
|
|
|
return;
|
|
|
|
}
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioSfxMuted) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetSoundBanksMute(0x6F);
|
|
|
|
}
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_L)) {
|
|
|
|
if (sAudioDebugPage < PAGE_MAX - 1) {
|
|
|
|
sAudioDebugPage++;
|
|
|
|
} else {
|
|
|
|
sAudioDebugPage = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
}
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_R)) {
|
|
|
|
if (sAudioDebugPage > 0) {
|
|
|
|
sAudioDebugPage--;
|
|
|
|
} else {
|
|
|
|
sAudioDebugPage = PAGE_MAX - 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
}
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_Z)) {
|
|
|
|
sAudioDebugTextColor++;
|
|
|
|
sAudioDebugTextColor &= 7;
|
|
|
|
}
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
switch (sAudioDebugPage) {
|
|
|
|
case PAGE_NON:
|
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) {
|
|
|
|
sAudioSndContWork[5] ^= 1;
|
|
|
|
Audio_SeqCmdE01(0, sAudioSndContWork[5]);
|
2021-11-01 17:54:19 +00:00
|
|
|
if (func_800FA0B4(0) != NA_BGM_NATURE_BACKGROUND) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SeqCmd1(0, 0);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SeqCmd1(1, 0);
|
|
|
|
Audio_SeqCmd1(3, 0);
|
|
|
|
}
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioSfxMuted ^= 1;
|
|
|
|
if (!sAudioSfxMuted) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetSoundBanksMute(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PAGE_SOUND_CONTROL:
|
|
|
|
AudioDebug_ProcessInput_SndCont();
|
|
|
|
break;
|
|
|
|
case PAGE_INTERFACE_INFO:
|
|
|
|
AudioDebug_ProcessInput_IntInfo();
|
|
|
|
break;
|
|
|
|
case PAGE_SCROLL_PRINT:
|
|
|
|
AudioDebug_ProcessInput_ScrPrt();
|
|
|
|
break;
|
2021-11-07 16:58:50 +00:00
|
|
|
case PAGE_SFX_SWAP:
|
|
|
|
AudioDebug_ProcessInput_SfxSwap();
|
2021-08-30 00:08:41 +00:00
|
|
|
break;
|
|
|
|
case PAGE_SUB_TRACK_INFO:
|
|
|
|
AudioDebug_ProcessInput_SubTrackInfo();
|
|
|
|
break;
|
|
|
|
case PAGE_HEAP_INFO:
|
|
|
|
AudioDebug_ProcessInput_HeapInfo();
|
|
|
|
break;
|
|
|
|
case PAGE_BLOCK_CHANGE_BGM:
|
|
|
|
AudioDebug_ProcessInput_BlkChgBgm();
|
|
|
|
break;
|
|
|
|
case PAGE_OCARINA_TEST:
|
|
|
|
AudioDebug_ProcessInput_OcaTest();
|
|
|
|
break;
|
2021-11-07 16:58:50 +00:00
|
|
|
case PAGE_SFX_PARAMETER_CHANGE:
|
|
|
|
AudioDebug_ProcessInput_SfxParamChg();
|
2021-08-30 00:08:41 +00:00
|
|
|
break;
|
|
|
|
case PAGE_FREE_AREA:
|
|
|
|
default:
|
|
|
|
break;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
|
|
|
|
D_8013340C = sAudioScrPrtWork[10];
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4A70(void);
|
|
|
|
void func_800F5CF8(void);
|
|
|
|
|
2021-08-19 22:10:51 +00:00
|
|
|
void func_800F3054(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (func_800FAD34() == 0) {
|
|
|
|
sAudioUpdateTaskStart = gAudioContext.totalTaskCnt;
|
|
|
|
sAudioUpdateStartTime = osGetTime();
|
|
|
|
func_800EE6F4();
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_StepFreqLerp(&sRiverFreqScaleLerp);
|
|
|
|
Audio_StepFreqLerp(&sWaterfallFreqScaleLerp);
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800F4A70();
|
|
|
|
func_800F56A8();
|
|
|
|
func_800F5CF8();
|
2021-08-30 00:08:41 +00:00
|
|
|
if (gAudioSpecId == 7) {
|
|
|
|
Audio_ClearSariaBgm();
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_ProcessSoundRequests();
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_ProcessSeqCmds();
|
|
|
|
func_800F8F88();
|
|
|
|
func_800FA3DC();
|
2021-08-30 00:08:41 +00:00
|
|
|
AudioDebug_SetInput();
|
|
|
|
AudioDebug_ProcessInput();
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_ScheduleProcessCmds();
|
|
|
|
sAudioUpdateTaskEnd = gAudioContext.totalTaskCnt;
|
|
|
|
sAudioUpdateEndTime = osGetTime();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F3138(UNK_TYPE arg0) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F3140(UNK_TYPE arg0, UNK_TYPE arg1) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F314C(s8 arg0) {
|
|
|
|
Audio_QueueCmdS32(0x82000000 | (((u8)arg0 & 0xFF) << 8), 1);
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
f32 Audio_ComputeSoundVolume(u8 bankId, u8 entryIdx) {
|
|
|
|
SoundBankEntry* bankEntry = &gSoundBanks[bankId][entryIdx];
|
|
|
|
f32 minDist;
|
|
|
|
f32 baseDist;
|
2021-07-27 23:44:58 +00:00
|
|
|
f32 ret;
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (bankEntry->sfxParams & 0x2000) {
|
2021-07-27 23:44:58 +00:00
|
|
|
return 1.0f;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (bankEntry->dist > 10000.0f) {
|
2021-07-27 23:44:58 +00:00
|
|
|
ret = 0.0f;
|
|
|
|
} else {
|
2021-09-01 22:33:37 +00:00
|
|
|
switch (bankEntry->sfxParams & 3) {
|
2021-07-27 23:44:58 +00:00
|
|
|
case 1:
|
2021-11-07 16:58:50 +00:00
|
|
|
baseDist = 10000.0f / 15.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-11-07 16:58:50 +00:00
|
|
|
baseDist = 10000.0f / 10.5f;
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-11-07 16:58:50 +00:00
|
|
|
baseDist = 10000.0f / 2.6f;
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
default:
|
2021-11-07 16:58:50 +00:00
|
|
|
baseDist = 10000.0f / 20.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
minDist = baseDist / 5.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
// Volume grows as inverse square of distance. Linearly approximate
|
|
|
|
// the inverse part, then square.
|
|
|
|
if (bankEntry->dist < minDist) {
|
2021-07-27 23:44:58 +00:00
|
|
|
ret = 1.0f;
|
2021-11-07 16:58:50 +00:00
|
|
|
} else if (bankEntry->dist < baseDist) {
|
|
|
|
ret = ((((baseDist - minDist) - (bankEntry->dist - minDist)) / (baseDist - minDist)) * 0.19f) + 0.81f;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
ret = (1.0f - ((bankEntry->dist - baseDist) / (10000.0f - baseDist))) * 0.81f;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
ret = SQ(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
s8 Audio_ComputeSoundReverb(u8 bankId, u8 entryIdx, u8 channelIdx) {
|
2021-08-30 00:08:41 +00:00
|
|
|
s8 distAdd = 0;
|
|
|
|
s32 scriptAdd = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
SoundBankEntry* entry = &gSoundBanks[bankId][entryIdx];
|
2021-08-30 00:08:41 +00:00
|
|
|
s32 reverb;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (!(entry->sfxParams & 0x1000)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (entry->dist < 2500.0f) {
|
|
|
|
distAdd = *entry->posZ > 0.0f ? (entry->dist / 2500.0f) * 70.0f : (entry->dist / 2500.0f) * 91.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
distAdd = 70;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[2].channels[channelIdx])) {
|
|
|
|
scriptAdd = gAudioContext.seqPlayers[2].channels[channelIdx]->soundScriptIO[1];
|
|
|
|
if (gAudioContext.seqPlayers[2].channels[channelIdx]->soundScriptIO[1] < 0) {
|
|
|
|
scriptAdd = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
reverb = *entry->reverbAdd + distAdd + scriptAdd;
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((bankId != BANK_OCARINA) || !((entry->sfxId & 0x1FF) < 2)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
reverb += sAudioEnvReverb + sAudioCodeReverb + sSpecReverb;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (reverb > 0x7F) {
|
|
|
|
reverb = 0x7F;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
return reverb;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
s8 Audio_ComputeSoundPanSigned(f32 x, f32 z, u8 token) {
|
2021-08-30 00:08:41 +00:00
|
|
|
f32 absX;
|
|
|
|
f32 absZ;
|
|
|
|
f32 pan;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (x < 0) {
|
|
|
|
absX = -x;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
absX = x;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
if (z < 0) {
|
|
|
|
absZ = -z;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
absZ = z;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (absX > 8000.0f) {
|
|
|
|
absX = 8000.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (absZ > 8000.0f) {
|
|
|
|
absZ = 8000.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if ((x == 0.0f) && (z == 0.0f)) {
|
|
|
|
pan = 0.5f;
|
|
|
|
} else if (absZ <= absX) {
|
|
|
|
pan = (16000.0f - absX) / (3.3f * (16000.0f - absZ));
|
|
|
|
if (x >= 0.0f) {
|
|
|
|
pan = 1.0f - pan;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-11-01 23:29:47 +00:00
|
|
|
pan = (x / (5.0769234f * absZ)) + 0.5f; // about 66 / 13
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (absZ < 50.0f) {
|
|
|
|
if (absX < 50.0f) {
|
|
|
|
pan = ((pan - 0.5f) * SQ(absX / 50.0f)) + 0.5f;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
return (s8)((pan * 127.0f) + 0.5f);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
f32 Audio_ComputeSoundFreqScale(u8 bankId, u8 entryIdx) {
|
2021-07-27 23:44:58 +00:00
|
|
|
s32 phi_v0 = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
SoundBankEntry* entry = &gSoundBanks[bankId][entryIdx];
|
2021-07-27 23:44:58 +00:00
|
|
|
f32 unk1C;
|
|
|
|
f32 freq = 1.0f;
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (entry->sfxParams & 0x4000) {
|
2021-07-27 23:44:58 +00:00
|
|
|
freq = 1.0f - ((gAudioContext.audioRandom & 0xF) / 192.0f);
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
switch (bankId) {
|
2021-07-27 23:44:58 +00:00
|
|
|
case BANK_PLAYER:
|
|
|
|
case BANK_ITEM:
|
|
|
|
case BANK_VOICE:
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioBaseFilter2 != 0) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v0 = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BANK_ENV:
|
|
|
|
case BANK_ENEMY:
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioExtraFilter2 != 0) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v0 = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BANK_SYSTEM:
|
|
|
|
case BANK_OCARINA:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (phi_v0 == 1) {
|
2021-09-01 22:33:37 +00:00
|
|
|
if (!(entry->sfxParams & 0x800)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
freq *= (1.0293 - ((gAudioContext.audioRandom & 0xF) / 144.0f));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
unk1C = entry->dist;
|
2021-09-01 22:33:37 +00:00
|
|
|
if (!(entry->sfxParams & 0x2000)) {
|
|
|
|
if (!(entry->sfxParams & 0x8000)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (unk1C >= 10000.0f) {
|
|
|
|
freq += 0.2f;
|
|
|
|
} else {
|
|
|
|
freq += (0.2f * (unk1C / 10000.0f));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
if (entry->sfxParams & 0xC0) {
|
2021-07-27 23:44:58 +00:00
|
|
|
freq += (entry->unk_2F / 192.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return freq;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 func_800F37B8(f32 behindScreenZ, SoundBankEntry* arg1, s8 arg2) {
|
2021-07-27 23:44:58 +00:00
|
|
|
s8 phi_v0;
|
|
|
|
u8 phi_v1;
|
|
|
|
f32 phi_f0;
|
|
|
|
f32 phi_f12;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (*arg1->posZ < behindScreenZ) {
|
2021-08-12 19:37:37 +00:00
|
|
|
phi_v0 = arg2 < 65 ? arg2 : 0x7F - arg2;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-12 19:37:37 +00:00
|
|
|
if (phi_v0 < 30) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v1 = 0;
|
|
|
|
} else {
|
2021-08-12 19:37:37 +00:00
|
|
|
phi_v1 = (((phi_v0 & 0xFFFF) * 10) - 300) / 34;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (phi_v1 != 0) {
|
|
|
|
phi_v1 = 0x10 - phi_v1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
phi_v1 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (phi_v1 == 0) {
|
2021-09-01 22:33:37 +00:00
|
|
|
if (arg1->sfxParams & 0x200) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v1 = 0xF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
switch (arg1->sfxParams & 3) {
|
2021-07-27 23:44:58 +00:00
|
|
|
case 1:
|
|
|
|
phi_f0 = 12.0f;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
phi_f0 = 9.0f;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
phi_f0 = 6.0f;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
phi_f0 = 15.0f;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-11-01 23:29:47 +00:00
|
|
|
phi_f12 = CLAMP_MAX(arg1->dist, 10000.0f / 5.2f);
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-01 23:29:47 +00:00
|
|
|
return (phi_v1 * 0x10) + (u8)((phi_f0 * phi_f12) / (10000.0f / 5.2f));
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-09-01 22:33:37 +00:00
|
|
|
s8 func_800F3990(f32 arg0, u16 sfxParams) {
|
2021-07-27 23:44:58 +00:00
|
|
|
s8 ret = 0;
|
|
|
|
|
|
|
|
if (arg0 >= 0.0f) {
|
|
|
|
if (arg0 > 625.0f) {
|
2021-08-12 19:37:37 +00:00
|
|
|
ret = 127;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
|
|
|
ret = (arg0 / 625.0f) * 126.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret | 1;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void Audio_SetSoundProperties(u8 bankId, u8 entryIdx, u8 channelIdx) {
|
|
|
|
f32 vol = 1.0f;
|
|
|
|
s8 volS8;
|
2021-08-30 00:08:41 +00:00
|
|
|
s8 reverb = 0;
|
|
|
|
f32 freqScale = 1.0f;
|
|
|
|
s8 panSigned = 0x40;
|
2021-08-31 22:53:35 +00:00
|
|
|
u8 stereoBits = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 filter = 0;
|
2021-08-30 00:08:41 +00:00
|
|
|
s8 sp38 = 0;
|
2021-11-07 16:58:50 +00:00
|
|
|
f32 behindScreenZ;
|
|
|
|
u8 baseFilter = 0;
|
|
|
|
SoundBankEntry* entry = &gSoundBanks[bankId][entryIdx];
|
2021-08-30 00:08:41 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
switch (bankId) {
|
2021-07-27 23:44:58 +00:00
|
|
|
case BANK_PLAYER:
|
|
|
|
case BANK_ITEM:
|
|
|
|
case BANK_ENV:
|
|
|
|
case BANK_ENEMY:
|
|
|
|
case BANK_VOICE:
|
|
|
|
if (D_80130604 == 2) {
|
2021-09-01 22:33:37 +00:00
|
|
|
sp38 = func_800F3990(*entry->posY, entry->sfxParams);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
// fallthrough
|
2021-07-27 23:44:58 +00:00
|
|
|
case BANK_OCARINA:
|
2021-08-30 00:08:41 +00:00
|
|
|
entry->dist = sqrtf(entry->dist);
|
2021-11-07 16:58:50 +00:00
|
|
|
vol = Audio_ComputeSoundVolume(bankId, entryIdx) * *entry->vol;
|
|
|
|
reverb = Audio_ComputeSoundReverb(bankId, entryIdx, channelIdx);
|
|
|
|
panSigned = Audio_ComputeSoundPanSigned(*entry->posX, *entry->posZ, entry->token);
|
|
|
|
freqScale = Audio_ComputeSoundFreqScale(bankId, entryIdx) * *entry->freqScale;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (D_80130604 == 2) {
|
2021-11-07 16:58:50 +00:00
|
|
|
behindScreenZ = sBehindScreenZ[(entry->sfxParams & 0x400) >> 10];
|
2021-09-01 22:33:37 +00:00
|
|
|
if (!(entry->sfxParams & 0x800)) {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (*entry->posZ < behindScreenZ) {
|
2021-08-31 22:53:35 +00:00
|
|
|
stereoBits = 0x10;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((sSfxChannelState[channelIdx].stereoBits ^ stereoBits) & 0x10) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (panSigned < 0x40) {
|
2021-11-07 16:58:50 +00:00
|
|
|
stereoBits = sSfxChannelState[channelIdx].stereoBits ^ 0x14;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
stereoBits = sSfxChannelState[channelIdx].stereoBits ^ 0x18;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
stereoBits = sSfxChannelState[channelIdx].stereoBits;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sAudioBaseFilter != 0) {
|
|
|
|
if ((bankId == BANK_ITEM) || (bankId == BANK_PLAYER) || (bankId == BANK_VOICE)) {
|
|
|
|
baseFilter = sAudioBaseFilter;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((baseFilter | sAudioExtraFilter) != 0) {
|
|
|
|
filter = (baseFilter | sAudioExtraFilter);
|
2021-09-01 22:33:37 +00:00
|
|
|
} else if (D_80130604 == 2 && (entry->sfxParams & 0x2000) == 0) {
|
2021-11-07 16:58:50 +00:00
|
|
|
filter = func_800F37B8(behindScreenZ, entry, panSigned);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BANK_SYSTEM:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sSfxChannelState[channelIdx].vol != vol) {
|
|
|
|
volS8 = (u8)(vol * 127.0f);
|
|
|
|
sSfxChannelState[channelIdx].vol = vol;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
volS8 = -1;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
// CHAN_UPD_SCRIPT_IO (slot 2, sets volume)
|
|
|
|
Audio_QueueCmdS8(0x6020000 | (channelIdx << 8) | 2, volS8);
|
|
|
|
if (reverb != sSfxChannelState[channelIdx].reverb) {
|
2021-08-12 19:37:37 +00:00
|
|
|
Audio_QueueCmdS8(0x5020000 | (channelIdx << 8), reverb);
|
2021-11-07 16:58:50 +00:00
|
|
|
sSfxChannelState[channelIdx].reverb = reverb;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
if (freqScale != sSfxChannelState[channelIdx].freqScale) {
|
2021-08-12 19:37:37 +00:00
|
|
|
Audio_QueueCmdF32(0x4020000 | (channelIdx << 8), freqScale);
|
2021-11-07 16:58:50 +00:00
|
|
|
sSfxChannelState[channelIdx].freqScale = freqScale;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
if (stereoBits != sSfxChannelState[channelIdx].stereoBits) {
|
2021-08-31 22:53:35 +00:00
|
|
|
Audio_QueueCmdS8(0xE020000 | (channelIdx << 8), stereoBits | 0x10);
|
2021-11-07 16:58:50 +00:00
|
|
|
sSfxChannelState[channelIdx].stereoBits = stereoBits;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
if (filter != sSfxChannelState[channelIdx].filter) {
|
|
|
|
// CHAN_UPD_SCRIPT_IO (slot 3, sets filter)
|
|
|
|
Audio_QueueCmdS8(0x6020000 | (channelIdx << 8) | 3, filter);
|
|
|
|
sSfxChannelState[channelIdx].filter = filter;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
if (sp38 != sSfxChannelState[channelIdx].unk_0C) {
|
2021-08-30 00:08:41 +00:00
|
|
|
// CHAN_UPD_UNK_0F
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdS8(0xC020000 | (channelIdx << 8), 0x10);
|
2021-08-30 00:08:41 +00:00
|
|
|
// CHAN_UPD_UNK_20
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdU16(0xD020000 | (channelIdx << 8), ((u16)(sp38) << 8) + 0xFF);
|
2021-11-07 16:58:50 +00:00
|
|
|
sSfxChannelState[channelIdx].unk_0C = sp38;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
if (panSigned != sSfxChannelState[channelIdx].panSigned) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_QueueCmdS8(0x3020000 | (channelIdx << 8), panSigned);
|
2021-11-07 16:58:50 +00:00
|
|
|
sSfxChannelState[channelIdx].panSigned = panSigned;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void Audio_ResetSfxChannelState(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 i;
|
2021-11-07 16:58:50 +00:00
|
|
|
SfxPlayerState* state;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2021-11-07 16:58:50 +00:00
|
|
|
state = &sSfxChannelState[i];
|
|
|
|
state->vol = 1.0f;
|
|
|
|
state->freqScale = 1.0f;
|
|
|
|
state->reverb = 0;
|
|
|
|
state->panSigned = 0x40;
|
|
|
|
state->stereoBits = 0;
|
|
|
|
state->filter = 0xFF;
|
|
|
|
state->unk_0C = 0xFF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
sSfxChannelState[SFX_PLAYER_CHANNEL_OCARINA].unk_0C = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8013061C = 0;
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioCodeReverb = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F3F3C(u8 arg0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (gSoundBankMuted[0] != 1) {
|
2021-11-01 17:54:19 +00:00
|
|
|
Audio_StartSeq(3, 0, NA_BGM_VARIOUS_SFX);
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmd8(3, 0, 0, arg0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
f32 func_800F3F84(f32 arg0) {
|
|
|
|
f32 ret = 1.0f;
|
|
|
|
|
|
|
|
if (arg0 > 6.0f) {
|
|
|
|
D_8016B7A8 = 1.0f;
|
|
|
|
D_8016B7B0 = 1.1f;
|
|
|
|
} else {
|
|
|
|
ret = arg0 / 6.0f;
|
|
|
|
D_8016B7A8 = (ret * 0.22500002f) + 0.775f;
|
|
|
|
D_8016B7B0 = (ret * 0.2f) + 0.9f;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F4010(Vec3f* pos, u16 sfxId, f32 arg2) {
|
2021-07-27 23:44:58 +00:00
|
|
|
f32 sp24;
|
|
|
|
f32 phi_f0;
|
|
|
|
u8 phi_v0;
|
2021-08-30 00:08:41 +00:00
|
|
|
u16 sfxId2;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
D_80131C8C = arg2;
|
|
|
|
sp24 = func_800F3F84(arg2);
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_8016B7B0, &D_8016B7A8, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if ((sfxId & 0xF0) == 0xB0) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_f0 = 0.3f;
|
|
|
|
phi_v0 = 1;
|
|
|
|
sp24 = 1.0f;
|
|
|
|
} else {
|
|
|
|
phi_f0 = 1.1f;
|
|
|
|
phi_v0 = gAudioContext.audioRandom % 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((phi_f0 < arg2) && (phi_v0 != 0)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if ((sfxId & 0x80) != 0) {
|
|
|
|
sfxId2 = NA_SE_PL_METALEFFECT_ADULT;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
sfxId2 = NA_SE_PL_METALEFFECT_KID;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
D_8016B7AC = (sp24 * 0.7) + 0.3;
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(sfxId2, pos, 4, &D_8016B7B0, &D_8016B7AC, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4138(Vec3f* pos, u16 sfxId, f32 arg2) {
|
|
|
|
func_800F3F84(arg2);
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_8016B7B0, &D_8016B7A8, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4190(Vec3f* pos, u16 sfxId) {
|
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_801305B0, &D_801333E0, &D_801305B4);
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySoundRandom(Vec3f* pos, u16 baseSfxId, u8 randLim) {
|
|
|
|
u8 offset = Audio_NextRandom() % randLim;
|
|
|
|
|
|
|
|
Audio_PlaySoundGeneral(baseSfxId + offset, pos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4254(Vec3f* pos, u8 level) {
|
|
|
|
level &= 3;
|
|
|
|
if (level != sPrevChargeLevel) {
|
|
|
|
D_801305F4 = D_801305E4[level];
|
|
|
|
switch (level) {
|
|
|
|
case 1:
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_PL_SWORD_CHARGE, pos, 4, &D_801305F4, &D_801333E0, &D_801333E8);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_PL_SWORD_CHARGE, pos, 4, &D_801305F4, &D_801333E0, &D_801333E8);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sPrevChargeLevel = level;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (level != 0) {
|
|
|
|
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_CHARGE - SFX_FLAG, pos, 4, &D_801305F4, &D_801333E0, &D_801333E8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F436C(Vec3f* pos, u16 sfxId, f32 arg2) {
|
|
|
|
if (arg2 < 0.75f) {
|
|
|
|
D_8016B7D8 = ((arg2 / 0.75f) * 0.25f) + 0.5f;
|
|
|
|
} else {
|
|
|
|
D_8016B7D8 = arg2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (D_8016B7D8 > 0.5f) {
|
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_8016B7D8, &D_801333E0, &D_801333E8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4414(Vec3f* pos, u16 sfxId, f32 arg2) {
|
|
|
|
D_801305B8--;
|
|
|
|
if (D_801305B8 == 0) {
|
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_8016B7D8, &D_801333E0, &D_801333E8);
|
|
|
|
|
|
|
|
if (arg2 > 2.0f) {
|
|
|
|
arg2 = 2.0f;
|
|
|
|
}
|
|
|
|
D_801305B8 = (s8)((D_801305C0 - D_801305BC) * (1.0f - arg2)) + D_801305C0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F44EC(s8 arg0, s8 arg1) {
|
|
|
|
D_801305B8 = 1;
|
|
|
|
D_801305BC = arg1;
|
|
|
|
D_801305C0 = arg0;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F4524(Vec3f* pos, u16 sfxId, s8 arg2) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016B7DC = arg2;
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_801333E0, &D_801333E0, &D_8016B7DC);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F4578(Vec3f* pos, u16 sfxId, f32 arg2) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016B7E0 = arg2;
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_801333E0, &D_8016B7E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F45D0(f32 arg0) {
|
|
|
|
func_800F4414(&D_801333D4, NA_SE_IT_FISHING_REEL_SLOW - SFX_FLAG, arg0);
|
|
|
|
func_800F436C(&D_801333D4, 0, (0.15f * arg0) + 1.4f);
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySoundRiver(Vec3f* pos, f32 freqScale) {
|
|
|
|
if (!Audio_IsSfxPlaying(NA_SE_EV_RIVER_STREAM - SFX_FLAG)) {
|
|
|
|
sRiverFreqScaleLerp.value = freqScale;
|
|
|
|
} else if (freqScale != sRiverFreqScaleLerp.value) {
|
|
|
|
sRiverFreqScaleLerp.target = freqScale;
|
|
|
|
sRiverFreqScaleLerp.remainingFrames = 40;
|
|
|
|
sRiverFreqScaleLerp.step = (sRiverFreqScaleLerp.target - sRiverFreqScaleLerp.value) / 40;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(NA_SE_EV_RIVER_STREAM - SFX_FLAG, pos, 4, &sRiverFreqScaleLerp.value, &D_801333E0,
|
|
|
|
&D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySoundWaterfall(Vec3f* pos, f32 freqScale) {
|
|
|
|
if (!Audio_IsSfxPlaying(NA_SE_EV_WATER_WALL_BIG - SFX_FLAG)) {
|
|
|
|
sWaterfallFreqScaleLerp.value = freqScale;
|
|
|
|
} else if (freqScale != sWaterfallFreqScaleLerp.value) {
|
|
|
|
sWaterfallFreqScaleLerp.target = freqScale;
|
|
|
|
sWaterfallFreqScaleLerp.remainingFrames = 40;
|
|
|
|
sWaterfallFreqScaleLerp.step = (sWaterfallFreqScaleLerp.target - sWaterfallFreqScaleLerp.value) / 40;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(NA_SE_EV_WATER_WALL_BIG - SFX_FLAG, pos, 4, &sWaterfallFreqScaleLerp.value,
|
|
|
|
&sWaterfallFreqScaleLerp.value, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_StepFreqLerp(FreqLerp* lerp) {
|
|
|
|
if (lerp->remainingFrames != 0) {
|
|
|
|
lerp->remainingFrames--;
|
|
|
|
if (lerp->remainingFrames != 0) {
|
|
|
|
lerp->value += lerp->step;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
lerp->value = lerp->target;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F47BC(void) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetVolScale(0, 1, 0, 10);
|
|
|
|
Audio_SetVolScale(3, 1, 0, 10);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F47FC(void) {
|
|
|
|
Audio_SetVolScale(0, 1, 0x7F, 3);
|
|
|
|
Audio_SetVolScale(3, 1, 0x7F, 3);
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F483C(u8 targetVol, u8 volFadeTimer) {
|
|
|
|
Audio_SetVolScale(0, 0, targetVol, volFadeTimer);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4870(u8 arg0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
s8 pan;
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 i;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
pan = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (arg0 == 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
pan = 0x7F;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2021-08-30 00:08:41 +00:00
|
|
|
// CHAN_UPD_PAN_UNSIGNED
|
|
|
|
Audio_QueueCmdS8(_SHIFTL(0x07, 24, 8) | _SHIFTL(0x00, 16, 8) | _SHIFTL(i, 8, 8) | _SHIFTL(0, 0, 8), pan);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (arg0 == 7) {
|
|
|
|
D_80130600 = 2;
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetGanonDistVol(D_801305F8[arg0 & 7]);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
// (name derived from debug strings, should probably update. used in ganon/ganon_boss scenes)
|
|
|
|
s32 Audio_SetGanonDistVol(u8 targetVol) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 phi_v0;
|
|
|
|
u16 phi_v0_2;
|
|
|
|
u8 i;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioGanonDistVol != targetVol) {
|
|
|
|
Audio_SetVolScale(0, 0, targetVol, 2);
|
|
|
|
if (targetVol < 0x40) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v0 = 0x10;
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
phi_v0 = (((targetVol - 0x40) >> 2) + 1) << 4;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Audio_SeqCmd8(0, 4, 15, phi_v0);
|
|
|
|
for (i = 0; i < 0x10; i++) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (gAudioContext.seqPlayers[0].channels[i] != &gAudioContext.sequenceChannelNone) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if ((u8)gAudioContext.seqPlayers[0].channels[i]->soundScriptIO[5] != 0xFF) {
|
|
|
|
// this looks like some kind of macro?
|
2021-08-30 00:08:41 +00:00
|
|
|
phi_v0_2 = ((u16)gAudioContext.seqPlayers[0].channels[i]->soundScriptIO[5] - targetVol) + 0x7F;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (phi_v0_2 >= 0x80) {
|
|
|
|
phi_v0_2 = 0x7F;
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
// CHAN_UPD_REVERB
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdS8(_SHIFTL(5, 24, 8) | _SHIFTL(0, 16, 8) | _SHIFTL(i, 8, 8) | _SHIFTL(0, 0, 8),
|
|
|
|
(u8)phi_v0_2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioGanonDistVol = targetVol;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4A54(u8 arg0) {
|
|
|
|
D_8016B8B0 = arg0;
|
|
|
|
D_8016B8B2 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F4A70(void) {
|
|
|
|
if (D_8016B8B2 == 1) {
|
|
|
|
if (D_8016B8B1 != D_8016B8B0) {
|
|
|
|
Audio_SetVolScale(0, 0, D_8016B8B0, 0xA);
|
|
|
|
D_8016B8B1 = D_8016B8B0;
|
|
|
|
D_8016B8B3 = 1;
|
|
|
|
}
|
|
|
|
D_8016B8B2 = 0;
|
|
|
|
} else if (D_8016B8B3 == 1 && D_80130608 == 0) {
|
|
|
|
Audio_SetVolScale(0, 0, 0x7F, 0xA);
|
|
|
|
D_8016B8B1 = 0x7F;
|
|
|
|
D_8016B8B3 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (D_80130600 != 0) {
|
|
|
|
D_80130600--;
|
|
|
|
if (D_80130600 == 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetGanonDistVol(D_801305F8[7]);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySoundIncreasinglyTransposed(Vec3f* pos, s16 sfxId, u8* semitones) {
|
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &gNoteFrequencies[semitones[sAudioIncreasingTranspose] + 39], &D_801333E0,
|
|
|
|
&D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioIncreasingTranspose < 15) {
|
|
|
|
sAudioIncreasingTranspose++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_ResetIncreasingTranspose(void) {
|
|
|
|
sAudioIncreasingTranspose = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySoundTransposed(Vec3f* pos, u16 sfxId, s8 semitone) {
|
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &gNoteFrequencies[semitone + 39], &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F4C58(Vec3f* pos, u16 sfxId, u8 arg2) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 phi_s1 = 0;
|
|
|
|
u8 i;
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 bankId;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
bankId = SFX_BANK_SHIFT(sfxId);
|
|
|
|
for (i = 0; i < bankId; i++) {
|
|
|
|
phi_s1 += gChannelsPerBank[gSfxChannelLayout][i];
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) {
|
|
|
|
if ((gActiveSounds[bankId][i].entryIndex != 0xFF) &&
|
|
|
|
(sfxId == gSoundBanks[bankId][gActiveSounds[bankId][i].entryIndex].sfxId)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdS8(_SHIFTL(6, 24, 8) | _SHIFTL(2, 16, 8) | _SHIFTL(phi_s1, 8, 8) | _SHIFTL(6, 0, 8), arg2);
|
|
|
|
}
|
|
|
|
phi_s1++;
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F4E30(Vec3f* pos, f32 arg1) {
|
2021-07-27 23:44:58 +00:00
|
|
|
f32 phi_f22;
|
|
|
|
s8 phi_s4;
|
|
|
|
u8 i;
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sSariaBgmPtr == NULL) {
|
|
|
|
sSariaBgmPtr = pos;
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80130650 = arg1;
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (pos != sSariaBgmPtr) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (arg1 < D_80130650) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sSariaBgmPtr = pos;
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80130650 = arg1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
D_80130650 = arg1;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sSariaBgmPtr->x > 100.0f) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_s4 = 0x7F;
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (sSariaBgmPtr->x < -100.0f) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_s4 = 0;
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
phi_s4 = ((sSariaBgmPtr->x / 100.0f) * 64.0f) + 64.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (D_80130650 > 400.0f) {
|
|
|
|
phi_f22 = 0.1f;
|
|
|
|
} else if (D_80130650 < 120.0f) {
|
|
|
|
phi_f22 = 1.0f;
|
|
|
|
} else {
|
|
|
|
phi_f22 = ((1.0f - ((D_80130650 - 120.0f) / 280.0f)) * 0.9f) + 0.1f;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 0x10; i++) {
|
|
|
|
if (i != 9) {
|
|
|
|
Audio_SeqCmd6(0, 2, i, (127.0f * phi_f22));
|
|
|
|
Audio_QueueCmdS8(0x03000000 | ((u8)((u32)i) << 8), phi_s4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_ClearSariaBgm(void) {
|
|
|
|
if (sSariaBgmPtr != NULL) {
|
|
|
|
sSariaBgmPtr = NULL;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_ClearSariaBgmAtPos(Vec3f* pos) {
|
|
|
|
if (sSariaBgmPtr == pos) {
|
|
|
|
sSariaBgmPtr = NULL;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F510C(s8 volSplit) {
|
|
|
|
u8 vol;
|
|
|
|
u8 prio;
|
|
|
|
u16 channelBits;
|
|
|
|
u8 players[2] = { 0, 3 };
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 i;
|
|
|
|
u8 j;
|
|
|
|
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((func_800FA0B4(1) == NA_BGM_DISABLED) && (func_800FA0B4(3) != NA_BGM_LONLON)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
if (i == 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
vol = volSplit;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
vol = 0x7F - volSplit;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (vol > 100) {
|
|
|
|
prio = 11;
|
|
|
|
} else if (vol < 20) {
|
|
|
|
prio = 2;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
prio = ((vol - 20) / 10) + 2;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
channelBits = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
for (j = 0; j < 0x10; j++) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (gAudioContext.seqPlayers[players[i]].channels[j]->notePriority < prio) {
|
|
|
|
channelBits += (1 << j);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SeqCmdA(players[i], channelBits);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) {
|
|
|
|
f32 absY;
|
|
|
|
f32 dist;
|
|
|
|
u8 vol;
|
|
|
|
f32 prevDist;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (D_8016B9F3 != 0) {
|
|
|
|
D_8016B9F3--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
dist = sqrtf(SQ(pos->z) + SQ(pos->x));
|
|
|
|
if (sSariaBgmPtr == NULL) {
|
|
|
|
sSariaBgmPtr = pos;
|
|
|
|
func_800F5E18(3, seqId, 0, 7, 2);
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
prevDist = sqrtf(SQ(sSariaBgmPtr->z) + SQ(sSariaBgmPtr->x));
|
|
|
|
if (dist < prevDist) {
|
|
|
|
sSariaBgmPtr = pos;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
dist = prevDist;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (pos->y < 0.0f) {
|
|
|
|
absY = -pos->y;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
absY = pos->y;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if ((distMax / 15.0f) < absY) {
|
|
|
|
vol = 0;
|
|
|
|
} else if (dist < distMax) {
|
|
|
|
vol = (1.0f - (dist / distMax)) * 127.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
vol = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-01 17:54:19 +00:00
|
|
|
if (seqId != NA_BGM_GREAT_FAIRY) {
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F510C(vol);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetVolScale(3, 3, vol, 0);
|
|
|
|
Audio_SetVolScale(0, 3, 0x7F - vol, 0);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_ClearSariaBgm2(void) {
|
|
|
|
sSariaBgmPtr = NULL;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F5510(u16 seqId) {
|
|
|
|
func_800F5550(seqId);
|
|
|
|
func_800F5E18(0, seqId, 0, 0, 1);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F5550(u16 seqId) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 sp27 = 0;
|
|
|
|
u16 nv;
|
|
|
|
|
2021-11-01 17:54:19 +00:00
|
|
|
if (func_800FA0B4(0) != NA_BGM_WINDMILL) {
|
|
|
|
if (func_800FA0B4(3) == NA_BGM_LONLON) {
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800F9474(3, 0);
|
|
|
|
Audio_QueueCmdS32(0xF8000000, 0);
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if ((D_80130658[D_80130630] & 0x20) && D_80130658[(seqId & 0xFF) & 0xFF] & 0x10) {
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if ((D_8013062C & 0x3F) != 0) {
|
|
|
|
sp27 = 0x1E;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F5E18(0, seqId, sp27, 7, D_8013062C);
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
D_8013062C = 0;
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
nv = (D_80130658[(seqId & 0xFF) & 0xFF] & 0x40) ? 1 : 0xFF;
|
|
|
|
func_800F5E18(0, seqId, 0, 7, nv);
|
|
|
|
if (!(D_80130658[seqId] & 0x20)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8013062C = 0xC0;
|
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
D_80130630 = seqId & 0xFF;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F56A8(void) {
|
|
|
|
u16 temp_v0;
|
|
|
|
u8 bvar;
|
|
|
|
|
|
|
|
temp_v0 = func_800FA0B4(0);
|
|
|
|
bvar = temp_v0 & 0xFF;
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((temp_v0 != NA_BGM_DISABLED) && ((D_80130658[bvar] & 0x10) != 0)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (D_8013062C != 0xC0) {
|
2021-11-07 16:58:50 +00:00
|
|
|
D_8013062C = gAudioContext.seqPlayers->soundScriptIO[3];
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
|
|
|
D_8013062C = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5718(void) {
|
2021-11-01 17:54:19 +00:00
|
|
|
if (func_800FA0B4(0) != NA_BGM_WINDMILL) {
|
|
|
|
Audio_StartSeq(0, 0, NA_BGM_WINDMILL);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F574C(f32 arg0, u8 arg2) {
|
|
|
|
if (arg0 == 1.0f) {
|
|
|
|
Audio_SeqCmdB40(0, arg2, 0);
|
|
|
|
} else {
|
|
|
|
Audio_SeqCmdC(1, 0x30, arg2, arg0 * 100.0f);
|
|
|
|
}
|
|
|
|
Audio_SeqCmdC(1, 0xA0, arg2, arg0 * 100.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5918(void) {
|
2021-11-01 17:54:19 +00:00
|
|
|
if (func_800FA0B4(0) == NA_BGM_MINI_GAME_2 && func_800FA11C(0, 0xF0000000)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmdB(0, 5, 0, 0xD2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F595C(u16 arg0) {
|
|
|
|
u8 arg0b = arg0 & 0xFF;
|
|
|
|
|
|
|
|
if (D_80130658[arg0b] & 2) {
|
|
|
|
func_800F5C64(arg0);
|
|
|
|
} else if (D_80130658[arg0b] & 4) {
|
|
|
|
Audio_StartSeq(1, 0, arg0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
func_800F5E18(0, arg0, 0, 7, -1);
|
|
|
|
Audio_SeqCmd1(1, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F59E8(u16 arg0) {
|
|
|
|
u8 arg0b = arg0 & 0xFF;
|
|
|
|
|
|
|
|
if (D_80130658[arg0b] & 2) {
|
|
|
|
Audio_SeqCmd1(1, 0);
|
|
|
|
} else if (D_80130658[arg0b] & 4) {
|
|
|
|
Audio_SeqCmd1(1, 0);
|
|
|
|
} else {
|
|
|
|
Audio_SeqCmd1(0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 func_800F5A58(u8 arg0) {
|
|
|
|
u8 phi_a1 = 0;
|
|
|
|
|
|
|
|
if (D_80130658[arg0 & 0xFF] & 2) {
|
|
|
|
phi_a1 = 1;
|
|
|
|
} else if (D_80130658[arg0 & 0xFF] & 4) {
|
|
|
|
phi_a1 = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg0 == (u8)func_800FA0B4(phi_a1)) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void func_800F5ACC(u16 seqId) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u16 temp_v0;
|
|
|
|
|
|
|
|
temp_v0 = func_800FA0B4(0);
|
2021-11-07 16:58:50 +00:00
|
|
|
if ((temp_v0 & 0xFF) != NA_BGM_GANON_TOWER && (temp_v0 & 0xFF) != NA_BGM_ESCAPE && temp_v0 != seqId) {
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800F5E90(3);
|
2021-11-01 17:54:19 +00:00
|
|
|
if (temp_v0 != NA_BGM_DISABLED) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80130628 = temp_v0;
|
|
|
|
} else {
|
|
|
|
osSyncPrintf("Middle Boss BGM Start not stack \n");
|
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_StartSeq(0, 0, seqId);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5B58(void) {
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((func_800FA0B4(0) != NA_BGM_DISABLED) && (D_80130628 != NA_BGM_DISABLED) &&
|
|
|
|
(D_80130658[func_800FA0B4(0) & 0xFF] & 8)) {
|
|
|
|
if (D_80130628 == NA_BGM_DISABLED) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmd1(0, 0);
|
|
|
|
} else {
|
|
|
|
Audio_StartSeq(0, 0, D_80130628);
|
|
|
|
}
|
2021-11-01 17:54:19 +00:00
|
|
|
D_80130628 = NA_BGM_DISABLED;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5BF0(u8 arg0) {
|
|
|
|
u16 temp_v0;
|
|
|
|
|
|
|
|
temp_v0 = func_800FA0B4(0);
|
2021-11-01 17:54:19 +00:00
|
|
|
if (temp_v0 != NA_BGM_NATURE_BACKGROUND) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80130628 = temp_v0;
|
|
|
|
}
|
|
|
|
func_800F6FB4(arg0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5C2C(void) {
|
2021-11-01 17:54:19 +00:00
|
|
|
if (D_80130628 != NA_BGM_DISABLED) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_StartSeq(0, 0, D_80130628);
|
|
|
|
}
|
2021-11-01 17:54:19 +00:00
|
|
|
D_80130628 = NA_BGM_DISABLED;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5C64(u16 arg0) {
|
|
|
|
u16 sp26;
|
2021-08-12 19:37:37 +00:00
|
|
|
u32 sp20;
|
2021-07-27 23:44:58 +00:00
|
|
|
u8* sp1C;
|
|
|
|
u8* sp18;
|
|
|
|
|
|
|
|
sp26 = func_800FA0B4(1);
|
|
|
|
sp1C = func_800E5E84(sp26 & 0xFF, &sp20);
|
|
|
|
sp18 = func_800E5E84(arg0 & 0xFF, &sp20);
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((sp26 == NA_BGM_DISABLED) || (*sp1C == *sp18)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016B9F4 = 1;
|
|
|
|
} else {
|
|
|
|
D_8016B9F4 = 5;
|
|
|
|
Audio_SeqCmd1(1, 0);
|
|
|
|
}
|
|
|
|
D_8016B9F6 = arg0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5CF8(void) {
|
|
|
|
u16 sp26;
|
2021-08-30 00:08:41 +00:00
|
|
|
u16 pad;
|
2021-07-27 23:44:58 +00:00
|
|
|
u16 sp22;
|
|
|
|
|
|
|
|
if (D_8016B9F4 != 0) {
|
|
|
|
D_8016B9F4--;
|
|
|
|
if (D_8016B9F4 == 0) {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_QueueCmdS32(0xE3000000, SEQUENCE_TABLE);
|
|
|
|
Audio_QueueCmdS32(0xE3000000, FONT_TABLE);
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800FA0B4(0);
|
|
|
|
sp26 = func_800FA0B4(1);
|
|
|
|
sp22 = func_800FA0B4(3);
|
2021-11-01 17:54:19 +00:00
|
|
|
if (sp26 == NA_BGM_DISABLED) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SetVolScale(0, 1, 0, 5);
|
|
|
|
Audio_SetVolScale(3, 1, 0, 5);
|
|
|
|
Audio_SeqCmdC(1, 0x80, 1, 0xA);
|
|
|
|
Audio_SeqCmdC(1, 0x83, 1, 0xA);
|
|
|
|
Audio_SeqCmdC(1, 0x90, 0, 0);
|
2021-11-01 17:54:19 +00:00
|
|
|
if (sp22 != NA_BGM_LONLON) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmdC(1, 0x93, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Audio_StartSeq(1, 1, D_8016B9F6);
|
|
|
|
Audio_SeqCmdA(0, 0xFFFF);
|
2021-11-01 17:54:19 +00:00
|
|
|
if (sp22 != NA_BGM_LONLON) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmdA(3, 0xFFFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void func_800F5E18(u8 playerIdx, u16 seqId, u8 fadeTimer, s8 arg3, s8 arg4) {
|
|
|
|
Audio_SeqCmd7(playerIdx, arg3, arg4);
|
|
|
|
Audio_StartSeq(playerIdx, fadeTimer, seqId);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F5E90(u8 arg0) {
|
|
|
|
s32 phi_t0;
|
|
|
|
u16 phi_t1;
|
|
|
|
u8 phi_a3;
|
|
|
|
|
|
|
|
D_80130654 = arg0;
|
2021-11-01 17:54:19 +00:00
|
|
|
if (D_80130628 == NA_BGM_DISABLED) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (sAudioCutsceneFlag) {
|
2021-07-27 23:44:58 +00:00
|
|
|
arg0 = 3;
|
|
|
|
}
|
|
|
|
phi_t1 = D_8016E750[0].unk_254;
|
2021-11-01 17:54:19 +00:00
|
|
|
if (phi_t1 == NA_BGM_FIELD_LOGIC && func_800FA0B4(3) == (NA_BGM_ENEMY | 0x800)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
arg0 = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
phi_a3 = phi_t1 & 0xFF;
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((phi_t1 == NA_BGM_DISABLED) || ((D_80130658[phi_a3] & 1) != 0) || ((D_8013061C & 0x7F) == 1)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
if (arg0 != (D_8013061C & 0x7F)) {
|
|
|
|
if (arg0 == 1) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (D_8016E750[3].volScales[1] - sAudioEnemyVol < 0) {
|
|
|
|
phi_t0 = -(D_8016E750[3].volScales[1] - sAudioEnemyVol);
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
phi_t0 = D_8016E750[3].volScales[1] - sAudioEnemyVol;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetVolScale(3, 3, sAudioEnemyVol, phi_t0);
|
2021-11-01 17:54:19 +00:00
|
|
|
Audio_StartSeq(3, 10, NA_BGM_ENEMY | 0x800);
|
|
|
|
if (phi_t1 != NA_BGM_NATURE_BACKGROUND) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetVolScale(0, 3, (0x7F - sAudioEnemyVol) & 0xFF, 0xA);
|
|
|
|
func_800F510C(sAudioEnemyVol);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ((D_8013061C & 0x7F) == 1) {
|
|
|
|
Audio_SeqCmd1(3, 10);
|
|
|
|
if (arg0 == 3) {
|
|
|
|
phi_a3 = 0;
|
|
|
|
} else {
|
|
|
|
phi_a3 = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
Audio_SetVolScale(0, 3, 0x7F, phi_a3);
|
|
|
|
func_800F510C(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
D_8013061C = arg0 + 0x80;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (arg0 == 0) {
|
|
|
|
if (D_8013061C == 2) {
|
|
|
|
D_80130638 = 0;
|
|
|
|
}
|
|
|
|
D_80130634 = 0;
|
|
|
|
D_80130638++;
|
|
|
|
} else {
|
|
|
|
D_80130634++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg0 == 2 && D_80130634 < 0x1E && D_80130638 >= 0x15) {
|
|
|
|
arg0 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
D_8013061C = arg0;
|
|
|
|
Audio_SeqCmd7(0, 2, arg0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F6114(f32 dist) {
|
|
|
|
f32 adjDist;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (D_8013061C == 0x81) {
|
2021-08-30 00:08:41 +00:00
|
|
|
if (dist != sAudioEnemyDist) {
|
|
|
|
if (dist < 150.0f) {
|
|
|
|
adjDist = 0.0f;
|
|
|
|
} else if (dist > 500.0f) {
|
|
|
|
adjDist = 350.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
adjDist = dist - 150.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioEnemyVol = ((350.0f - adjDist) * 127.0f) / 350.0f;
|
|
|
|
Audio_SetVolScale(3, 3, sAudioEnemyVol, 0xA);
|
2021-11-01 17:54:19 +00:00
|
|
|
if (D_8016E750[0].unk_254 != NA_BGM_NATURE_BACKGROUND) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_SetVolScale(0, 3, (0x7F - sAudioEnemyVol), 0xA);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-01 17:54:19 +00:00
|
|
|
if (D_8016E750[0].unk_254 != NA_BGM_NATURE_BACKGROUND) {
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F510C(sAudioEnemyVol);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioEnemyDist = dist;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void func_800F6268(f32 dist, u16 arg1) {
|
2021-08-12 19:37:37 +00:00
|
|
|
s8 pad;
|
2021-07-27 23:44:58 +00:00
|
|
|
s8 phi_v1;
|
2021-08-12 19:37:37 +00:00
|
|
|
s16 temp_a0;
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioHasMalonBgm = true;
|
|
|
|
sAudioMalonBgmDist = dist;
|
2021-07-27 23:44:58 +00:00
|
|
|
if (D_8016B9F2 == 0) {
|
2021-08-12 19:37:37 +00:00
|
|
|
temp_a0 = (s8)(func_800FA0B4(0) & 0xFF);
|
2021-07-27 23:44:58 +00:00
|
|
|
if (temp_a0 == (arg1 & 0xFF)) {
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((arg1 & 0xFF) == NA_BGM_LONLON) {
|
2021-07-27 23:44:58 +00:00
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (dist > 2000.0f) {
|
2021-08-12 19:37:37 +00:00
|
|
|
phi_v1 = 127;
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (dist < 200.0f) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v1 = 0;
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
// Transition volume of channels 0, 1 and 13 on seq player 0 over 3 frames
|
2021-08-12 19:37:37 +00:00
|
|
|
Audio_SeqCmd6(0, 3, 0, 127 - phi_v1);
|
|
|
|
Audio_SeqCmd6(0, 3, 1, 127 - phi_v1);
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmd6(0, 3, 13, phi_v1);
|
2021-08-30 00:08:41 +00:00
|
|
|
if (D_8016B9D8 == 0) {
|
|
|
|
D_8016B9D8++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-01 17:54:19 +00:00
|
|
|
} else if ((temp_a0 == NA_BGM_NATURE_BACKGROUND) && ((arg1 & 0xFF) == NA_BGM_LONLON)) {
|
2021-08-12 19:37:37 +00:00
|
|
|
temp_a0 = (s8)(func_800FA0B4(3) & 0xFF);
|
2021-08-30 00:08:41 +00:00
|
|
|
if ((temp_a0 != (arg1 & 0xFF)) && (D_8016B9D8 < 10)) {
|
2021-11-01 17:54:19 +00:00
|
|
|
func_800F5E18(3, NA_BGM_LONLON, 0, 0, 0);
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmdA(3, 0xFFFC);
|
2021-08-30 00:08:41 +00:00
|
|
|
D_8016B9D8 = 10;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (dist > 2000.0f) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v1 = 127;
|
2021-08-30 00:08:41 +00:00
|
|
|
} else if (dist < 200.0f) {
|
2021-07-27 23:44:58 +00:00
|
|
|
phi_v1 = 0;
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
// Transition volume of channels 0 and 1 on seq player 0 over 3 frames
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmd6(3, 3, 0, 127 - phi_v1);
|
|
|
|
Audio_SeqCmd6(3, 3, 1, 127 - phi_v1);
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (D_8016B9D8 < 10) {
|
|
|
|
D_8016B9D8++;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F64E0(u8 arg0) {
|
|
|
|
D_80130608 = arg0;
|
|
|
|
if (arg0 != 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(NA_SE_SY_WIN_OPEN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdS32(0xF1000000, 0);
|
|
|
|
} else {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(NA_SE_SY_WIN_CLOSE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdS32(0xF2000000, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6584(u8 arg0) {
|
2021-11-07 16:58:50 +00:00
|
|
|
u8 playerIdx;
|
2021-07-27 23:44:58 +00:00
|
|
|
u16 sp34;
|
|
|
|
|
|
|
|
D_8016B9F2 = arg0;
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((func_800FA0B4(0) & 0xFF) == NA_BGM_LONLON) {
|
2021-11-07 16:58:50 +00:00
|
|
|
playerIdx = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
sp34 = 0;
|
2021-11-01 17:54:19 +00:00
|
|
|
} else if ((func_800FA0B4(3) & 0xFF) == NA_BGM_LONLON) {
|
2021-11-07 16:58:50 +00:00
|
|
|
playerIdx = 3;
|
2021-07-27 23:44:58 +00:00
|
|
|
sp34 = 0xFFFC;
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (arg0 != 0) {
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SeqCmd6(playerIdx, 1, 0, 0);
|
|
|
|
Audio_SeqCmd6(playerIdx, 1, 1, 0);
|
|
|
|
if (playerIdx == 3) {
|
|
|
|
Audio_SeqCmdA(playerIdx, sp34 | 3);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-11-07 16:58:50 +00:00
|
|
|
if (playerIdx == 3) {
|
2021-11-01 17:54:19 +00:00
|
|
|
func_800F5E18(3, NA_BGM_LONLON, 0, 0, 0);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SeqCmd6(playerIdx, 1, 0, 0x7F);
|
|
|
|
Audio_SeqCmd6(playerIdx, 1, 1, 0x7F);
|
|
|
|
if (playerIdx == 3) {
|
|
|
|
Audio_SeqCmdA(playerIdx, sp34);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_SetEnvReverb(s8 reverb) {
|
|
|
|
sAudioEnvReverb = reverb & 0x7F;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_SetCodeReverb(s8 reverb) {
|
|
|
|
if (reverb != 0) {
|
|
|
|
sAudioCodeReverb = reverb & 0x7F;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6700(s8 arg0) {
|
|
|
|
s8 sp1F;
|
|
|
|
|
|
|
|
switch (arg0) {
|
|
|
|
case 0:
|
|
|
|
sp1F = 0;
|
|
|
|
D_80130604 = 0;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sp1F = 3;
|
|
|
|
D_80130604 = 3;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sp1F = 1;
|
|
|
|
D_80130604 = 1;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
sp1F = 0;
|
|
|
|
D_80130604 = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Audio_SeqCmdE0(0, sp1F);
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void Audio_SetBaseFilter(u8 filter) {
|
|
|
|
if (sAudioBaseFilter != filter) {
|
|
|
|
if (filter == 0) {
|
|
|
|
Audio_StopSfxById(NA_SE_PL_IN_BUBBLE);
|
|
|
|
} else if (sAudioBaseFilter == 0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
Audio_PlaySoundGeneral(NA_SE_PL_IN_BUBBLE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioBaseFilter = filter;
|
|
|
|
sAudioBaseFilter2 = filter;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void Audio_SetExtraFilter(u8 filter) {
|
2021-07-27 23:44:58 +00:00
|
|
|
u32 t;
|
|
|
|
u8 i;
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioExtraFilter2 = filter;
|
|
|
|
sAudioExtraFilter = filter;
|
2021-11-01 17:54:19 +00:00
|
|
|
if (D_8016E750[0].unk_254 == NA_BGM_NATURE_BACKGROUND) {
|
2021-07-27 23:44:58 +00:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
t = i;
|
2021-11-07 16:58:50 +00:00
|
|
|
// CHAN_UPD_SCRIPT_IO (seq player 0, all channels, slot 6)
|
|
|
|
Audio_QueueCmdS8(0x6000000 | ((t & 0xFF) << 8) | 6, filter);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_SetCutsceneFlag(s8 flag) {
|
|
|
|
sAudioCutsceneFlag = flag;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySoundGeneralIfNotInCutscene(u16 sfxId, Vec3f* pos, u8 arg2, f32* freqScale, f32* arg4, s8* reverbAdd) {
|
|
|
|
if (!sAudioCutsceneFlag) {
|
|
|
|
Audio_PlaySoundGeneral(sfxId, pos, arg2, freqScale, arg4, reverbAdd);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
void Audio_PlaySoundIfNotInCutscene(u16 sfxId) {
|
|
|
|
Audio_PlaySoundGeneralIfNotInCutscene(sfxId, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6964(u16 arg0) {
|
2021-08-30 00:08:41 +00:00
|
|
|
s32 skip;
|
2021-07-27 23:44:58 +00:00
|
|
|
u8 i;
|
|
|
|
|
|
|
|
Audio_SeqCmd1(0, (arg0 * 3) / 2);
|
|
|
|
Audio_SeqCmd1(1, (arg0 * 3) / 2);
|
|
|
|
for (i = 0; i < 0x10; i++) {
|
2021-08-30 00:08:41 +00:00
|
|
|
skip = false;
|
2021-07-27 23:44:58 +00:00
|
|
|
switch (i) {
|
2021-09-01 22:33:37 +00:00
|
|
|
case 11:
|
|
|
|
case 12:
|
2021-08-30 00:08:41 +00:00
|
|
|
if (gAudioSpecId == 10) {
|
|
|
|
skip = true;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
break;
|
2021-09-01 22:33:37 +00:00
|
|
|
case 13:
|
2021-08-30 00:08:41 +00:00
|
|
|
skip = true;
|
2021-07-27 23:44:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-08-30 00:08:41 +00:00
|
|
|
if (!skip) {
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_SeqCmd6(2, arg0 >> 1, i, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Audio_SeqCmd1(3, (arg0 * 3) / 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6AB0(u16 arg0) {
|
|
|
|
Audio_SeqCmd1(0, arg0);
|
|
|
|
Audio_SeqCmd1(1, arg0);
|
|
|
|
Audio_SeqCmd1(3, arg0);
|
|
|
|
Audio_SetVolScale(0, 3, 0x7F, 0);
|
|
|
|
Audio_SetVolScale(0, 1, 0x7F, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6B3C(void) {
|
|
|
|
func_800F9280(2, 0, 0xFF, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Audio_DisableAllSeq(void) {
|
|
|
|
Audio_DisableSeq(0, 0);
|
|
|
|
Audio_DisableSeq(1, 0);
|
|
|
|
Audio_DisableSeq(2, 0);
|
|
|
|
Audio_DisableSeq(3, 0);
|
|
|
|
Audio_ScheduleProcessCmds();
|
|
|
|
}
|
|
|
|
|
|
|
|
s8 func_800F6BB8(void) {
|
|
|
|
return func_800E6680();
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6BDC(void) {
|
|
|
|
Audio_DisableAllSeq();
|
|
|
|
Audio_ScheduleProcessCmds();
|
|
|
|
while (true) {
|
|
|
|
if (!func_800F6BB8()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Audio_PreNMI(void) {
|
|
|
|
Audio_PreNMIInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6C34(void) {
|
|
|
|
D_8013061C = 0;
|
|
|
|
D_8016B7A8 = 1.0f;
|
|
|
|
D_8016B7B0 = 1.0f;
|
2021-11-07 16:58:50 +00:00
|
|
|
sAudioBaseFilter = 0;
|
|
|
|
sAudioExtraFilter = 0;
|
|
|
|
sAudioBaseFilter2 = 0;
|
|
|
|
sAudioExtraFilter2 = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800ED858(0);
|
2021-08-30 00:08:41 +00:00
|
|
|
sRiverFreqScaleLerp.remainingFrames = 0;
|
|
|
|
sWaterfallFreqScaleLerp.remainingFrames = 0;
|
|
|
|
sRiverFreqScaleLerp.value = 1.0f;
|
|
|
|
sWaterfallFreqScaleLerp.value = 1.0f;
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016B7D8 = 1.0f;
|
|
|
|
D_8016B8B0 = 0x7F;
|
|
|
|
D_8016B8B1 = 0x7F;
|
|
|
|
D_8016B8B2 = 0;
|
|
|
|
D_8016B8B3 = 0;
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioGanonDistVol = 0xFF;
|
|
|
|
D_8016B9D8 = 0;
|
|
|
|
sSpecReverb = sSpecReverbs[gAudioSpecId];
|
2021-07-27 23:44:58 +00:00
|
|
|
D_80130608 = 0;
|
2021-11-01 17:54:19 +00:00
|
|
|
D_80130628 = NA_BGM_DISABLED;
|
2021-07-27 23:44:58 +00:00
|
|
|
Audio_QueueCmdS8(0x46000000, -1);
|
2021-08-30 00:08:41 +00:00
|
|
|
sSariaBgmPtr = NULL;
|
2021-07-27 23:44:58 +00:00
|
|
|
D_8016B9F4 = 0;
|
|
|
|
D_8016B9F3 = 1;
|
|
|
|
D_8016B9F2 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6D58(u8 arg0, u8 arg1, u8 arg2) {
|
|
|
|
u8 t;
|
|
|
|
u8 temp_a0;
|
|
|
|
u8 i;
|
|
|
|
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((D_8016E750[0].unk_254 != NA_BGM_NATURE_BACKGROUND) && func_800FA11C(1, 0xF00000FF)) {
|
2021-08-30 00:08:41 +00:00
|
|
|
sAudioNatureFailed = 1;
|
2021-07-27 23:44:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((arg0 << 8) + arg1) == 0x101) {
|
2021-11-01 17:54:19 +00:00
|
|
|
if (func_800FA0B4(3) != NA_BGM_LONLON) {
|
2021-08-30 00:08:41 +00:00
|
|
|
D_8016B9D8 = 0;
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
t = arg0 >> 4;
|
|
|
|
temp_a0 = arg0 & 0xF;
|
|
|
|
if (t == 0) {
|
|
|
|
t = arg0 & 0xF;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = t; i <= temp_a0; i++) {
|
|
|
|
Audio_SeqCmd8(0, arg1, i, arg2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6E7C(u16 arg0, u16 arg1) {
|
|
|
|
u8 i;
|
|
|
|
u32 t;
|
|
|
|
|
2021-11-01 17:54:19 +00:00
|
|
|
if (func_800FA0B4(0) == NA_BGM_WINDMILL) {
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800F3F3C(0xF);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Audio_SeqCmd7(0, 0, 1);
|
|
|
|
Audio_SeqCmd7(0, 4, arg0 >> 8);
|
|
|
|
Audio_SeqCmd7(0, 5, arg0 & 0xFF);
|
|
|
|
Audio_SetVolScale(0, 0, 0x7F, 1);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
if (D_80133408 != 0) {
|
|
|
|
i = 1;
|
|
|
|
Audio_SeqCmdE01(0, 0);
|
|
|
|
}
|
|
|
|
|
2021-11-01 17:54:19 +00:00
|
|
|
Audio_StartSeq(0, 0, NA_BGM_NATURE_BACKGROUND);
|
2021-07-27 23:44:58 +00:00
|
|
|
|
|
|
|
if (i != 0) {
|
|
|
|
Audio_SeqCmdE01(0, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 0x10; i++) {
|
|
|
|
if (!(arg1 & (1 << i)) && (arg0 & (1 << i))) {
|
|
|
|
Audio_SeqCmd8(0, 1, i, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F6FB4(u8 arg0) {
|
|
|
|
u8 i = 0;
|
|
|
|
u8 b0;
|
|
|
|
u8 b1;
|
|
|
|
u8 b2;
|
|
|
|
|
2021-11-01 17:54:19 +00:00
|
|
|
if ((D_8016E750[0].unk_254 == NA_BGM_DISABLED) || ((D_80130658[((u8)D_8016E750[0].unk_254) & 0xFF] & 0x80) == 0)) {
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800F6E7C(D_801306DC[arg0].unk_00, D_801306DC[arg0].unk_02);
|
2021-08-12 19:37:37 +00:00
|
|
|
while ((D_801306DC[arg0].unk_04[i] != 0xFF) && (i < 100)) {
|
|
|
|
// Probably a fake match, using Audio_SeqCmd8 doesn't work.
|
2021-07-27 23:44:58 +00:00
|
|
|
b0 = D_801306DC[arg0].unk_04[i++];
|
|
|
|
b1 = D_801306DC[arg0].unk_04[i++];
|
|
|
|
b2 = D_801306DC[arg0].unk_04[i++];
|
|
|
|
Audio_QueueSeqCmd(0x80000000 | (b1 << 0x10) | (b0 << 8) | b2);
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_SeqCmd8(0, 0x07, 13, D_80130604);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void Audio_Init(void) {
|
|
|
|
AudioLoad_Init(NULL, 0);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 16:58:50 +00:00
|
|
|
void Audio_InitSound(void) {
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800F6C34();
|
|
|
|
func_800EE930();
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_ResetSfxChannelState();
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800FAEB4();
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_ResetSounds();
|
2021-08-30 00:08:41 +00:00
|
|
|
func_800F9280(2, 0, 0x70, 10);
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F7170(void) {
|
|
|
|
func_800F9280(2, 0, 0x70, 1);
|
|
|
|
Audio_QueueCmdS32(0xF2000000, 1);
|
|
|
|
Audio_ScheduleProcessCmds();
|
|
|
|
Audio_QueueCmdS32(0xF8000000, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F71BC(s32 arg0) {
|
|
|
|
D_80133418 = 1;
|
|
|
|
func_800F6C34();
|
|
|
|
func_800EE930();
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_ResetSfxChannelState();
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800FADF8();
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_ResetSounds();
|
2021-07-27 23:44:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void func_800F7208(void) {
|
|
|
|
func_800FADF8();
|
|
|
|
Audio_QueueCmdS32(0xF2000000, 1);
|
|
|
|
func_800F6C34();
|
2021-11-07 16:58:50 +00:00
|
|
|
Audio_ResetSfxChannelState();
|
2021-07-27 23:44:58 +00:00
|
|
|
func_800F9280(2, 0, 0x70, 1);
|
|
|
|
}
|