From 1af942ae12499c90bb4ebe2d37988d2234f8605e Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 30 Sep 2022 07:49:35 -0400 Subject: [PATCH] Audio Sequences: Scene/Ambience/SeqFlags Functions OK (#1033) * import audio scene seq docs * cleanup * fix scene cmd * small fixes * more PR suggestions * missed comment * rename spot to resume * cleanup comments * SEQ_IO_VAL_NONE * Empty-Commit * another PR suggestion --- include/functions.h | 54 +- include/sequence.h | 210 +-- include/variables.h | 4 +- include/z64.h | 9 +- include/z64audio.h | 11 +- include/z64save.h | 4 +- include/z64scene.h | 16 +- src/code/audio/audio_seqplayer.c | 12 +- src/code/audio/code_8019AF00.c | 1656 +++++++++++------ src/code/audio/code_801A5BD0.c | 2 +- src/code/audio/code_801A7B10.c | 4 +- src/code/game.c | 2 +- src/code/graph.c | 2 +- src/code/z_common_data.c | 4 +- src/code/z_demo.c | 30 +- src/code/z_game_over.c | 6 +- src/code/z_scene.c | 9 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 4 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 4 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 2 +- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 2 +- src/overlays/actors/ovl_En_Az/z_en_az.c | 4 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 16 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h | 2 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 4 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 6 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 2 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 4 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 4 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 2 +- .../actors/ovl_En_Ma_Yto/z_en_ma_yto.c | 2 +- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 8 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 8 +- .../z_en_syateki_dekunuts.c | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 6 +- .../ovl_En_Syateki_Wf/z_en_syateki_wf.c | 2 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 2 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 6 +- .../actors/ovl_En_Warp_tag/z_en_warp_tag.c | 4 +- src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c | 2 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 6 +- src/overlays/gamestates/ovl_select/z_select.c | 4 +- src/overlays/gamestates/ovl_title/z_title.c | 4 +- tools/disasm/functions.txt | 58 +- tools/disasm/variables.txt | 18 +- tools/namefixer.py | 13 + tools/sizes/code_functions.csv | 58 +- 50 files changed, 1445 insertions(+), 855 deletions(-) diff --git a/include/functions.h b/include/functions.h index 05fd4ed453..67ad8ec3cd 100644 --- a/include/functions.h +++ b/include/functions.h @@ -3158,7 +3158,7 @@ OcarinaStaff* AudioOcarina_GetPlaybackStaff(void); void AudioOcarina_TerminaWallGenerateNotes(void); void AudioOcarina_PlayLongScarecrowAfterCredits(void); -void func_8019E014(void); +void Audio_Update(void); // void func_8019E110(void); void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex); void play_sound(u16 sfxId); @@ -3224,31 +3224,27 @@ void func_801A1F88(void); void func_801A1FB4(u8 playerIndex, Vec3f* pos, u16 seqId, f32 maxDist); // void func_801A2090(void); void func_801A246C(u8 param_1, u8 param_2); -// void func_801A2544(void); -// void func_801A257C(void); -void func_801A25E4(u16 seqId, u8 dayMinusOne); -// void func_801A2670(void); -// void func_801A2778(void); +void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne); +void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne); // void func_801A27E8(void); // void func_801A281C(void); void func_801A29D4(UNK_TYPE arg0, f32 arg1, UNK_TYPE arg2); void func_801A2BB8(s32 seqId); void func_801A2C20(void); // void func_801A2C44(void); -void func_801A2C88(u16 seqId); -void func_801A2D54(u16 seqId); +void Audio_PlaySequenceInCutscene(u16 seqId); +void Audio_StopSequenceInCutscene(u16 seqId); s32 Audio_IsSequencePlaying(u8 seqId); -void func_801A2E54(s32 bgmId); -void func_801A2ED8(void); -// void func_801A2F88(void); +void Audio_PlayBgm_StorePrevBgm(u16 seqId); +void Audio_RestorePrevBgm(void); // void func_801A3000(void); // void func_801A3038(void); -void func_801A3098(u16 seqId); +void Audio_PlayFanfare(u16 seqId); // void func_801A312C(void); void func_801A31EC(u16 seqId, s8 arg1, u8 arg2); -// void func_801A3238(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5); -// void func_801A32CC(void); -// void func_801A3590(void); +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 ioPort, u8 ioData); +void Audio_SetSequenceMode(u8 seqMode); +void Audio_UpdateEnemyBgmVolume(f32 dist); u8 func_801A3950(s32 playerIndex, s32 isChannelIOSet); u8 func_801A39F8(void); void func_801A3A7C(s32 arg0); @@ -3261,11 +3257,11 @@ void func_801A3CD8(s8 param_1); void func_801A3D98(s8 audioSetting); // void func_801A3E38(void); // void func_801A3EC0(void); -void Audio_SetCutsceneFlag(u8 flag); +void Audio_SetCutsceneFlag(s8 flag); // void func_801A3F6C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_801A3FB4(void); // void func_801A3FFC(UNK_TYPE1 param_1); -void audio_setBGM(u32 bgmID); +void Audio_SetSpec(u32 specId); void func_801A4058(UNK_TYPE arg0); // void func_801A41C8(void); // void func_801A41F8(void); @@ -3276,15 +3272,13 @@ void func_801A4058(UNK_TYPE arg0); void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 arg0); void func_801A4428(u8 reverbIndex); void Audio_PreNMI(void); -// void func_801A44C4(void); +// void Audio_ResetRequestedSceneSeqId(void); // void func_801A44D4(void); s32 func_801A46F8(void); void func_801A4748(Vec3f* pos, u16 sfxId); void func_801A479C(Vec3f* arg0, u16 sfxId, s32 arg2); -void func_801A47DC(u8 channelIndexRange, u8 port, u8 val); -// void func_801A48E0(void); -void func_801A4A28(u8 natureSeqId); -// void Audio_SetNatureAmbienceRandomBend(void); +void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData); +void Audio_PlayAmbience(u8 ambienceId); void Audio_Init(void); void func_801A4D00(void); // void func_801A4D50(void); @@ -3297,7 +3291,7 @@ void func_801A4D00(void); // void func_801A4FD8(void); void func_801A5080(u16 arg0); u16 func_801A5100(void); -// void func_801A5118(void); +void func_801A5118(void); UNK_TYPE func_801A51F0(UNK_TYPE arg0); // void func_801A5228(void); // void func_801A5390(void); @@ -3328,17 +3322,17 @@ u8 AudioSfx_IsPlaying(u32 sfxId); void AudioSfx_Reset(void); void Audio_StartSequence(u8 playerIndex, u8 seqId, u8 seqArgs, u16 fadeTimer); -// void func_801A7D04(void); +void Audio_StopSequence(u8 playerIndex, u16 fadeTimer); // void func_801A7D84(void); void Audio_QueueSeqCmd(u32 cmd); -// void func_801A89D0(void); -s32 func_801A8A50(s32 param1); -// void func_801A8ABC(void); +void func_801A89D0(void); +u16 Audio_GetActiveSequence(u8 playerIndex); +s32 func_801A8ABC(u32 cmdVal, u32 cmdMask); void Audio_SetVolumeScale(u8 playerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer); -// void func_801A8D5C(void); +void func_801A8D5C(void); // void func_801A8E90(void); -// void func_801A9768(void); -// void func_801A982C(void); +u8 func_801A9768(void); +u8 func_801A982C(void); // void func_801A99B8(void); // void func_801A9A74(void); diff --git a/include/sequence.h b/include/sequence.h index d46e96aea9..857609d4b2 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -4,7 +4,7 @@ #define NA_BGM_STOP 0x100000FF #define NA_BGM_GENERAL_SFX 0x00 // General Sound Effects -#define NA_BGM_NATURE_AMBIENCE 0x01 // Ambient background noises +#define NA_BGM_AMBIENCE 0x01 // Ambient background noises #define NA_BGM_TERMINA_FIELD 0x02 // Termina Field #define NA_BGM_CHASE 0x03 // Forest Chase #define NA_BGM_MAJORAS_THEME 0x04 // Majora's Theme "STALKID" @@ -40,7 +40,7 @@ #define NA_BGM_GET_ITEM 0x22 // Item Catch #define NA_BGM_GATE_OPEN 0x23 // Clock Town Day 2 Duplicate of #16. In MM3D, it shares its filename with the Door of Time song from OoT #define NA_BGM_GET_HEART 0x24 // Complete a Heart Piece -#define NA_BGM_MINI_GAME_2 0x25 // Playing Minigame +#define NA_BGM_TIMED_MINI_GAME 0x25 // Playing a timed Minigame #define NA_BGM_GORON_RACE 0x26 // Goron Race #define NA_BGM_MUSIC_BOX_HOUSE 0x27 // Music Box House "ORGEL_HOUSE" #define NA_BGM_FAIRY_FOUNTAIN 0x28 // Fairy's Fountain In MM3D, it shares its filename with the Door of Time song from OoT "GODESS" @@ -134,11 +134,12 @@ #define NA_BGM_DISABLED 0xFFFF typedef enum { - /* 0 */ SEQ_PLAYER_BGM_MAIN, - /* 1 */ SEQ_PLAYER_FANFARE, - /* 2 */ SEQ_PLAYER_SFX, - /* 3 */ SEQ_PLAYER_BGM_SUB, - /* 4 */ SEQ_PLAYER_NATURE + /* 0 */ SEQ_PLAYER_BGM_MAIN, + /* 1 */ SEQ_PLAYER_FANFARE, + /* 2 */ SEQ_PLAYER_SFX, + /* 3 */ SEQ_PLAYER_BGM_SUB, + /* 4 */ SEQ_PLAYER_AMBIENCE, + /* 0xFF */ SEQ_PLAYER_INVALID = 0xFF } SequencePlayerId; typedef enum { @@ -160,119 +161,120 @@ typedef enum { } ChannelIOPort; typedef enum { - /* 0x0 */ NATURE_CHANNEL_STREAM_0, - /* 0x1 */ NATURE_CHANNEL_CRITTER_0, - /* 0x2 */ NATURE_CHANNEL_CRITTER_1, - /* 0x3 */ NATURE_CHANNEL_CRITTER_2, - /* 0x4 */ NATURE_CHANNEL_CRITTER_3, - /* 0x5 */ NATURE_CHANNEL_CRITTER_4, - /* 0x6 */ NATURE_CHANNEL_CRITTER_5, - /* 0x7 */ NATURE_CHANNEL_CRITTER_6, - /* 0x8 */ NATURE_CHANNEL_CRITTER_7, - /* 0xC */ NATURE_CHANNEL_STREAM_1 = 12, - /* 0xD */ NATURE_CHANNEL_UNK, - /* 0xE */ NATURE_CHANNEL_RAIN, - /* 0xF */ NATURE_CHANNEL_LIGHTNING -} NatureChannelIdx; // playerIdx = 4 + /* 0x0 */ AMBIENCE_CHANNEL_STREAM_0, + /* 0x1 */ AMBIENCE_CHANNEL_CRITTER_0, + /* 0x2 */ AMBIENCE_CHANNEL_CRITTER_1, + /* 0x3 */ AMBIENCE_CHANNEL_CRITTER_2, + /* 0x4 */ AMBIENCE_CHANNEL_CRITTER_3, + /* 0x5 */ AMBIENCE_CHANNEL_CRITTER_4, + /* 0x6 */ AMBIENCE_CHANNEL_CRITTER_5, + /* 0x7 */ AMBIENCE_CHANNEL_CRITTER_6, + /* 0x8 */ AMBIENCE_CHANNEL_CRITTER_7, + /* 0xC */ AMBIENCE_CHANNEL_STREAM_1 = 12, + /* 0xD */ AMBIENCE_CHANNEL_SOUND_MODE, + /* 0xE */ AMBIENCE_CHANNEL_RAIN, + /* 0xF */ AMBIENCE_CHANNEL_LIGHTNING +} AmbienceChannelIndex; // playerIndex = SEQ_PLAYER_AMBIENCE typedef enum { - /* 0x00 */ NATURE_AMBIENCE_0, - /* 0x01 */ NATURE_AMBIENCE_1, - /* 0x02 */ NATURE_AMBIENCE_2, - /* 0x03 */ NATURE_AMBIENCE_3, - /* 0x04 */ NATURE_AMBIENCE_4, - /* 0x05 */ NATURE_AMBIENCE_5, - /* 0x06 */ NATURE_AMBIENCE_6, - /* 0x07 */ NATURE_AMBIENCE_7, - /* 0x08 */ NATURE_AMBIENCE_8, - /* 0x09 */ NATURE_AMBIENCE_9, - /* 0x0A */ NATURE_AMBIENCE_A, - /* 0x0B */ NATURE_AMBIENCE_B, - /* 0x0C */ NATURE_AMBIENCE_C, - /* 0x0D */ NATURE_AMBIENCE_D, - /* 0x0E */ NATURE_AMBIENCE_E, - /* 0x0F */ NATURE_AMBIENCE_F, - /* 0x10 */ NATURE_AMBIENCE_10, - /* 0x11 */ NATURE_AMBIENCE_11, - /* 0x12 */ NATURE_AMBIENCE_12, - /* 0x13 */ NATURE_AMBIENCE_13 -} NatureAmbienceId; // playerIdx = 4 + /* 0x00 */ AMBIENCE_ID_00, + /* 0x01 */ AMBIENCE_ID_01, + /* 0x02 */ AMBIENCE_ID_02, + /* 0x03 */ AMBIENCE_ID_03, + /* 0x04 */ AMBIENCE_ID_04, + /* 0x05 */ AMBIENCE_ID_05, + /* 0x06 */ AMBIENCE_ID_06, + /* 0x07 */ AMBIENCE_ID_07, + /* 0x08 */ AMBIENCE_ID_08, + /* 0x09 */ AMBIENCE_ID_09, + /* 0x0A */ AMBIENCE_ID_0A, + /* 0x0B */ AMBIENCE_ID_0B, + /* 0x0C */ AMBIENCE_ID_0C, + /* 0x0D */ AMBIENCE_ID_0D, + /* 0x0E */ AMBIENCE_ID_0E, + /* 0x0F */ AMBIENCE_ID_0F, + /* 0x10 */ AMBIENCE_ID_10, + /* 0x11 */ AMBIENCE_ID_11, + /* 0x12 */ AMBIENCE_ID_12, + /* 0x13 */ AMBIENCE_ID_13, + /* 0xFF */ AMBIENCE_ID_DISABLED = 0xFF +} AmbienceId; // playerIndex = SEQ_PLAYER_AMBIENCE typedef enum { - /* 0x00 */ NATURE_STREAM_0, - /* 0x01 */ NATURE_STREAM_1, - /* 0x02 */ NATURE_STREAM_2, - /* 0x03 */ NATURE_STREAM_3 -} NatureStreamId; + /* 0x00 */ AMBIENCE_STREAM_0, + /* 0x01 */ AMBIENCE_STREAM_1, + /* 0x02 */ AMBIENCE_STREAM_2, + /* 0x03 */ AMBIENCE_STREAM_3 +} AmbienceStreamId; typedef enum { - /* 0x00 */ NATURE_CRITTER_00, - /* 0x01 */ NATURE_CRITTER_01, - /* 0x02 */ NATURE_CRITTER_02, - /* 0x03 */ NATURE_CRITTER_03, - /* 0x04 */ NATURE_CRITTER_04, - /* 0x05 */ NATURE_CRITTER_05, - /* 0x06 */ NATURE_CRITTER_06, - /* 0x07 */ NATURE_CRITTER_07, - /* 0x08 */ NATURE_CRITTER_08, - /* 0x09 */ NATURE_CRITTER_09, - /* 0x0A */ NATURE_CRITTER_10, - /* 0x0B */ NATURE_CRITTER_11, - /* 0x0C */ NATURE_CRITTER_12, - /* 0x0D */ NATURE_CRITTER_13, - /* 0x0E */ NATURE_CRITTER_14, - /* 0x0F */ NATURE_CRITTER_15, - /* 0x10 */ NATURE_CRITTER_16, - /* 0x11 */ NATURE_CRITTER_17, - /* 0x12 */ NATURE_CRITTER_18, - /* 0x13 */ NATURE_CRITTER_19 -} NatureAmimalId; + /* 0x00 */ AMBIENCE_CRITTER_00, + /* 0x01 */ AMBIENCE_CRITTER_01, + /* 0x02 */ AMBIENCE_CRITTER_02, + /* 0x03 */ AMBIENCE_CRITTER_03, + /* 0x04 */ AMBIENCE_CRITTER_04, + /* 0x05 */ AMBIENCE_CRITTER_05, + /* 0x06 */ AMBIENCE_CRITTER_06, + /* 0x07 */ AMBIENCE_CRITTER_07, + /* 0x08 */ AMBIENCE_CRITTER_08, + /* 0x09 */ AMBIENCE_CRITTER_09, + /* 0x0A */ AMBIENCE_CRITTER_10, + /* 0x0B */ AMBIENCE_CRITTER_11, + /* 0x0C */ AMBIENCE_CRITTER_12, + /* 0x0D */ AMBIENCE_CRITTER_13, + /* 0x0E */ AMBIENCE_CRITTER_14, + /* 0x0F */ AMBIENCE_CRITTER_15, + /* 0x10 */ AMBIENCE_CRITTER_16, + /* 0x11 */ AMBIENCE_CRITTER_17, + /* 0x12 */ AMBIENCE_CRITTER_18, + /* 0x13 */ AMBIENCE_CRITTER_19 +} AmbienceCritterId; -#define NATURE_IO_CRITTER_0_TYPE(type) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_0_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_0_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_0_PORT5(reverb) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_0_TYPE(type) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_0_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_0_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_0_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_1_TYPE(type) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_1_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_1_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_1_PORT5(reverb) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_1_TYPE(type) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_1_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_1_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_1_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_2_TYPE(type) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_2_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_2_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_2_PORT5(reverb) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_2_TYPE(type) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_2_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_2_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_2_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_3_TYPE(type) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_3_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_3_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_3_PORT5(reverb) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_3_TYPE(type) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_3_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_3_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_3_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_4_TYPE(type) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_4_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_4_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_4_PORT5(reverb) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_4_TYPE(type) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_4_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_4_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_4_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_5_TYPE(type) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_5_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_5_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_5_PORT5(reverb) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_5_TYPE(type) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_5_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_5_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_5_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_6_TYPE(type) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_6_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_6_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_6_PORT5(reverb) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_6_TYPE(type) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_6_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_6_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_6_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_STREAM_0_TYPE(type) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_2, type -#define NATURE_IO_STREAM_0_PORT3(data) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_3, data -#define NATURE_IO_STREAM_0_PORT4(data) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_4, data +#define AMBIENCE_IO_STREAM_0_TYPE(type) AMBIENCE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_STREAM_0_PORT3(data) AMBIENCE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_3, data +#define AMBIENCE_IO_STREAM_0_PORT4(data) AMBIENCE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_4, data -#define NATURE_IO_STREAM_1_TYPE(type) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_2, type -#define NATURE_IO_STREAM_1_PORT3(data) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_3, data -#define NATURE_IO_STREAM_1_PORT4(data) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_4, data +#define AMBIENCE_IO_STREAM_1_TYPE(type) AMBIENCE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_STREAM_1_PORT3(data) AMBIENCE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_3, data +#define AMBIENCE_IO_STREAM_1_PORT4(data) AMBIENCE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_4, data -#define NATURE_IO_RAIN_PORT4(data) NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, data +#define AMBIENCE_IO_RAIN_PORT4(data) AMBIENCE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, data -#define NATURE_IO_ENTRIES_END 0xFF +#define AMBIENCE_IO_ENTRIES_END 0xFF #endif diff --git a/include/variables.h b/include/variables.h index 07e80b2ca4..c7ea263f2a 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3416,7 +3416,7 @@ extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD434; // extern UNK_TYPE1 D_801FD435; // extern UNK_TYPE1 D_801FD436; -// extern UNK_TYPE1 D_801FD438; +// extern UNK_TYPE1 sPrevAmbienceSeqId; // extern UNK_TYPE1 D_801FD43A; // extern UNK_TYPE1 D_801FD43B; // extern UNK_TYPE1 D_801FD43E; @@ -3477,7 +3477,7 @@ extern ActiveSfx gActiveSfx[7][3]; // extern UNK_TYPE1 D_8020001E; // extern UNK_TYPE1 D_802000C9; // extern UNK_TYPE1 D_802000D4; -// extern UNK_TYPE1 D_80200140; +extern ActiveSequence gActiveSeqs[]; // extern UNK_TYPE1 D_8020034A; // extern UNK_TYPE1 D_80200B88; // extern UNK_TYPE1 D_80200BBA; diff --git a/include/z64.h b/include/z64.h index 69e89d629f..5589e7cad5 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1056,10 +1056,9 @@ struct FireObj { }; // size = 0x8B typedef struct { - /* 0x0 */ u8 seqIndex; - /* 0x1 */ u8 nightSeqIndex; - /* 0x2 */ u8 unk_02; -} SoundContext; // size = 0x3 + /* 0x0 */ u8 seqId; + /* 0x1 */ u8 ambienceId; +} SequenceContext; // size = 0x2 typedef struct { /* 0x0 */ s32 enabled; @@ -1095,7 +1094,7 @@ struct PlayState { /* 0x00800 */ Camera* cameraPtrs[NUM_CAMS]; /* 0x00810 */ s16 activeCamId; /* 0x00812 */ s16 nextCamera; - /* 0x00814 */ SoundContext soundCtx; + /* 0x00814 */ SequenceContext sequenceCtx; /* 0x00818 */ LightContext lightCtx; /* 0x00828 */ FrameAdvanceContext frameAdvCtx; /* 0x00830 */ CollisionContext colCtx; diff --git a/include/z64audio.h b/include/z64audio.h index fc9bf9f4c9..c5045e34ff 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -9,6 +9,7 @@ #define IS_SEQUENCE_CHANNEL_VALID(ptr) ((uintptr_t)(ptr) != (uintptr_t)&gAudioContext.sequenceChannelNone) #define SEQ_NUM_CHANNELS 16 +#define SEQ_IO_VAL_NONE -1 typedef enum { /* 0 */ SEQPLAYER_STATE_0, @@ -51,9 +52,9 @@ typedef enum { typedef enum { /* 0 */ SOUNDMODE_STEREO, /* 1 */ SOUNDMODE_HEADSET, - /* 2 */ SOUNDMODE_SURROUND, + /* 2 */ SOUNDMODE_SURROUND_EXTERNAL, /* 3 */ SOUNDMODE_MONO, - /* 4 */ SOUNDMODE_SURROUND_EXTERNAL, + /* 4 */ SOUNDMODE_SURROUND, } SoundMode; typedef enum { @@ -1068,7 +1069,7 @@ typedef struct { /* 0x204 */ u16 unk_28; /* 0x206 */ u16 unk_250; /* 0x208 */ u16 unk_252; - /* 0x20A */ u16 unk_254; + /* 0x20A */ u16 seqId; /* 0x20C */ u16 unk_256; /* 0x20E */ u16 unk_258; /* 0x210 */ u8 unk_260; @@ -1080,7 +1081,7 @@ typedef struct { /* 0x219 */ u8 unk_4D; /* 0x21A */ u8 unk_4E; /* 0x21B */ u8 unk_21B; -} unk_D_8016E750; // size = 0x21C +} ActiveSequence; // size = 0x21C typedef struct { /* 0x0 */ u8 unk_0; @@ -1095,7 +1096,7 @@ typedef enum { /* 4 */ BANK_SYSTEM, /* 5 */ BANK_OCARINA, /* 6 */ BANK_VOICE -} SoundBankTypes; +} SfxBankType; typedef enum { /* 0 */ SFX_STATE_EMPTY, diff --git a/include/z64save.h b/include/z64save.h index 15984d45c3..df78cc169a 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -327,8 +327,8 @@ typedef struct SaveContext { /* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp" /* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp" /* 0x3F14 */ s16 unk_3F14; // "character_change" - /* 0x3F16 */ u8 seqIndex; // "old_bgm" - /* 0x3F17 */ u8 nightSeqIndex; // "old_env" + /* 0x3F16 */ u8 seqId; // "old_bgm" + /* 0x3F17 */ u8 ambienceId; // "old_env" /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" /* 0x3F1E */ u8 hudVisibilityForceButtonAlphasByStatus; // if btn alphas are updated through Interface_UpdateButtonAlphas, instead update them through Interface_UpdateButtonAlphasByStatus "ck_fg" /* 0x3F20 */ u16 nextHudVisibility; // triggers the hud to change visibility to the requested value. Reset to HUD_VISIBILITY_IDLE when target is reached "alpha_type" diff --git a/include/z64scene.h b/include/z64scene.h index 6b8849381b..18d7b81f98 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -153,16 +153,16 @@ typedef struct { typedef struct { /* 0x0 */ u8 code; - /* 0x1 */ u8 bgmId; - /* 0x2 */ UNK_TYPE1 pad2[4]; - /* 0x6 */ u8 nighttimeSFX; - /* 0x7 */ u8 musicSeq; + /* 0x1 */ u8 specId; + /* 0x2 */ UNK_TYPE1 unk_02[4]; + /* 0x6 */ u8 ambienceId; + /* 0x7 */ u8 seqId; } SCmdSoundSettings; // size = 0x8 typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 data1; - /* 0x2 */ UNK_TYPE1 pad2[5]; + /* 0x2 */ UNK_TYPE1 unk_02[5]; /* 0x7 */ u8 echo; } SCmdEchoSettings; // size = 0x8 @@ -817,7 +817,7 @@ typedef enum { /* 0x1D */ SCENE_CMD_ID_UNUSED_1D, /* 0x1E */ SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO, /* 0x1F */ SCENE_CMD_MAX -} SceneCommandTypeID; +} SceneCommandTypeId; #define SCENE_CMD_SPAWN_LIST(numSpawns, spawnList) \ { SCENE_CMD_ID_SPAWN_LIST, numSpawns, CMD_PTR(spawnList) } @@ -887,8 +887,8 @@ typedef enum { #define SCENE_CMD_END() \ { SCENE_CMD_ID_END, 0, CMD_W(0) } -#define SCENE_CMD_SOUND_SETTINGS(audioSessionId, nighttimeSfx, bgmId) \ - { SCENE_CMD_ID_SOUND_SETTINGS, audioSessionId, CMD_BBBB(0, 0, nighttimeSfx, bgmId) } +#define SCENE_CMD_SOUND_SETTINGS(specId, ambienceId, seqId) \ + { SCENE_CMD_ID_SOUND_SETTINGS, specId, CMD_BBBB(0, 0, ambienceId, seqId) } #define SCENE_CMD_ECHO_SETTINGS(echo) \ { SCENE_CMD_ID_ECHO_SETTINGS, 0, CMD_BBBB(0, 0, 0, echo) } diff --git a/src/code/audio/audio_seqplayer.c b/src/code/audio/audio_seqplayer.c index ea5c5ed5e4..a8573e33d2 100644 --- a/src/code/audio/audio_seqplayer.c +++ b/src/code/audio/audio_seqplayer.c @@ -315,7 +315,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { channel->freqScale = 1.0f; for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) { - channel->soundScriptIO[i] = -1; + channel->soundScriptIO[i] = SEQ_IO_VAL_NONE; } channel->unused = false; @@ -1791,12 +1791,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { case 0x10: // channel: load sample if (lowBits < 8) { - channel->soundScriptIO[lowBits] = -1; + channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE; if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value, &channel->soundScriptIO[lowBits]) == -1) {} } else { lowBits -= 8; - channel->soundScriptIO[lowBits] = -1; + channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE; if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100, &channel->soundScriptIO[lowBits]) == -1) {} } @@ -1805,7 +1805,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { case 0x60: // channel: io read value scriptState->value = channel->soundScriptIO[lowBits]; if (lowBits < 2) { - channel->soundScriptIO[lowBits] = -1; + channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE; } break; @@ -2150,7 +2150,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { case 0x80: // seqPlayer: io read value seqScript->value = seqPlayer->soundScriptIO[cmdLowBits]; if (cmdLowBits < 2) { - seqPlayer->soundScriptIO[cmdLowBits] = -1; + seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE; } break; @@ -2286,7 +2286,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { seqPlayer->applyBend = false; for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) { - seqPlayer->soundScriptIO[j] = -1; + seqPlayer->soundScriptIO[j] = SEQ_IO_VAL_NONE; } seqPlayer->muteFlags = MUTE_FLAGS_SOFTEN | MUTE_FLAGS_STOP_NOTES; diff --git a/src/code/audio/code_8019AF00.c b/src/code/audio/code_8019AF00.c index b896facbc8..007d7ca856 100644 --- a/src/code/audio/code_8019AF00.c +++ b/src/code/audio/code_8019AF00.c @@ -5,12 +5,6 @@ typedef struct { /* 0x1 */ s8 y; } OcarinaControlStick; // size = 0x2 -typedef struct { - /* 0x0 */ u16 playerIO; - /* 0x2 */ u16 channelMask; - /* 0x4 */ u8 channelIO[3 * 33 + 1]; -} NatureAmbienceDataIO; // size = 0x68 - typedef struct { /* 0x0 */ Vec3f* pos; /* 0x4 */ f32 freqScale; @@ -67,8 +61,30 @@ typedef struct { } FreqLerp; // size = 0x10 s32 AudioOcarina_MemoryGameNextNote(void); + +void AudioSfx_ProcessSfxSettings(void); +void func_8019FEDC(void); +void Audio_StepFreqLerp(FreqLerp* lerp); + s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume); -void func_801A3238(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 arg3, u8 arg4); + +void Audio_StartMorningSceneSequence(u16 seqId); +void Audio_StartSceneSequence(u16 seqId); +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 arg3, u8 arg4); +void func_801A4428(u8 reverbIndex); +void func_801A3038(void); +void Audio_PlayAmbience(u8 ambienceId); +void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 volume); + +void Audio_UpdateRiverSoundVolumes(void); +void func_801A1290(void); +void func_801A1904(void); +void func_801A1E0C(void); +void func_801A2090(void); +void Audio_UpdateSceneSequenceResumePoint(void); +void func_801A312C(void); +void func_801A3AC0(void); +void Audio_ResetRequestedSceneSeqId(void); // Sfx bss SfxSettings sSfxSettings[8]; @@ -90,7 +106,7 @@ u8 sGanonsTowerVol; f32* sSfxVolumeCur; f32 sSfxVolumeTarget; f32 sSfxVolumeRate; -u16 sSceneSeqId1; +u16 sRequestedSceneSeqId; SfxChannelState sSfxChannelState[16]; // Sequence bss @@ -99,7 +115,7 @@ u8 D_801FD3A9; u8 sRiverSoundBgmTimer; u8 sFanfareState; u16 sFanfareSeqId; -u8 sMuteOnlySfxAndNatureSeq; +u8 sMuteOnlySfxAndAmbienceSeq; u8 sAllPlayersMutedExceptOcaAndSys; u8 sAudioPauseState; u8 sSpatialSeqIsActive[4]; @@ -125,7 +141,7 @@ u8 sSpatialSubBgmFadeTimer; u8 D_801FD434; u8 sSpatialSeqPlayerIndex; u8 sSpatialSeqFadeTimer; -u16 D_801FD438; +u16 sPrevAmbienceSeqId; // AudioOcarina bss OcarinaStaff sPlayingStaff; @@ -202,11 +218,14 @@ s8 sAudioCodeReverb = 0; // Sequence Data u8 sPrevSeqMode = 0; -f32 sAudioEnemyDist = 0.0f; -s8 sAudioEnemyVol = 127; +f32 sBgmEnemyDist = 0.0f; +s8 sBgmEnemyVolume = 127; u16 sPrevMainBgmSeqId = NA_BGM_DISABLED; -u8 sBgmPlayerIOPort7 = 0; -u8 sSceneSeqId2 = NA_BGM_GENERAL_SFX; + +#define SEQ_RESUME_POINT_NONE 0xC0 +u8 sSeqResumePoint = 0; +u8 sPrevSceneSeqId = NA_BGM_GENERAL_SFX; + u32 sNumFramesStill = 0; u32 sNumFramesMoving = 0; u8 sAudioBaseFilter = 0; @@ -217,768 +236,893 @@ s8 gUnderwaterSfxReverbAdd = 0; Vec3f* sRiverSoundBgmPos = NULL; f32 sRiverSoundXZDistToPlayer = 2000.0f; u8 sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX; + +// Allows enemy bgm +#define SEQ_FLAG_ENEMY (1 << 0) + +#define SEQ_FLAG_FANFARE (1 << 1) +#define SEQ_FLAG_FANFARE_KAMARO (1 << 2) + +// required for Audio_RestorePrevBgm to restore a sequence after Audio_PlayBgm_StorePrevBgm +#define SEQ_FLAG_RESTORE (1 << 3) + +/** + * These two sequence flags work together to implement a “resume playing from where you left off” system for scene + * sequences when leaving and returning to a scene. For a scene to resume playing from the point where it left off, it + * must have `SEQ_FLAG_RESUME` attached to it. Then, if the scene changes and the new scene sequence contain + * `SEQ_FLAG_RESUME_PREV`, the point from the previous scene sequence will be stored. Then, when returning to the + * scene with the sequence `SEQ_FLAG_RESUME`, then the sequence will resume playing from where it left off. + * + * TODO: Confirm which sequences properly implement this system after sequence extraction + */ +#define SEQ_FLAG_RESUME (1 << 4) +#define SEQ_FLAG_RESUME_PREV (1 << 5) + +/** + * Will write a value of 1 to ioPort 7 when called through the scene. How it's used depends on the sequence: + * NA_BGM_FILE_SELECT - ioPort 7 skips the harp intro when a value of 1 is written to it. + */ +#define SEQ_FLAG_SKIP_HARP_INTRO (1 << 6) + +// Unused, repurposed for SubBgm +#define SEQ_FLAG_NO_AMBIENCE (1 << 7) + u8 sSeqFlags[] = { - 0x3, // NA_BGM_GENERAL_SFX - 0x1, // NA_BGM_NATURE_AMBIENCE - 0x1, // NA_BGM_TERMINA_FIELD - 0x8, // NA_BGM_CHASE - 0, // NA_BGM_MAJORAS_THEME - 0, // NA_BGM_CLOCK_TOWER - 0x1, // NA_BGM_STONE_TOWER_TEMPLE - 0x1, // NA_BGM_INV_STONE_TOWER_TEMPLE - 0x2, // NA_BGM_FAILURE_0 - 0x2, // NA_BGM_FAILURE_1 - 0, // NA_BGM_HAPPY_MASK_SALESMAN - 0, // NA_BGM_SONG_OF_HEALING - 0x1, // NA_BGM_SWAMP_REGION - 0, // NA_BGM_ALIEN_INVASION - 0x2, // NA_BGM_SWAMP_CRUISE - 0, // NA_BGM_SHARPS_CURSE - 0x1, // NA_BGM_GREAT_BAY_REGION - 0x1, // NA_BGM_IKANA_REGION - 0, // NA_BGM_DEKU_KING - 0x1, // NA_BGM_MOUNTAIN_REGION - 0, // NA_BGM_PIRATES_FORTRESS - 0, // NA_BGM_CLOCK_TOWN_DAY_1 - 0, // NA_BGM_CLOCK_TOWN_DAY_2 - 0, // NA_BGM_CLOCK_TOWN_DAY_3 - 0x40, // NA_BGM_FILE_SELECT - 0x10, // NA_BGM_CLEAR_EVENT - 0, // NA_BGM_ENEMY - 0x8, // NA_BGM_BOSS - 0x1, // NA_BGM_WOODFALL_TEMPLE - 0, // NA_BGM_MARKET - 0, // NA_BGM_OPENING - 0x20, // NA_BGM_INSIDE_A_HOUSE - 0x2, // NA_BGM_GAME_OVER - 0, // NA_BGM_CLEAR_BOSS - 0x2, // NA_BGM_GET_ITEM - 0x2, // NA_BGM_GATE_OPEN - 0x2, // NA_BGM_GET_HEART - 0x8, // NA_BGM_TIMED_MINI_GAME - 0, // NA_BGM_GORON_RACE - 0, // NA_BGM_MUSIC_BOX_HOUSE - 0, // NA_BGM_FAIRY_FOUNTAIN - 0, // NA_BGM_ZELDAS_LULLABY - 0, // NA_BGM_ROSA_SISTERS - 0x2, // NA_BGM_OPEN_CHEST - 0, // NA_BGM_MARINE_RESEARCH_LAB - 0x40, // NA_BGM_GIANTS_THEME - 0, // NA_BGM_SONG_OF_STORMS - 0, // NA_BGM_ROMANI_RANCH - 0, // NA_BGM_GORON_VILLAGE - 0, // NA_BGM_MAYORS_OFFICE - 0x2, // NA_BGM_OCA_EPONA - 0x2, // NA_BGM_OCA_SUNS - 0x2, // NA_BGM_OCA_TIME - 0x2, // NA_BGM_OCA_STORM - 0x10, // NA_BGM_ZORA_HALL - 0x2, // NA_BGM_GET_NEW_MASK - 0x8, // NA_BGM_MINI_BOSS - 0x2, // NA_BGM_GET_SMALL_ITEM - 0, // NA_BGM_ASTRAL_OBSERVATORY - 0x1, // NA_BGM_CAVERN - 0x11, // NA_BGM_MILK_BAR - 0x2, // NA_BGM_ZELDA_APPEAR - 0, // NA_BGM_SARIAS_SONG - 0, // NA_BGM_GORON_GOAL - 0, // NA_BGM_HORSE - 0, // NA_BGM_HORSE_GOAL - 0, // NA_BGM_INGO - 0, // NA_BGM_KOTAKE_POTION_SHOP - 0x20, // NA_BGM_SHOP - 0x2, // NA_BGM_OWL - 0x20, // NA_BGM_MINI_GAME - 0x2, // NA_BGM_OCA_SOARING - 0x2, // NA_BGM_OCA_HEALING - 0x2, // NA_BGM_INVERTED_SONG_OF_TIME - 0x2, // NA_BGM_SONG_OF_DOUBLE_TIME - 0x2, // NA_BGM_SONATA_OF_AWAKENING - 0x2, // NA_BGM_GORON_LULLABY - 0x2, // NA_BGM_NEW_WAVE_BOSSA_NOVA - 0x2, // NA_BGM_ELEGY_OF_EMPTINESS - 0x2, // NA_BGM_OATH_TO_ORDER - 0, // NA_BGM_SWORD_TRAINING_HALL - 0x2, // NA_BGM_GORON_LULLABY_INTRO - 0x2, // NA_BGM_OCA_FAIRY - 0x2, // NA_BGM_BREMEN_MARCH - 0x2, // NA_BGM_BALLAD_OF_THE_WIND_FISH - 0x8, // NA_BGM_SONG_OF_SOARING - 0, // NA_BGM_MILK_BAR_DUPLICATE - 0, // NA_BGM_FINAL_HOURS - 0x2, // NA_BGM_MIKAU_RIFF - 0x2, // NA_BGM_MIKAU_FINALE - 0, // NA_BGM_FROG_SONG - 0x2, // NA_BGM_OCA_SONATA - 0x2, // NA_BGM_OCA_LULLABY - 0x2, // NA_BGM_OCA_NEW_WAVE - 0x2, // NA_BGM_OCA_ELEGY - 0x2, // NA_BGM_OCA_OATH - 0, // NA_BGM_MAJORAS_LAIR - 0x2, // NA_BGM_OCA_LULLABY_INTRO - 0x2, // NA_BGM_OCA_GUITAR_BASS_SESSION - 0x2, // NA_BGM_PIANO_SESSION - 0x2, // NA_BGM_INDIGO_GO_SESSION - 0x1, // NA_BGM_SNOWHEAD_TEMPLE - 0x1, // NA_BGM_GREAT_BAY_TEMPLE - 0x2, // NA_BGM_NEW_WAVE_SAXOPHONE - 0x2, // NA_BGM_NEW_WAVE_VOCAL - 0, // NA_BGM_MAJORAS_WRATH - 0, // NA_BGM_MAJORAS_INCARNATION - 0, // NA_BGM_MAJORAS_MASK - 0x2, // NA_BGM_BASS_PLAY - 0x2, // NA_BGM_DRUMS_PLAY - 0x2, // NA_BGM_PIANO_PLAY - 0x1, // NA_BGM_IKANA_CASTLE - 0, // NA_BGM_GATHERING_GIANTS - 0x4, // NA_BGM_KAMARO_DANCE - 0, // NA_BGM_CREMIA_CARRIAGE - 0x2, // NA_BGM_KEATON_QUIZ - 0, // NA_BGM_END_CREDITS_1 - 0, // NA_BGM_OPENING_LOOP - 0, // NA_BGM_TITLE_THEME - 0x2, // NA_BGM_DUNGEON_APPEAR - 0x2, // NA_BGM_WOODFALL_CLEAR - 0x2, // NA_BGM_SNOWHEAD_CLEAR - 0, // - 0, // NA_BGM_INTO_THE_MOON - 0, // NA_BGM_GOODBYE_GIANT - 0, // NA_BGM_TATL_AND_TAEL - 0, // NA_BGM_MOONS_DESTRUCTION - 0, // NA_BGM_END_CREDITS_2 + SEQ_FLAG_FANFARE | SEQ_FLAG_ENEMY, // NA_BGM_GENERAL_SFX + SEQ_FLAG_ENEMY, // NA_BGM_AMBIENCE + SEQ_FLAG_ENEMY, // NA_BGM_TERMINA_FIELD + SEQ_FLAG_RESTORE, // NA_BGM_CHASE + 0, // NA_BGM_MAJORAS_THEME + 0, // NA_BGM_CLOCK_TOWER + SEQ_FLAG_ENEMY, // NA_BGM_STONE_TOWER_TEMPLE + SEQ_FLAG_ENEMY, // NA_BGM_INV_STONE_TOWER_TEMPLE + SEQ_FLAG_FANFARE, // NA_BGM_FAILURE_0 + SEQ_FLAG_FANFARE, // NA_BGM_FAILURE_1 + 0, // NA_BGM_HAPPY_MASK_SALESMAN + 0, // NA_BGM_SONG_OF_HEALING + SEQ_FLAG_ENEMY, // NA_BGM_SWAMP_REGION + 0, // NA_BGM_ALIEN_INVASION + SEQ_FLAG_FANFARE, // NA_BGM_SWAMP_CRUISE + 0, // NA_BGM_SHARPS_CURSE + SEQ_FLAG_ENEMY, // NA_BGM_GREAT_BAY_REGION + SEQ_FLAG_ENEMY, // NA_BGM_IKANA_REGION + 0, // NA_BGM_DEKU_KING + SEQ_FLAG_ENEMY, // NA_BGM_MOUNTAIN_REGION + 0, // NA_BGM_PIRATES_FORTRESS + 0, // NA_BGM_CLOCK_TOWN_DAY_1 + 0, // NA_BGM_CLOCK_TOWN_DAY_2 + 0, // NA_BGM_CLOCK_TOWN_DAY_3 + SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_FILE_SELECT + SEQ_FLAG_RESUME, // NA_BGM_CLEAR_EVENT + 0, // NA_BGM_ENEMY + SEQ_FLAG_RESTORE, // NA_BGM_BOSS + SEQ_FLAG_ENEMY, // NA_BGM_WOODFALL_TEMPLE + 0, // NA_BGM_MARKET + 0, // NA_BGM_OPENING + SEQ_FLAG_RESUME_PREV, // NA_BGM_INSIDE_A_HOUSE + SEQ_FLAG_FANFARE, // NA_BGM_GAME_OVER + 0, // NA_BGM_CLEAR_BOSS + SEQ_FLAG_FANFARE, // NA_BGM_GET_ITEM + SEQ_FLAG_FANFARE, // NA_BGM_GATE_OPEN + SEQ_FLAG_FANFARE, // NA_BGM_GET_HEART + SEQ_FLAG_RESTORE, // NA_BGM_TIMED_MINI_GAME + 0, // NA_BGM_GORON_RACE + 0, // NA_BGM_MUSIC_BOX_HOUSE + 0, // NA_BGM_FAIRY_FOUNTAIN + 0, // NA_BGM_ZELDAS_LULLABY + 0, // NA_BGM_ROSA_SISTERS + SEQ_FLAG_FANFARE, // NA_BGM_OPEN_CHEST + 0, // NA_BGM_MARINE_RESEARCH_LAB + SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_GIANTS_THEME + 0, // NA_BGM_SONG_OF_STORMS + 0, // NA_BGM_ROMANI_RANCH + 0, // NA_BGM_GORON_VILLAGE + 0, // NA_BGM_MAYORS_OFFICE + SEQ_FLAG_FANFARE, // NA_BGM_OCA_EPONA + SEQ_FLAG_FANFARE, // NA_BGM_OCA_SUNS + SEQ_FLAG_FANFARE, // NA_BGM_OCA_TIME + SEQ_FLAG_FANFARE, // NA_BGM_OCA_STORM + SEQ_FLAG_RESUME, // NA_BGM_ZORA_HALL + SEQ_FLAG_FANFARE, // NA_BGM_GET_NEW_MASK + SEQ_FLAG_RESTORE, // NA_BGM_MINI_BOSS + SEQ_FLAG_FANFARE, // NA_BGM_GET_SMALL_ITEM + 0, // NA_BGM_ASTRAL_OBSERVATORY + SEQ_FLAG_ENEMY, // NA_BGM_CAVERN + SEQ_FLAG_RESUME | SEQ_FLAG_ENEMY, // NA_BGM_MILK_BAR + SEQ_FLAG_FANFARE, // NA_BGM_ZELDA_APPEAR + 0, // NA_BGM_SARIAS_SONG + 0, // NA_BGM_GORON_GOAL + 0, // NA_BGM_HORSE + 0, // NA_BGM_HORSE_GOAL + 0, // NA_BGM_INGO + 0, // NA_BGM_KOTAKE_POTION_SHOP + SEQ_FLAG_RESUME_PREV, // NA_BGM_SHOP + SEQ_FLAG_FANFARE, // NA_BGM_OWL + SEQ_FLAG_RESUME_PREV, // NA_BGM_MINI_GAME + SEQ_FLAG_FANFARE, // NA_BGM_OCA_SOARING + SEQ_FLAG_FANFARE, // NA_BGM_OCA_HEALING + SEQ_FLAG_FANFARE, // NA_BGM_INVERTED_SONG_OF_TIME + SEQ_FLAG_FANFARE, // NA_BGM_SONG_OF_DOUBLE_TIME + SEQ_FLAG_FANFARE, // NA_BGM_SONATA_OF_AWAKENING + SEQ_FLAG_FANFARE, // NA_BGM_GORON_LULLABY + SEQ_FLAG_FANFARE, // NA_BGM_NEW_WAVE_BOSSA_NOVA + SEQ_FLAG_FANFARE, // NA_BGM_ELEGY_OF_EMPTINESS + SEQ_FLAG_FANFARE, // NA_BGM_OATH_TO_ORDER + 0, // NA_BGM_SWORD_TRAINING_HALL + SEQ_FLAG_FANFARE, // NA_BGM_GORON_LULLABY_INTRO + SEQ_FLAG_FANFARE, // NA_BGM_OCA_FAIRY + SEQ_FLAG_FANFARE, // NA_BGM_BREMEN_MARCH + SEQ_FLAG_FANFARE, // NA_BGM_BALLAD_OF_THE_WIND_FISH + SEQ_FLAG_RESTORE, // NA_BGM_SONG_OF_SOARING + 0, // NA_BGM_MILK_BAR_DUPLICATE + 0, // NA_BGM_FINAL_HOURS + SEQ_FLAG_FANFARE, // NA_BGM_MIKAU_RIFF + SEQ_FLAG_FANFARE, // NA_BGM_MIKAU_FINALE + 0, // NA_BGM_FROG_SONG + SEQ_FLAG_FANFARE, // NA_BGM_OCA_SONATA + SEQ_FLAG_FANFARE, // NA_BGM_OCA_LULLABY + SEQ_FLAG_FANFARE, // NA_BGM_OCA_NEW_WAVE + SEQ_FLAG_FANFARE, // NA_BGM_OCA_ELEGY + SEQ_FLAG_FANFARE, // NA_BGM_OCA_OATH + 0, // NA_BGM_MAJORAS_LAIR + SEQ_FLAG_FANFARE, // NA_BGM_OCA_LULLABY_INTRO + SEQ_FLAG_FANFARE, // NA_BGM_OCA_GUITAR_BASS_SESSION + SEQ_FLAG_FANFARE, // NA_BGM_PIANO_SESSION + SEQ_FLAG_FANFARE, // NA_BGM_INDIGO_GO_SESSION + SEQ_FLAG_ENEMY, // NA_BGM_SNOWHEAD_TEMPLE + SEQ_FLAG_ENEMY, // NA_BGM_GREAT_BAY_TEMPLE + SEQ_FLAG_FANFARE, // NA_BGM_NEW_WAVE_SAXOPHONE + SEQ_FLAG_FANFARE, // NA_BGM_NEW_WAVE_VOCAL + 0, // NA_BGM_MAJORAS_WRATH + 0, // NA_BGM_MAJORAS_INCARNATION + 0, // NA_BGM_MAJORAS_MASK + SEQ_FLAG_FANFARE, // NA_BGM_BASS_PLAY + SEQ_FLAG_FANFARE, // NA_BGM_DRUMS_PLAY + SEQ_FLAG_FANFARE, // NA_BGM_PIANO_PLAY + SEQ_FLAG_ENEMY, // NA_BGM_IKANA_CASTLE + 0, // NA_BGM_GATHERING_GIANTS + SEQ_FLAG_FANFARE_KAMARO, // NA_BGM_KAMARO_DANCE + 0, // NA_BGM_CREMIA_CARRIAGE + SEQ_FLAG_FANFARE, // NA_BGM_KEATON_QUIZ + 0, // NA_BGM_END_CREDITS_1 + 0, // NA_BGM_OPENING_LOOP + 0, // NA_BGM_TITLE_THEME + SEQ_FLAG_FANFARE, // NA_BGM_DUNGEON_APPEAR + SEQ_FLAG_FANFARE, // NA_BGM_WOODFALL_CLEAR + SEQ_FLAG_FANFARE, // NA_BGM_SNOWHEAD_CLEAR + 0, // + 0, // NA_BGM_INTO_THE_MOON + 0, // NA_BGM_GOODBYE_GIANT + 0, // NA_BGM_TATL_AND_TAEL + 0, // NA_BGM_MOONS_DESTRUCTION + 0, // NA_BGM_END_CREDITS_2 }; -s8 sSpecReverbs[20] = { +s8 sSpecReverbs[] = { 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -NatureAmbienceDataIO sNatureAmbienceData[20] = { - // natureSeqId: 0 +#define AMBIENCE_CHANNEL_PROPERTIES_ENTRIES_MAX 33 + +typedef struct { + /* 0x0 */ u16 initChannelMask; // bitwise flag for 16 channels, channels to initialize + /* 0x2 */ u16 initMuteChannelMask; // bitwise flag for 16 channels, channels to mute upon initialization + /* 0x4 */ u8 channelProperties[3 * AMBIENCE_CHANNEL_PROPERTIES_ENTRIES_MAX + 1]; +} AmbienceDataIO; // size = 0x68 + +AmbienceDataIO sAmbienceData[20] = { + // AMBIENCE_ID_00 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_09), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_09), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_03), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(0), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_03), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 1 + // AMBIENCE_ID_01 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_16), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_16), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_12), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(0), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_12), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_15), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_15), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_06), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_06), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 2 + // AMBIENCE_ID_02 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(48), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(48), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_2_BEND_PITCH(48), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(32), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(48), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(32), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_03), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(0), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_03), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_4_BEND_PITCH(64), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(0), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(0), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(0), - NATURE_IO_CRITTER_5_PORT5(63), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_5_PORT5(63), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 3 + // AMBIENCE_ID_03 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_09), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_09), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_1_BEND_PITCH(64), - NATURE_IO_CRITTER_1_NUM_LAYERS(0), - NATURE_IO_CRITTER_1_PORT5(48), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_1_PORT5(48), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_2_BEND_PITCH(32), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(32), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(32), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(32), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_14), - NATURE_IO_CRITTER_3_BEND_PITCH(64), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_14), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 4 + // AMBIENCE_ID_04 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_02), - NATURE_IO_CRITTER_1_BEND_PITCH(64), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_02), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_12), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_12), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_13), - NATURE_IO_CRITTER_3_BEND_PITCH(64), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_13), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_4_BEND_PITCH(64), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_02), - NATURE_IO_CRITTER_5_BEND_PITCH(112), - NATURE_IO_CRITTER_5_NUM_LAYERS(0), - NATURE_IO_CRITTER_5_PORT5(48), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_02), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_5_PORT5(48), // Channel 14 - NATURE_IO_RAIN_PORT4(63), + AMBIENCE_IO_RAIN_PORT4(63), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 5 + // AMBIENCE_ID_05 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_09), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_09), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_13), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(0), - NATURE_IO_CRITTER_3_PORT5(63), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_13), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_3_PORT5(63), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 6 + // AMBIENCE_ID_06 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_0_BEND_PITCH(112), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(48), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(48), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_15), - NATURE_IO_CRITTER_1_BEND_PITCH(112), - NATURE_IO_CRITTER_1_NUM_LAYERS(0), - NATURE_IO_CRITTER_1_PORT5(63), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_15), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_1_PORT5(63), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_2_BEND_PITCH(48), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(16), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(48), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(16), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_14), - NATURE_IO_CRITTER_3_BEND_PITCH(48), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_14), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(48), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(0), - NATURE_IO_CRITTER_4_PORT5(32), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_4_PORT5(32), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_02), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(0), - NATURE_IO_CRITTER_5_PORT5(48), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_02), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_5_PORT5(48), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 7 + // AMBIENCE_ID_07 { - 0xC001, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 8 + // AMBIENCE_ID_08 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_0_BEND_PITCH(127), - NATURE_IO_CRITTER_0_NUM_LAYERS(3), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 9 + // AMBIENCE_ID_09 { - 0xC00F, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_16), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(2), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_16), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(2), + AMBIENCE_IO_CRITTER_0_PORT5(16), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_12), - NATURE_IO_CRITTER_1_BEND_PITCH(112), - NATURE_IO_CRITTER_1_NUM_LAYERS(0), - NATURE_IO_CRITTER_1_PORT5(48), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_12), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_1_PORT5(48), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_15), - NATURE_IO_CRITTER_2_BEND_PITCH(127), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(16), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_15), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 10 + // AMBIENCE_ID_0A { - 0xC081, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_1), - NATURE_IO_STREAM_0_PORT3(8), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_1), + AMBIENCE_IO_STREAM_0_PORT3(8), // Channel 7 - NATURE_IO_CRITTER_6_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_6_BEND_PITCH(112), - NATURE_IO_CRITTER_6_NUM_LAYERS(2), - NATURE_IO_CRITTER_6_PORT5(32), + AMBIENCE_IO_CRITTER_6_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_6_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_6_NUM_LAYERS(2), + AMBIENCE_IO_CRITTER_6_PORT5(32), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 11 + // AMBIENCE_ID_0B { - 0xC00F, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_3), - NATURE_IO_STREAM_0_PORT3(8), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_3), + AMBIENCE_IO_STREAM_0_PORT3(8), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_0_BEND_PITCH(127), - NATURE_IO_CRITTER_0_NUM_LAYERS(3), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_0_PORT5(16), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_1_BEND_PITCH(127), - NATURE_IO_CRITTER_1_NUM_LAYERS(2), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(2), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_06), - NATURE_IO_CRITTER_2_BEND_PITCH(127), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(16), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_06), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 12 + // AMBIENCE_ID_0C { - 0xC007, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_0_BEND_PITCH(127), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_1_BEND_PITCH(127), - NATURE_IO_CRITTER_1_NUM_LAYERS(3), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_1_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 13 + // AMBIENCE_ID_0D { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 14 + // AMBIENCE_ID_0E { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 15 + // AMBIENCE_ID_0F { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 16 + // AMBIENCE_ID_10 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 17 + // AMBIENCE_ID_11 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 18 + // AMBIENCE_ID_12 { - 0xC000, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 19 + // AMBIENCE_ID_13 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, @@ -3256,7 +3400,7 @@ u8 sRequestCustomSequence = false; void AudioOcarina_SetCustomSequence(void) { // Never passes true as sRequestCustomSequence is never set true if (sRequestCustomSequence && gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].enabled && - ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].soundScriptIO[0] == 0xFF)) { + ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].soundScriptIO[0] == (u8)SEQ_IO_VAL_NONE)) { gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].seqData = sCustomSequenceScript; sRequestCustomSequence = false; } @@ -3477,17 +3621,46 @@ void AudioOcarina_ResetStaffs(void) { D_801D8534 = 0; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019DFF8.s") +void Audio_Noop1(s32 arg0) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E000.s") +void Audio_Noop2(s32 arg0, s32 arg1) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E00C.s") +void Audio_Noop3(void) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E014.s") +void Audio_Update(void) { + if ((func_801A9768() == 0) && (func_801A982C() == 0)) { + AudioOcarina_SetCustomSequence(); + AudioOcarina_Update(); + func_801A5118(); + Audio_StepFreqLerp(&sRiverFreqScaleLerp); + Audio_StepFreqLerp(&sWaterfallFreqScaleLerp); + Audio_UpdateRiverSoundVolumes(); + Audio_UpdateSceneSequenceResumePoint(); + func_801A312C(); + func_8019FEDC(); + func_801A1E0C(); + func_801A1904(); + func_801A2090(); + func_801A3AC0(); + func_801A1290(); + Audio_ResetRequestedSceneSeqId(); + AudioSfx_ProcessRequests(); + func_801A89D0(); + AudioSfx_ProcessActiveSfx(); + func_801A8D5C(); + AudioSfx_ProcessSfxSettings(); + AudioThread_ScheduleProcessCmds(); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E0FC.s") +void Audio_Noop4(s32 arg0) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E104.s") +void Audio_Noop5(s32 arg0, s32 arg1) { +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E110.s") @@ -3582,7 +3755,7 @@ s8 AudioSfx_ComputeReverb(u8 bankId, u8 entryIndex, u8 channelIndex) { if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex])) { scriptAdd = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1]; - if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1] < 0) { + if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1] <= SEQ_IO_VAL_NONE) { scriptAdd = 0; } } @@ -3815,7 +3988,7 @@ void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex) { case BANK_ENV: case BANK_ENEMY: case BANK_VOICE: - if (sSoundMode == SOUNDMODE_SURROUND) { + if (sSoundMode == SOUNDMODE_SURROUND_EXTERNAL) { combFilterGain = AudioSfx_ComputeCombFilter(*entry->posY, entry->sfxParams); } // fallthrough @@ -3826,7 +3999,7 @@ void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex) { panSigned = AudioSfx_ComputePanSigned(*entry->posX, *entry->posZ, entry->token); freqScale = AudioSfx_ComputeFreqScale(bankId, entryIndex) * *entry->freqScale; - if (sSoundMode == SOUNDMODE_SURROUND) { + if (sSoundMode == SOUNDMODE_SURROUND_EXTERNAL) { if (*entry->posZ >= 0.0f) { if (*entry->posZ < 200.0f) { zVolume = 32.0f - ((*entry->posZ / 300.0f) * 32.0f); @@ -3859,7 +4032,7 @@ void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex) { ((entry->sfxFlags & SFX_FLAG2_APPLY_LOWPASS_FILTER) >> 2)) * 2); filter &= 0xFF; - } else if ((sSoundMode == SOUNDMODE_SURROUND) && !(entry->sfxParams & SFX_FLAG_VOLUME_NO_DIST)) { + } else if ((sSoundMode == SOUNDMODE_SURROUND_EXTERNAL) && !(entry->sfxParams & SFX_FLAG_VOLUME_NO_DIST)) { filter = AudioSfx_ComputeSurroundSoundFilter(behindScreenZ, entry, panSigned); } break; @@ -4189,7 +4362,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume) { gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIndex]) { // soundScriptIO[5] was set to 0x40 in channels 0, 1, and 4 (BGM no longer in OoT) if ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIndex]->soundScriptIO[5] != - 0xFF) { + (u8)SEQ_IO_VAL_NONE) { // Higher volume leads to lower reverb reverb = (((u16)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIndex]->soundScriptIO[5] - @@ -4350,9 +4523,51 @@ void Audio_ClearSariaBgmAtPos(Vec3f* pos) { } } -u8 sBgmPlayers[2] = { SEQ_PLAYER_BGM_MAIN, SEQ_PLAYER_BGM_SUB }; -void Audio_SplitBgmChannels(s8 volumeSplit); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SplitBgmChannels.s") +/** + * Turns on and off channels from both bgm players in a way that splits + * equally between the two bgm channels. Split based on note priority + */ +void Audio_SplitBgmChannels(s8 volumeSplit) { + u8 volume; + u8 notePriority; + u16 channelBits; + u8 sBgmPlayers[2] = { SEQ_PLAYER_BGM_MAIN, SEQ_PLAYER_BGM_SUB }; + u8 i; + u8 channelIndex; + + if ((Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) && + (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + for (i = 0; i < ARRAY_COUNT(sBgmPlayers); i++) { + if (i == 0) { + // Main Bgm SeqPlayer + volume = volumeSplit; + } else { + // Sub Bgm SeqPlayer + volume = 0x7F - volumeSplit; + } + + if (volume > 100) { + notePriority = 11; + } else if (volume < 20) { + notePriority = 2; + } else { + notePriority = ((volume - 20) / 10) + 2; + } + + channelBits = 0; + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + if (gAudioContext.seqPlayers[sBgmPlayers[i]].channels[channelIndex]->notePriority < notePriority) { + // If the note currently playing in the channel is a high enough priority, + // then keep the channel on by setting a channelBit + // If this condition fails, then the channel will be shut off + channelBits += (1 << channelIndex); + } + } + + Audio_QueueSeqCmd(0xA0000000 | ((u32)(sBgmPlayers[i]) << 24) | ((u32)(channelBits))); + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0E44.s") @@ -4404,7 +4619,7 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) { if (sRiverSoundBgmPos == NULL) { sRiverSoundBgmPos = pos; - func_801A3238(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2); + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2); } else { prevDist = sqrtf(SQ(sRiverSoundBgmPos->z) + SQ(sRiverSoundBgmPos->x)); if (dist < prevDist) { @@ -4441,15 +4656,80 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A246C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2544.s") +void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne) { + Audio_StartMorningSceneSequence(seqId); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | (u32)(dayMinusOne)); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A257C.s") +void Audio_StartMorningSceneSequence(u16 seqId) { + if (seqId != NA_BGM_AMBIENCE) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_AMBIENCE) << 24) | ((0) << 16)); + Audio_StartSceneSequence(seqId); + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1); + } else { + Audio_PlayAmbience(AMBIENCE_ID_08); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A25E4.s") +void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne) { + if (sRequestedSceneSeqId != seqId) { + if (seqId == NA_BGM_AMBIENCE) { + Audio_PlayAmbience(AMBIENCE_ID_08); + } else if ((seqId != NA_BGM_FINAL_HOURS) || (sPrevMainBgmSeqId == NA_BGM_DISABLED)) { + Audio_StartSceneSequence(seqId); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | + (u32)(dayMinusOne)); + } + sRequestedSceneSeqId = seqId; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2670.s") +void Audio_StartSceneSequence(u16 seqId) { + u8 fadeInDuration = 0; + u8 skipHarpIntro; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2778.s") + if ((sSeqFlags[sPrevSceneSeqId] & SEQ_FLAG_RESUME_PREV) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME)) { + // Resume the sequence from the point where it left off last time it was played in the scene + if ((sSeqResumePoint & 0x3F) != 0) { + fadeInDuration = 30; + } + + // Write the sequence resumePoint to resume from into ioPort 7 + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, fadeInDuration, 7, sSeqResumePoint); + + sSeqResumePoint = 0; + } else { + // Start the sequence from the beginning + + // Writes to ioPort 7. See `SEQ_FLAG_SKIP_HARP_INTRO` for writing a value of 1 to ioPort 7. + if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_SKIP_HARP_INTRO) { + skipHarpIntro = 1; + } else { + skipHarpIntro = (u8)SEQ_IO_VAL_NONE; + } + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, skipHarpIntro); + + if (!(sSeqFlags[seqId] & SEQ_FLAG_RESUME_PREV)) { + // Reset the sequence resumePoint + sSeqResumePoint = SEQ_RESUME_POINT_NONE; + } + } + sPrevSceneSeqId = seqId & 0xFF; +} + +void Audio_UpdateSceneSequenceResumePoint(void) { + u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + + if ((seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME)) { + if (sSeqResumePoint != SEQ_RESUME_POINT_NONE) { + // Get the current point to resume from + sSeqResumePoint = gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]; + } else { + // Initialize the point to resume from to the start of the sequence + sSeqResumePoint = 0; + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A27E8.s") @@ -4463,35 +4743,238 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C44.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C88.s") +void Audio_PlaySequenceInCutscene(u16 seqId) { + if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { + Audio_PlayFanfare(seqId); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_FANFARE) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + } else { + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, SEQ_IO_VAL_NONE); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 1, 0x7F, 0); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 0); + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2D54.s") +void Audio_StopSequenceInCutscene(u16 seqId) { + if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((0) << 16)); + } else { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s") +s32 Audio_IsSequencePlaying(u8 seqId) { + u8 playerIndex = SEQ_PLAYER_BGM_MAIN; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2E54.s") + if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE) { + playerIndex = SEQ_PLAYER_FANFARE; + } else if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { + playerIndex = SEQ_PLAYER_FANFARE; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2ED8.s") + if (seqId == (Audio_GetActiveSequence(playerIndex) & 0xFF)) { + return true; + } else { + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2F88.s") +void Audio_PlayBgm_StorePrevBgm(u16 seqId) { + u16 curSeqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2FC4.s") + if (curSeqId == NA_BGM_DISABLED) { + curSeqId = NA_BGM_GENERAL_SFX; + } + + if (curSeqId != seqId) { + Audio_SetSequenceMode(SEQ_MODE_IGNORE); + + // Ensure the sequence about to be stored isn't also storing a separate sequence + if (!(sSeqFlags[curSeqId] & SEQ_FLAG_RESTORE)) { + sPrevMainBgmSeqId = curSeqId; + } + + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | (u32)(seqId + 0x8000)); + } +} + +/** + * To be used in conjunction with Audio_PlayBgm_StorePrevBgm + */ +void Audio_RestorePrevBgm(void) { + if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && + (sSeqFlags[Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) & 0xFF] & SEQ_FLAG_RESTORE)) { + if ((sPrevMainBgmSeqId == NA_BGM_DISABLED) || (sPrevMainBgmSeqId == NA_BGM_GENERAL_SFX)) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + } else { + if (sPrevMainBgmSeqId == NA_BGM_AMBIENCE) { + sPrevMainBgmSeqId = sPrevAmbienceSeqId; + } + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | + (u32)(sPrevMainBgmSeqId + 0x8000)); + } + sPrevMainBgmSeqId = NA_BGM_DISABLED; + } +} + +// Unused +void Audio_PlayAmbience_StorePrevBgm(u8 ambienceId) { + u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + + if (seqId != NA_BGM_AMBIENCE) { + sPrevMainBgmSeqId = seqId; + } + + Audio_PlayAmbience(ambienceId); +} + +// Unused +void Audio_ForceRestorePreviousBgm(void) { + if (sPrevMainBgmSeqId != NA_BGM_DISABLED) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | + (u32)(sPrevMainBgmSeqId + 0x8000)); + } + + sPrevMainBgmSeqId = NA_BGM_DISABLED; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3000.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3038.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3098.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_PlayFanfare.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A312C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A31EC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3238.s") +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData) { + u16 flaggedSeqId; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A32CC.s") + Audio_QueueSeqCmd(0x70000000 | ((u32)(playerIndex) << 24) | ((u32)(ioPort) << 0x10) | (u32)(ioData)); + if ((seqId & 0xFF) < 2) { + flaggedSeqId = seqId; + } else { + flaggedSeqId = seqId | 0x8000; + } + Audio_QueueSeqCmd(0x00000000 | ((u32)(playerIndex) << 24) | ((u32)(fadeInDuration) << 0x10) | (u32)(flaggedSeqId)); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3590.s") +void Audio_SetSequenceMode(u8 seqMode) { + s32 volumeFadeInTimer; + u16 seqId; + u8 volumeFadeOutTimer; + + if ((sPrevMainBgmSeqId == NA_BGM_DISABLED) && (sPrevMainBgmSeqId == NA_BGM_DISABLED)) { + // clang-format off + if (sAudioCutsceneFlag || sSpatialSeqIsActive[SEQ_PLAYER_BGM_SUB]) { \ + seqMode = SEQ_MODE_IGNORE; + } + // clang-format on + + seqId = gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId; + + if ((seqId == NA_BGM_DISABLED) || (sSeqFlags[(u8)(seqId & 0xFF)] & SEQ_FLAG_ENEMY) || + ((sPrevSeqMode & 0x7F) == SEQ_MODE_ENEMY)) { + if (seqMode != (sPrevSeqMode & 0x7F)) { + if (seqMode == SEQ_MODE_ENEMY) { + // If only seqMode = SEQ_MODE_ENEMY (Start) + if (gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume < 0) { + volumeFadeInTimer = -(gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume); + } else { + volumeFadeInTimer = gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume; + } + + Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, volumeFadeInTimer); + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | + (u32)(NA_BGM_ENEMY | 0x800)); + + if (seqId >= NA_BGM_TERMINA_FIELD) { + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F - sBgmEnemyVolume, 10); + Audio_SplitBgmChannels(sBgmEnemyVolume); + } + } else if ((sPrevSeqMode & 0x7F) == SEQ_MODE_ENEMY) { + // If only sPrevSeqMode = SEQ_MODE_ENEMY (End) + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((10) << 16)); + + if (seqMode == SEQ_MODE_IGNORE) { + volumeFadeOutTimer = 0; + } else { + volumeFadeOutTimer = 10; + } + + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, volumeFadeOutTimer); + Audio_SplitBgmChannels(0); + } + + sPrevSeqMode = seqMode + 0x80; + } else { + if (seqMode == SEQ_MODE_ENEMY) { + // If both seqMode = sPrevSeqMode = SEQ_MODE_ENEMY + if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == NA_BGM_DISABLED) && + (seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_ENEMY)) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | + (u32)(NA_BGM_ENEMY | 0x800)); + sPrevSeqMode = seqMode + 0x80; + } + } + } + } else { + // Remnant of OoT's Hyrule Field Sequence + if (seqMode == SEQ_MODE_DEFAULT) { + if (sPrevSeqMode == SEQ_MODE_STILL) { + sNumFramesMoving = 0; + } + sNumFramesStill = 0; + sNumFramesMoving++; + } else { + sNumFramesStill++; + } + + if ((seqMode == SEQ_MODE_STILL) && (sNumFramesStill < 30) && (sNumFramesMoving > 20)) { + seqMode = SEQ_MODE_DEFAULT; + } + + sPrevSeqMode = seqMode; + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(2) << 0x10) | (u32)(seqMode)); + } + } +} + +void Audio_UpdateEnemyBgmVolume(f32 dist) { + f32 adjDist; + u16 seqId = gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId; + + if (sPrevSeqMode == (SEQ_MODE_ENEMY | 0x80)) { + if (dist != sBgmEnemyDist) { + // clamp (dist - 150.0f) between 0 and 350 + if (dist < 150.0f) { + adjDist = 0.0f; + } else if (dist > 500.0f) { + adjDist = 350.0f; + } else { + adjDist = dist - 150.0f; + } + + sBgmEnemyVolume = ((350.0f - adjDist) * 127.0f) / 350.0f; + Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, 10); + + if ((seqId >= NA_BGM_TERMINA_FIELD) && !(sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO)) { + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sBgmEnemyVolume), 10); + } + } + + Audio_SplitBgmChannels(sBgmEnemyVolume); + } + sBgmEnemyDist = dist; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A36F0.s") @@ -4521,7 +5004,9 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3EC0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetCutsceneFlag.s") +void Audio_SetCutsceneFlag(s8 flag) { + sAudioCutsceneFlag = flag; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3F6C.s") @@ -4529,7 +5014,7 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3FFC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/audio_setBGM.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetSpec.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4058.s") @@ -4551,7 +5036,9 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A44C4.s") +void Audio_ResetRequestedSceneSeqId(void) { + sRequestedSceneSeqId = NA_BGM_DISABLED; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A44D4.s") @@ -4562,14 +5049,111 @@ f32 sSfxOriginalPos[] = { 0.0f, 0.0f, 0.0f }; #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A479C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A47DC.s") +void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData) { + u8 firstChannelIndex; + u8 lastChannelIndex; + u8 channelIndex; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A48E0.s") + if ((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) && func_801A8ABC(NA_BGM_AMBIENCE, 0xF00000FF)) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4A28.s") + // channelIndexRange = 01 on ioPort 1 + if ((((channelIndexRange << 8) + (u32)ioPort) == ((1 << 8) | (u32)1)) && + (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + D_801FD3A8 = 0; + } -u32 Audio_SetNatureAmbienceRandomBend(u8 seqScriptValIn, SequenceChannel* channel); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetNatureAmbienceRandomBend.s") + firstChannelIndex = channelIndexRange >> 4; + lastChannelIndex = channelIndexRange & 0xF; + + if (firstChannelIndex == 0) { + firstChannelIndex = channelIndexRange & 0xF; + } + + for (channelIndex = firstChannelIndex; channelIndex <= lastChannelIndex; channelIndex++) { + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | + ((u32)(channelIndex) << 8) | (u32)(ioData)); + } +} + +void Audio_StartAmbience(u16 initChannelMask, u16 initMuteChannelMask) { + u8 channelIndex; + + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_0) << 0x10) | + (u32)(1)); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_4) << 0x10) | + (u32)((u8)(initChannelMask >> 8))); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_5) << 0x10) | + (u32)((u8)(initChannelMask & 0xFF))); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 1); + + if ((Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_DISABLED) && + (Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_AMBIENCE)) { + Audio_StopSequence(SEQ_PLAYER_AMBIENCE, 0); + AudioThread_QueueCmdS32(0xF8 << 24, 0); + } + + if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 1); + } + + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(0) << 0x10) | (u32)(NA_BGM_AMBIENCE)); + + for (channelIndex = 0; channelIndex < 16; channelIndex++) { + if (!(initMuteChannelMask & (1 << channelIndex)) && (initChannelMask & (1 << channelIndex))) { + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_1) << 16) | + ((u32)(channelIndex) << 8) | (u32)(1)); + } + } +} + +void Audio_PlayAmbience(u8 ambienceId) { + u8 i = 0; + u8 channelIndex; + u8 ioPort; + u8 ioData; + + if (!((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_DISABLED) && + (sSeqFlags[gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE))) { + if (gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) { + sPrevAmbienceSeqId = gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId; + } + + Audio_StartAmbience(sAmbienceData[ambienceId].initChannelMask, sAmbienceData[ambienceId].initMuteChannelMask); + + while ((sAmbienceData[ambienceId].channelProperties[i] != 0xFF) && + (i < ARRAY_COUNT(sAmbienceData[ambienceId].channelProperties))) { + channelIndex = sAmbienceData[ambienceId].channelProperties[i++]; + ioPort = sAmbienceData[ambienceId].channelProperties[i++]; + ioData = sAmbienceData[ambienceId].channelProperties[i++]; + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | + ((u32)(channelIndex) << 8) | (u32)(ioData)); + } + + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_7) << 16) | + ((u32)(AMBIENCE_CHANNEL_SOUND_MODE) << 8) | (u32)(sSoundMode)); + } +} + +u32 Audio_SetAmbienceRandomBend(u8 seqScriptValIn, SequenceChannel* channel) { + u32 seqScriptValOut = seqScriptValIn; + + gAudioContext.seqPlayers[SEQ_PLAYER_AMBIENCE].applyBend = true; + + if ((seqScriptValIn == 0) || (seqScriptValIn == 0xFF)) { + gAudioContext.seqPlayers[SEQ_PLAYER_AMBIENCE].bend = 1.0f; + } else { + seqScriptValOut = AudioThread_NextRandom(); + gAudioContext.seqPlayers[SEQ_PLAYER_AMBIENCE].bend = 1.0293 - ((gAudioContext.audioRandom & 0xF) / 144.0f); + + return seqScriptValOut; + } + +#ifdef AVOID_UB + return seqScriptValOut; +#endif +} void Audio_Init(void) { AudioLoad_Init(NULL, 0); @@ -4587,7 +5171,7 @@ void AudioSfx_Init(u16 fadeTimer) { } AudioThread_QueueCmdS32(0xE4000000, AudioSfx_SetFreqAndStereoBits); - AudioThread_QueueCmdS32(0xE4000001, Audio_SetNatureAmbienceRandomBend); + AudioThread_QueueCmdS32(0xE4000001, Audio_SetAmbienceRandomBend); } #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4D00.s") diff --git a/src/code/audio/code_801A5BD0.c b/src/code/audio/code_801A5BD0.c index 4cf1147bfa..d769708299 100644 --- a/src/code/audio/code_801A5BD0.c +++ b/src/code/audio/code_801A5BD0.c @@ -671,7 +671,7 @@ void AudioSfx_PlayActiveSfx(u8 bankId) { // "one-frame" sfx entry->state = SFX_STATE_PLAYING_ONE_FRAME; } - } else if ((u8)channel->soundScriptIO[1] == 0xFF) { + } else if ((u8)channel->soundScriptIO[1] == (u8)SEQ_IO_VAL_NONE) { // Signal from seq 0 that the sfx is finished playing. Remove entry AudioSfx_RemoveBankEntry(bankId, entryIndex); } else if (entry->state == SFX_STATE_PLAYING_REFRESH) { diff --git a/src/code/audio/code_801A7B10.c b/src/code/audio/code_801A7B10.c index f2f37a0138..3f84460362 100644 --- a/src/code/audio/code_801A7B10.c +++ b/src/code/audio/code_801A7B10.c @@ -2,7 +2,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D04.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D84.s") @@ -10,7 +10,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A89D0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8A50.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8ABC.s") diff --git a/src/code/game.c b/src/code/game.c index da21de17f4..73352379f6 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -225,7 +225,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g void GameState_Destroy(GameState* gameState) { AudioMgr_StopAllSfxExceptSystem(); - func_8019E014(); + Audio_Update(); osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK); if (gameState->destroy != NULL) { diff --git a/src/code/graph.c b/src/code/graph.c index 654d2c5f76..869740e4b3 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -232,7 +232,7 @@ void Graph_UpdateGame(GameState* gameState) { Game_UpdateInput(gameState); Game_IncrementFrameCount(gameState); if (SREG(20) < 3) { - func_8019E014(); + Audio_Update(); } } diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index c970282a89..0e682231f4 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -6,8 +6,8 @@ void SaveContext_Init(void) { bzero(&gSaveContext, sizeof(SaveContext)); gSaveContext.save.playerForm = 0; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX; gSaveContext.nextCutsceneIndex = 0xFFEF; gSaveContext.cutsceneTrigger = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 4453bd6748..69995db164 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -152,7 +152,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c break; case 0x2: if (isStartFrame) { - func_801A47DC(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); + Audio_SetAmbienceChannelIO(AMBIENCE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); Environment_AddLightningBolts(play, 3); D_801F4E68 = 1; } @@ -376,14 +376,14 @@ void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmd // Command 0x12C: Plays a sequence (Background music or Fanfare) void Cutscene_Command_PlaySequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { if (csCtx->frames == cmd->startFrame) { - func_801A2C88(cmd->sequence - 1); + Audio_PlaySequenceInCutscene(cmd->sequence - 1); } } // Command 0x12D: Stops a sequence (Background music or Fanfare) void Cutscene_Command_StopSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { - func_801A2D54(cmd->sequence - 1); + Audio_StopSequenceInCutscene(cmd->sequence - 1); } } @@ -403,9 +403,7 @@ void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCm // Command 0x12E: Play Ambience sequence void Cutscene_Command_PlayAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if (csCtx->frames == cmd->startFrame) { - // Audio_PlayNatureAmbienceSequence - // nightSeqIndex is natureAmbienceId - func_801A4A28(play->soundCtx.nightSeqIndex); + Audio_PlayAmbience(play->sequenceCtx.ambienceId); } } @@ -455,29 +453,27 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { break; case 4: - // func_801A246C(SEQ_PLAYER_NATURE, TYPE_1); - func_801A246C(SEQ_PLAYER_NATURE, 1); + // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_1); + func_801A246C(SEQ_PLAYER_AMBIENCE, 1); break; case 5: - // func_801A246C(SEQ_PLAYER_NATURE, TYPE_0); - func_801A246C(SEQ_PLAYER_NATURE, 0); + // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_0); + func_801A246C(SEQ_PLAYER_AMBIENCE, 0); break; case 6: - // func_801A246C(SEQ_PLAYER_NATURE, TYPE_2); - func_801A246C(SEQ_PLAYER_NATURE, 2); + // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_2); + func_801A246C(SEQ_PLAYER_AMBIENCE, 2); break; case 7: - // Audio_GetActiveSequence - seqId = func_801A8A50(0); + seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); break; case 8: if (seqId != NA_BGM_DISABLED) { - // Audio_PlayBgmForDayScene - func_801A25E4(seqId, dayMinusOne); + Audio_PlaySceneSequence(seqId, dayMinusOne); } break; } @@ -647,7 +643,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB // Command 0x15F: Chooses between a cutscene or a rotating mask depending on whether the player has the corresponding // mask void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(0, true) != 0xFF)) { + if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(SEQ_PLAYER_BGM_MAIN, true) != 0xFF)) { switch (cmd->base) { case 1: Cutscene_TerminatorImpl(play, csCtx, cmd); diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 9fc3dee25b..776dc75d76 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -46,8 +46,8 @@ void GameOver_Update(PlayState* play) { gSaveContext.unk_3DC0 = 2000; gSaveContext.save.playerData.tatlTimer = 0; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.eventInf[0] = 0; gSaveContext.eventInf[1] = 0; gSaveContext.eventInf[2] = 0; @@ -67,7 +67,7 @@ void GameOver_Update(PlayState* play) { gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; case GAMEOVER_DEATH_FADE_OUT: - if (func_801A8A50(1) != NA_BGM_GAME_OVER) { + if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { func_80169F78(&play->state); if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index a3a4e331dd..ce5ddf7694 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -436,11 +436,12 @@ void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x15: Sound Settings= void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { - play->soundCtx.seqIndex = cmd->soundSettings.musicSeq; - play->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX; + play->sequenceCtx.seqId = cmd->soundSettings.seqId; + play->sequenceCtx.ambienceId = cmd->soundSettings.ambienceId; - if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) { - audio_setBGM(cmd->soundSettings.bgmId); + if (gSaveContext.seqId == (u8)NA_BGM_DISABLED || + Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) { + Audio_SetSpec(cmd->soundSettings.specId); } } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index ca8ad214f5..f26bc505f5 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -521,7 +521,7 @@ void func_809ED224(Boss04* this) { this->unk_2C8 = 200; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_DEAD); this->actor.flags &= ~ACTOR_FLAG_1; - func_801A2ED8(); + Audio_RestorePrevBgm(); this->unk_1F6 = 10; } @@ -759,7 +759,7 @@ void Boss04_Update(Actor* thisx, PlayState* play2) { if (D_809EE4D0 != 0) { D_809EE4D0--; if (D_809EE4D0 == 0) { - func_801A2E54(0x38); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 5988d1913e..9a0f95004c 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -670,7 +670,7 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) { void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, PlayState* play) { switch (play->csCtx.frames) { case 5: - func_801A4A28(12); + Audio_PlayAmbience(AMBIENCE_ID_0C); break; case 660: @@ -688,7 +688,7 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { switch (play->csCtx.frames) { case 5: - func_801A4A28(12); + Audio_PlayAmbience(AMBIENCE_ID_0C); break; case 45: diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 6bf8adc727..65df579cea 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -537,7 +537,7 @@ void func_808A1784(DoorShutter* this, PlayState* play) { } else { DoorShutter_SetupAction(this, func_808A1090); } - func_801A2ED8(); + Audio_RestorePrevBgm(); } } diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 33f8225d35..575cf2d353 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -671,7 +671,7 @@ void func_809C2730(EnAob01* this, PlayState* play) { void func_809C2788(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x20; if (func_809C25E4(this, play)) { - if (func_801A8A50(0) != 0x41) { + if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_HORSE_GOAL) { play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3; play->transitionType = TRANS_TYPE_64; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 4834256d6e..3f35a5e353 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -1426,7 +1426,7 @@ void func_80A97AB4(EnAz* this, PlayState* play) { if (play->msgCtx.choiceIndex == 0) { func_8019F208(); play->msgCtx.msgMode = 0x44; - func_800FD750(NA_BGM_MINI_GAME_2); + func_800FD750(NA_BGM_TIMED_MINI_GAME); func_80A94AB8(this, play, 1); func_80A979DC(this, play); } else { @@ -1466,7 +1466,7 @@ void func_80A97C4C(EnAz* this, PlayState* play) { func_80A97410(this, play); if ((this->unk_2FA == 1) || (this->unk_2FA == 3) || (this->unk_2FA == 6) || (this->unk_2FA == 8)) { gSaveContext.save.weekEventReg[24] &= (u8)~1; - func_800FD750(NA_BGM_MINI_GAME_2); + func_800FD750(NA_BGM_TIMED_MINI_GAME); play->nextEntrance = Entrance_CreateFromSpawn(1); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 20a868bc61..62e1df422a 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -220,7 +220,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) { if (thisx->params == ENBIGPO_REGULAR) { // the well poe, starts immediately thisx->flags &= ~ACTOR_FLAG_10; // always update OFF - this->unkBool204 = true; + this->storePrevBgm = true; EnBigpo_InitWellBigpo(this); } else if (thisx->params == ENBIGPO_SUMMONED) { // dampe type EnBigpo_InitDampeMainPo(this); @@ -439,9 +439,9 @@ void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, PlayState* play) { */ void EnBigpo_SpawnCutsceneStage7(EnBigpo* this) { this->idleTimer = 15; - if (this->unkBool204 == false) { - func_801A2E54(NA_BGM_MINI_BOSS); - this->unkBool204 = true; + if (this->storePrevBgm == false) { + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); + this->storePrevBgm = true; } this->actionFunc = EnBigpo_SpawnCutsceneStage8; } @@ -525,9 +525,9 @@ void EnBigpo_WarpingIn(EnBigpo* this, PlayState* play) { this->mainColor.a = this->idleTimer * (255.0f / 32.0f); if (this->idleTimer == 32) { this->mainColor.a = 255; // fully visible - if (this->unkBool204 == false) { - func_801A2E54(NA_BGM_MINI_BOSS); - this->unkBool204 = true; + if (this->storePrevBgm == false) { + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); + this->storePrevBgm = true; } EnBigpo_SetupIdleFlying(this); } @@ -1124,7 +1124,7 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.params == ENBIGPO_SUMMONED) { // dampe type - func_801A2ED8(); + Audio_RestorePrevBgm(); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h index 9117bd97c5..9b84784f46 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h @@ -30,7 +30,7 @@ typedef struct EnBigpo { /* 0x188 */ Vec3s jointTable[ENBIGPO_LIMBCOUNT]; /* 0x1C4 */ Vec3s morphTable[ENBIGPO_LIMBCOUNT]; /* 0x200 */ EnBigPoActionFunc actionFunc; - /* 0x204 */ u8 unkBool204; // need to know what func_801A2E54 does to know what this is + /* 0x204 */ u8 storePrevBgm; /* 0x206 */ s16 idleTimer; // frame counter /* 0x208 */ s16 unk208; // facing rotY? /* 0x20A */ s16 rotVelocity; diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 6cc0b2e72b..98212382bf 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -1005,7 +1005,7 @@ void EnBigslime_CallMinislime(EnBigslime* this, PlayState* play) { } else if (this->isAnimUpdate) { Animation_PlayLoop(&this->skelAnime, &gGekkoNervousIdleAnim); EnBigslime_UpdateCameraIntroCs(this, play, 25); - func_801A2E54(0x38); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnBigslime_InitFallMinislime(this); play->envCtx.lightSettingOverride = 0xFF; this->callTimer = 35; @@ -2620,7 +2620,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect != BIGSLIME_DMGEFF_HOOKSHOT) { if (Actor_ApplyDamage(&this->actor) == 0) { func_800BE504(&this->actor, &this->gekkoCollider); - func_801A2ED8(); + Audio_RestorePrevBgm(); Enemy_StartFinishingBlow(play, &this->actor); this->gekkoCollider.base.acFlags &= ~AC_ON; EnBigslime_GekkoThaw(this, play); diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index a9d9756bea..25f5de3e1d 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -691,7 +691,7 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { gSaveContext.save.bombersCaughtNum++; if (gSaveContext.save.bombersCaughtNum > 4) { - func_801A3098(0x922); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); } diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 10c28b6eb6..bc33adc0ca 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -482,7 +482,7 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, -1); - func_801A3098(0x2B | 0x900); + Audio_PlayFanfare(NA_BGM_OPEN_CHEST | 0x900); } if (this->getItemId == GI_STRAY_FAIRY) { diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index c17acf8cc9..bf2f5e7ce1 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -511,7 +511,7 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); this->unk_290++; if (this->unk_290 == 10) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } subCamAt.x = this->actor.world.pos.x; @@ -530,7 +530,7 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { void func_8089B4A4(EnDinofos* this) { if (this->unk_290 < 10) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_00C974); this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x; @@ -1279,7 +1279,7 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { } if (this->actor.cutscene != -1) { - func_801A2ED8(); + Audio_RestorePrevBgm(); } } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index fa465afbec..12d804fbaf 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -493,7 +493,7 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { // You found a Stray Fairy! Message_StartTextbox(play, 0x11, NULL); if (gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= 15) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } } } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 8ab640253a..c0be813614 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -538,7 +538,7 @@ void func_80962660(EnFu* this, PlayState* play) { player->stateFlags1 |= 0x20; this->unk_53C = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - func_801A2BB8(NA_BGM_MINI_GAME_2); + func_801A2BB8(NA_BGM_TIMED_MINI_GAME); if (this->unk_542 == 0) { if (this->unk_546 == 1) { func_80961EC8(play); @@ -799,7 +799,7 @@ void func_80962F4C(EnFu* this, PlayState* play) { func_801A2C20(); gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); func_8011B4E0(play, 1); this->unk_54A = 3; func_809632D0(this); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index d71e4c1935..ffd45eaf96 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -387,7 +387,7 @@ void EnIk_Idle(EnIk* this, PlayState* play) { } } else if (this->colliderCylinder.base.acFlags & AC_HIT) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); this->actor.hintId = TATL_HINT_ID_IRON_KNUCKLE; this->colliderCylinder.base.acFlags &= ~AC_HIT; this->invincibilityFrames = 12; @@ -786,7 +786,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { isArmorBroken = true; } else { Enemy_StartFinishingBlow(play, &this->actor); - func_801A2ED8(); + Audio_RestorePrevBgm(); } } if (isArmorBroken == true) { diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 2ac1672352..2050c7316e 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1989,7 +1989,7 @@ void func_80B470E0(EnInvadepoh* this) { void func_80B47108(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 100) { - func_801A3098(NA_BGM_CLEAR_EVENT); + Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); } this->actionTimer--; if (this->actionTimer <= 0) { diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index e90b2decc9..49d7a06fb5 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -881,7 +881,7 @@ void EnMaYto_SetupAfterMilkRunInit(EnMaYto* this) { if (gSaveContext.save.weekEventReg[52] & 1) { // if (ProtectedCremia) EnMaYto_SetFaceExpression(this, 3, 1); } else { - func_801A3098(NA_BGM_FAILURE_1); + Audio_PlayFanfare(NA_BGM_FAILURE_1); EnMaYto_SetFaceExpression(this, 5, 2); } this->actionFunc = EnMaYto_AfterMilkRunInit; diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 6909183f38..ac3c8322e3 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -303,7 +303,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { this->unk_2AC--; if (this->unk_2AC == 0) { if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) { - func_801A3098(0x922); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { play_sound(NA_SE_SY_ERROR); } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index f1bfcd57fb..8b636787d1 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -356,7 +356,7 @@ void func_8095AE60(EnOwl* this, PlayState* play) { void func_8095AEC0(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (func_8095A978(this, play, 0x7D0, 360.0f, 200.0f)) { - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_8095AE60; } } @@ -385,7 +385,7 @@ void func_8095AF2C(EnOwl* this, PlayState* play) { void func_8095AFEC(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (func_8095A978(this, play, 0xBF6, 200.0f, 100.0f)) { - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_8095AF2C; this->unk_406 = 0; this->actionFlags |= 0x40; @@ -500,7 +500,7 @@ void func_8095B574(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_8095BA84; - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->actionFlags |= 0x40; this->unk_406 = 2; } else if (this->actor.xzDistToPlayer < 200.0f) { @@ -713,7 +713,7 @@ void func_8095BE0C(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_8095BA84; - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->unk_406 = 1; this->actionFlags |= 0x40; } else if (this->actor.textId == 0xBF0) { diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index b1b3d9cbc9..4be8ad3c15 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -1035,7 +1035,7 @@ void EnPametfrog_LookAround(EnPametfrog* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime) && !Play_InCsMode(play)) { if (!this->unk_2AE) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); this->unk_2AE = true; } EnPametfrog_SetupJumpToLink(this); @@ -1255,7 +1255,7 @@ void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, PlayState* play) void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, PlayState* play) { if (this->actor.params == GEKKO_INIT_SNAPPER) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnPametfrog_SetupRunToSnapper(this); } } @@ -1267,7 +1267,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { !(this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { if (this->actor.params == GEKKO_PRE_SNAPPER) { if (Actor_ApplyDamage(&this->actor) == 0) { - func_801A2ED8(); + Audio_RestorePrevBgm(); } if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ZORA_BARRIER) { @@ -1303,7 +1303,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { EnPametfrog_ApplyMagicArrowEffects(this, play); Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; - func_801A2ED8(); + Audio_RestorePrevBgm(); EnPametfrog_SetupCutscene(this); } else if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ZORA_BARRIER) { EnPametfrog_ApplyElectricStun(this); diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index 1d504dc621..5a25038083 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -377,7 +377,7 @@ void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play) { if ((this->actionFunc != func_80A2BF18) && (this->unk_1D8 < this->unk_1EE) && (this->unk_1D8 > 10)) { if ((this->collider.base.acFlags & AC_HIT) && (this->unk_1E2 == 1)) { if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) == 1) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { play_sound(NA_SE_SY_TRE_BOX_APPEAR); } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index a504ab5212..42f205bca4 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -395,7 +395,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) func_80123F2C(play, 80); this->shootingGameState = SG_GAME_STATE_RUNNING; this->actionFunc = EnSyatekiMan_Swamp_StartGame; - func_801A2BB8(NA_BGM_MINI_GAME_2); + func_801A2BB8(NA_BGM_TIMED_MINI_GAME); break; case 0xA32: // You have to try harder! @@ -753,7 +753,7 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) func_80112AFC(play); func_80123F2C(play, 0x63); this->shootingGameState = SG_GAME_STATE_RUNNING; - func_801A2BB8(NA_BGM_MINI_GAME_2); + func_801A2BB8(NA_BGM_TIMED_MINI_GAME); this->actionFunc = EnSyatekiMan_Town_StartGame; break; @@ -1349,7 +1349,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { func_801A2C20(); this->actionFunc = EnSyatekiMan_Town_EndGame; if (this->score == 50) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); func_8011B4E0(play, 1); } } diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 647b211829..b6a0f9ed40 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -424,7 +424,7 @@ void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { this->unk_34C.base.acFlags &= ~AC_HIT; this->actor.colChkInfo.health -= 2; if (this->actor.colChkInfo.health == 0) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); func_80A20858(this, play); } else { play_sound(NA_SE_SY_TRE_BOX_APPEAR); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index ba375f583d..c0f0a3e89e 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -690,7 +690,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { break; case 110: - func_801A3098(0x4A); + Audio_PlayFanfare(NA_BGM_SONG_OF_DOUBLE_TIME); break; case 38: diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index fcbb0223b6..e1223cddb4 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -409,7 +409,7 @@ void EnTest7_Init(Actor* thisx, PlayState* play2) { } else { func_80AF082C(this, func_80AF19A8); EnTest7_SetupAction(this, func_80AF2854); - func_801A2E54(NA_BGM_SONG_OF_SOARING); + Audio_PlayBgm_StorePrevBgm(NA_BGM_SONG_OF_SOARING); } if (play->playerActorCsIds[8] == -1) { @@ -677,8 +677,8 @@ void func_80AF2350(EnTest7* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_02; - gSaveContext.seqIndex = 0xFF; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } void func_80AF24D8(EnTest7* this, PlayState* play, f32 arg2) { diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index 4f302e2687..1ba5e6ebcd 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -247,8 +247,8 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { func_8019F128(NA_SE_OC_SECRET_HOLE_OUT); func_801A4058(5); if (1) {} - gSaveContext.seqIndex = 0xFF; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } } diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index 6c6d6e02ad..6cc8e2d048 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -60,7 +60,7 @@ void ObjDemo_Init(Actor* thisx, PlayState* play) { } void func_80983634(PlayState* play) { - if ((play->sceneId == SCENE_CASTLE) && (func_801A8A50(0) == NA_BGM_IKANA_CASTLE)) { + if ((play->sceneId == SCENE_CASTLE) && (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_IKANA_CASTLE)) { Audio_QueueSeqCmd(0x100100FF); } } diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 9bae7169e0..7cb4f310f7 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -751,7 +751,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { ObjUm_SetupAction(this, ObjUm_PostMilkRunStartCs); this->unk_354 = 0; ObjUm_RotatePlayer(this, play, 0); - func_801A3098(NA_BGM_CLEAR_EVENT); + Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); } else { this->type = OBJ_UM_TYPE_TERMINA_FIELD; ObjUm_SetupAction(this, ObjUm_TerminaFieldIdle); @@ -1295,9 +1295,9 @@ void ObjUm_RunMinigame(ObjUm* this, PlayState* play) { switch (ObjUm_UpdatePath(this, play)) { case OBJUM_PATH_STATE_1: case OBJUM_PATH_STATE_FINISH: - gSaveContext.seqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.save.weekEventReg[31] &= (u8)~0x80; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; if (!(gSaveContext.save.weekEventReg[52] & 1) && !(gSaveContext.save.weekEventReg[52] & 2)) { if (!this->areAllPotsBroken) { diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 5d418c0fce..6ae0f5b6c3 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -41,8 +41,8 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { } gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = 0xFFFF; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.showTitleCard = true; gSaveContext.respawnFlag = 0; gSaveContext.respawn[RESPAWN_MODE_GORON].entrance = 0xFF; diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 352997f944..62d2a36d06 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -128,8 +128,8 @@ void ConsoleLogo_Main(GameState* thisx) { ConsoleLogo_UpdateCounters(this); ConsoleLogo_Draw(&this->state); if (this->exit) { - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.gameMode = 1; STOP_GAMESTATE(&this->state); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 825059e332..571812b3f5 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -3851,12 +3851,12 @@ 0x8019D8E4:("AudioOcarina_CreateCustomSequence",), 0x8019DF28:("AudioOcarina_ResetInstrument",), 0x8019DF64:("AudioOcarina_ResetStaffs",), - 0x8019DFF8:("func_8019DFF8",), - 0x8019E000:("func_8019E000",), - 0x8019E00C:("func_8019E00C",), - 0x8019E014:("func_8019E014",), - 0x8019E0FC:("func_8019E0FC",), - 0x8019E104:("func_8019E104",), + 0x8019DFF8:("Audio_Noop1",), + 0x8019E000:("Audio_Noop2",), + 0x8019E00C:("Audio_Noop3",), + 0x8019E014:("Audio_Update",), + 0x8019E0FC:("Audio_Noop4",), + 0x8019E104:("Audio_Noop5",), 0x8019E110:("func_8019E110",), 0x8019E14C:("AudioSfx_ComputeVolume",), 0x8019E324:("AudioSfx_ComputeReverb",), @@ -3938,32 +3938,32 @@ 0x801A21FC:("Audio_PlaySariaBgm",), 0x801A2460:("Audio_ClearSariaBgm2",), 0x801A246C:("func_801A246C",), - 0x801A2544:("func_801A2544",), - 0x801A257C:("func_801A257C",), - 0x801A25E4:("func_801A25E4",), - 0x801A2670:("func_801A2670",), - 0x801A2778:("func_801A2778",), + 0x801A2544:("Audio_PlayMorningSceneSequence",), + 0x801A257C:("Audio_StartMorningSceneSequence",), + 0x801A25E4:("Audio_PlaySceneSequence",), + 0x801A2670:("Audio_StartSceneSequence",), + 0x801A2778:("Audio_UpdateSceneSequenceResumePoint",), 0x801A27E8:("func_801A27E8",), 0x801A281C:("func_801A281C",), 0x801A29D4:("func_801A29D4",), 0x801A2BB8:("func_801A2BB8",), 0x801A2C20:("func_801A2C20",), 0x801A2C44:("func_801A2C44",), - 0x801A2C88:("func_801A2C88",), - 0x801A2D54:("func_801A2D54",), + 0x801A2C88:("Audio_PlaySequenceInCutscene",), + 0x801A2D54:("Audio_StopSequenceInCutscene",), 0x801A2DE0:("Audio_IsSequencePlaying",), - 0x801A2E54:("func_801A2E54",), - 0x801A2ED8:("func_801A2ED8",), - 0x801A2F88:("func_801A2F88",), - 0x801A2FC4:("func_801A2FC4",), + 0x801A2E54:("Audio_PlayBgm_StorePrevBgm",), + 0x801A2ED8:("Audio_RestorePrevBgm",), + 0x801A2F88:("Audio_PlayAmbience_StorePrevBgm",), + 0x801A2FC4:("Audio_ForceRestorePreviousBgm",), 0x801A3000:("func_801A3000",), 0x801A3038:("func_801A3038",), - 0x801A3098:("func_801A3098",), + 0x801A3098:("Audio_PlayFanfare",), 0x801A312C:("func_801A312C",), 0x801A31EC:("func_801A31EC",), - 0x801A3238:("func_801A3238",), - 0x801A32CC:("func_801A32CC",), - 0x801A3590:("func_801A3590",), + 0x801A3238:("Audio_PlaySequenceWithSeqPlayerIO",), + 0x801A32CC:("Audio_SetSequenceMode",), + 0x801A3590:("Audio_UpdateEnemyBgmVolume",), 0x801A36F0:("func_801A36F0",), 0x801A3950:("func_801A3950",), 0x801A39F8:("func_801A39F8",), @@ -3982,7 +3982,7 @@ 0x801A3F6C:("func_801A3F6C",), 0x801A3FB4:("func_801A3FB4",), 0x801A3FFC:("func_801A3FFC",), - 0x801A400C:("audio_setBGM",), + 0x801A400C:("Audio_SetSpec",), 0x801A4058:("func_801A4058",), 0x801A41C8:("func_801A41C8",), 0x801A41F8:("func_801A41F8",), @@ -3993,15 +3993,15 @@ 0x801A4380:("Audio_SetSfxVolumeExceptSystemAndOcarinaBanks",), 0x801A4428:("func_801A4428",), 0x801A44A4:("Audio_PreNMI",), - 0x801A44C4:("func_801A44C4",), + 0x801A44C4:("Audio_ResetRequestedSceneSeqId",), 0x801A44D4:("func_801A44D4",), 0x801A46F8:("func_801A46F8",), 0x801A4748:("func_801A4748",), 0x801A479C:("func_801A479C",), - 0x801A47DC:("func_801A47DC",), - 0x801A48E0:("func_801A48E0",), - 0x801A4A28:("func_801A4A28",), - 0x801A4B80:("Audio_SetNatureAmbienceRandomBend",), + 0x801A47DC:("Audio_SetAmbienceChannelIO",), + 0x801A48E0:("Audio_StartAmbience",), + 0x801A4A28:("Audio_PlayAmbience",), + 0x801A4B80:("Audio_SetAmbienceRandomBend",), 0x801A4C30:("Audio_Init",), 0x801A4C54:("AudioSfx_Init",), 0x801A4D00:("func_801A4D00",), @@ -4053,11 +4053,11 @@ 0x801A78E4:("AudioSfx_IsPlaying",), 0x801A794C:("AudioSfx_Reset",), 0x801A7B10:("Audio_StartSequence",), - 0x801A7D04:("func_801A7D04",), + 0x801A7D04:("Audio_StopSequence",), 0x801A7D84:("func_801A7D84",), 0x801A89A8:("Audio_QueueSeqCmd",), 0x801A89D0:("func_801A89D0",), - 0x801A8A50:("func_801A8A50",), + 0x801A8A50:("Audio_GetActiveSequence",), 0x801A8ABC:("func_801A8ABC",), 0x801A8B14:("func_801A8B14",), 0x801A8B2C:("func_801A8B2C",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index daa1356f21..edf51ff57c 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -2280,11 +2280,11 @@ 0x801D66B8:("sAudioEnvReverb","UNK_TYPE1","",0x1), 0x801D66BC:("sAudioCodeReverb","UNK_TYPE1","",0x1), 0x801D66C0:("sPrevSeqMode","UNK_TYPE1","",0x1), - 0x801D66C4:("sAudioEnemyDist","f32","",0x4), - 0x801D66C8:("sAudioEnemyVol","UNK_TYPE1","",0x1), + 0x801D66C4:("sBgmEnemyDist","f32","",0x4), + 0x801D66C8:("sBgmEnemyVolume","UNK_TYPE1","",0x1), 0x801D66CC:("sPrevMainBgmSeqId","UNK_TYPE2","",0x2), - 0x801D66D0:("sBgmPlayerIOPort7","UNK_TYPE1","",0x1), - 0x801D66D4:("sSceneSeqId2","UNK_TYPE1","",0x1), + 0x801D66D0:("sSeqResumePoint","UNK_TYPE1","",0x1), + 0x801D66D4:("sPrevSceneSeqId","UNK_TYPE1","",0x1), 0x801D66D8:("sNumFramesStill","UNK_TYPE4","",0x4), 0x801D66DC:("sNumFramesMoving","UNK_TYPE4","",0x4), 0x801D66E0:("sAudioBaseFilter","UNK_TYPE1","",0x1), @@ -2297,7 +2297,7 @@ 0x801D66FC:("sObjSoundMainBgmSeqId","UNK_TYPE1","",0x1), 0x801D6700:("sSeqFlags","UNK_TYPE1","",0x1), 0x801D6780:("sSpecReverbs","UNK_TYPE1","",0x1), - 0x801D6794:("sNatureAmbienceData","UNK_TYPE1","",0x1), + 0x801D6794:("sAmbienceData","UNK_TYPE1","",0x1), 0x801D6FB4:("sIsOcarinaInputEnabled","UNK_TYPE1","",0x1), 0x801D6FB8:("sOcarinaInstrumentId","UNK_TYPE1","",0x1), 0x801D6FBC:("sCurOcarinaPitch","UNK_TYPE1","",0x1), @@ -4255,14 +4255,14 @@ 0x801FD294:("sSfxVolumeCur","UNK_TYPE1","",0x1), 0x801FD298:("sSfxVolumeTarget","UNK_TYPE1","",0x1), 0x801FD29C:("sSfxVolumeRate","UNK_TYPE1","",0x1), - 0x801FD2A0:("sSceneSeqId1","UNK_TYPE1","",0x1), + 0x801FD2A0:("sRequestedSceneSeqId","UNK_TYPE1","",0x1), 0x801FD2A8:("sSfxChannelState","UNK_TYPE1","",0x1), 0x801FD3A8:("D_801FD3A8","UNK_TYPE1","",0x1), 0x801FD3A9:("D_801FD3A9","UNK_TYPE1","",0x1), 0x801FD3AA:("sRiverSoundBgmTimer","UNK_TYPE1","",0x1), 0x801FD3AB:("sFanfareState","UNK_TYPE1","",0x1), 0x801FD3AC:("sFanfareSeqId","UNK_TYPE1","",0x1), - 0x801FD3AE:("sMuteOnlySfxAndNatureSeq","UNK_TYPE1","",0x1), + 0x801FD3AE:("sMuteOnlySfxAndAmbienceSeq","UNK_TYPE1","",0x1), 0x801FD3AF:("sAllPlayersMutedExceptOcaAndSys","UNK_TYPE1","",0x1), 0x801FD3B0:("sAudioPauseState","UNK_TYPE1","",0x1), 0x801FD3B4:("sSpatialSeqIsActive","u8","[4]",0x4), @@ -4288,7 +4288,7 @@ 0x801FD434:("D_801FD434","UNK_TYPE1","",0x1), 0x801FD435:("sSpatialSeqPlayerIndex","UNK_TYPE1","",0x1), 0x801FD436:("sSpatialSeqFadeTimer","UNK_TYPE1","",0x1), - 0x801FD438:("D_801FD438","UNK_TYPE1","",0x1), + 0x801FD438:("sPrevAmbienceSeqId","UNK_TYPE1","",0x1), 0x801FD43A:("sPlayingStaff","OcarinaStaff","",0x3), 0x801FD43E:("sPlaybackStaff","OcarinaStaff","",0x3), 0x801FD442:("sRecordingStaff","OcarinaStaff","",0x3), @@ -4346,7 +4346,7 @@ 0x8020001E:("D_8020001E","UNK_TYPE1","",0x1), 0x802000C9:("D_802000C9","UNK_TYPE1","",0x1), 0x802000D4:("D_802000D4","UNK_TYPE1","",0x1), - 0x80200140:("D_80200140","UNK_TYPE1","",0x1), + 0x80200140:("gActiveSeqs","UNK_TYPE1","",0x1), 0x8020034A:("D_8020034A","UNK_TYPE1","",0x1), 0x80200B88:("D_80200B88","UNK_TYPE1","",0x1), 0x80200BBA:("D_80200BBA","UNK_TYPE1","",0x1), diff --git a/tools/namefixer.py b/tools/namefixer.py index eab13f0b95..f78717d40b 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -148,6 +148,17 @@ wordReplace = { "func_801A5BD0": "AudioSfx_MuteBanks", "func_801A72CC": "AudioSfx_StopByPos", "Audio_StopSfxByPos": "AudioSfx_StopByPos", + "func_801A3098": "Audio_PlayFanfare", + "func_801A8A50": "Audio_GetActiveSequence", + "func_801A2E54": "Audio_PlayBgm_StorePrevBgm", + "func_801A2ED8": "Audio_RestorePrevBgm", + "func_801A2544": "Audio_PlayMorningSceneSequence", + "func_801A25E4": "Audio_PlaySceneSequence", + "func_801A3238": "Audio_PlaySequenceWithSeqPlayerIO", + "func_801A32CC": "Audio_SetSequenceMode", + "func_801A3590": "Audio_UpdateEnemyBgmVolume", + "func_801A47DC": "Audio_SetAmbienceChannelIO", + "func_801A4A28": "Audio_PlayAmbience", "func_801A7328": "AudioSfx_StopByPosAndId", "func_801A75E8": "AudioSfx_StopById", "SkelAnime_LodDrawLimb": "SkelAnime_DrawLimbLod", @@ -690,6 +701,8 @@ wordReplace = { "gSaveContext.unk_3F30": "gSaveContext.magicFillTarget", "gSaveContext.unk_3F2C": "gSaveContext.magicFlag", "gSaveContext.save.entranceIndex": "gSaveContext.save.entrance", + "gSaveContext.seqIndex": "gSaveContext.seqId", + "gSaveContext.nightSeqIndex": "gSaveContext.ambienceId", "player->unk_A87": "player->exchangeItemId", "player->leftHandActor": "player->heldActor", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index ecdba5264a..dcb030e31f 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -3367,12 +3367,12 @@ asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayCustomSequence.s,AudioOcar asm/non_matchings/code/code_8019AF00/AudioOcarina_CreateCustomSequence.s,AudioOcarina_CreateCustomSequence,0x8019D8E4,0x191 asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetInstrument.s,AudioOcarina_ResetInstrument,0x8019DF28,0xF asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetStaffs.s,AudioOcarina_ResetStaffs,0x8019DF64,0x25 -asm/non_matchings/code/code_8019AF00/func_8019DFF8.s,func_8019DFF8,0x8019DFF8,0x2 -asm/non_matchings/code/code_8019AF00/func_8019E000.s,func_8019E000,0x8019E000,0x3 -asm/non_matchings/code/code_8019AF00/func_8019E00C.s,func_8019E00C,0x8019E00C,0x2 -asm/non_matchings/code/code_8019AF00/func_8019E014.s,func_8019E014,0x8019E014,0x3A -asm/non_matchings/code/code_8019AF00/func_8019E0FC.s,func_8019E0FC,0x8019E0FC,0x2 -asm/non_matchings/code/code_8019AF00/func_8019E104.s,func_8019E104,0x8019E104,0x3 +asm/non_matchings/code/code_8019AF00/Audio_Noop1.s,Audio_Noop1,0x8019DFF8,0x2 +asm/non_matchings/code/code_8019AF00/Audio_Noop2.s,Audio_Noop2,0x8019E000,0x3 +asm/non_matchings/code/code_8019AF00/Audio_Noop3.s,Audio_Noop3,0x8019E00C,0x2 +asm/non_matchings/code/code_8019AF00/Audio_Update.s,Audio_Update,0x8019E014,0x3A +asm/non_matchings/code/code_8019AF00/Audio_Noop4.s,Audio_Noop4,0x8019E0FC,0x2 +asm/non_matchings/code/code_8019AF00/Audio_Noop5.s,Audio_Noop5,0x8019E104,0x3 asm/non_matchings/code/code_8019AF00/func_8019E110.s,func_8019E110,0x8019E110,0xF asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeVolume.s,AudioSfx_ComputeVolume,0x8019E14C,0x76 asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeReverb.s,AudioSfx_ComputeReverb,0x8019E324,0x63 @@ -3454,32 +3454,32 @@ asm/non_matchings/code/code_8019AF00/func_801A2090.s,func_801A2090,0x801A2090,0x asm/non_matchings/code/code_8019AF00/Audio_PlaySariaBgm.s,Audio_PlaySariaBgm,0x801A21FC,0x99 asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgm2.s,Audio_ClearSariaBgm2,0x801A2460,0x3 asm/non_matchings/code/code_8019AF00/func_801A246C.s,func_801A246C,0x801A246C,0x36 -asm/non_matchings/code/code_8019AF00/func_801A2544.s,func_801A2544,0x801A2544,0xE -asm/non_matchings/code/code_8019AF00/func_801A257C.s,func_801A257C,0x801A257C,0x1A -asm/non_matchings/code/code_8019AF00/func_801A25E4.s,func_801A25E4,0x801A25E4,0x23 -asm/non_matchings/code/code_8019AF00/func_801A2670.s,func_801A2670,0x801A2670,0x42 -asm/non_matchings/code/code_8019AF00/func_801A2778.s,func_801A2778,0x801A2778,0x1C +asm/non_matchings/code/code_8019AF00/Audio_PlayMorningSceneSequence.s,Audio_PlayMorningSceneSequence,0x801A2544,0xE +asm/non_matchings/code/code_8019AF00/Audio_StartMorningSceneSequence.s,Audio_StartMorningSceneSequence,0x801A257C,0x1A +asm/non_matchings/code/code_8019AF00/Audio_PlaySceneSequence.s,Audio_PlaySceneSequence,0x801A25E4,0x23 +asm/non_matchings/code/code_8019AF00/Audio_StartSceneSequence.s,Audio_StartSceneSequence,0x801A2670,0x42 +asm/non_matchings/code/code_8019AF00/Audio_UpdateSceneSequenceResumePoint.s,Audio_UpdateSceneSequenceResumePoint,0x801A2778,0x1C asm/non_matchings/code/code_8019AF00/func_801A27E8.s,func_801A27E8,0x801A27E8,0xD asm/non_matchings/code/code_8019AF00/func_801A281C.s,func_801A281C,0x801A281C,0x6E asm/non_matchings/code/code_8019AF00/func_801A29D4.s,func_801A29D4,0x801A29D4,0x79 asm/non_matchings/code/code_8019AF00/func_801A2BB8.s,func_801A2BB8,0x801A2BB8,0x1A asm/non_matchings/code/code_8019AF00/func_801A2C20.s,func_801A2C20,0x801A2C20,0x9 asm/non_matchings/code/code_8019AF00/func_801A2C44.s,func_801A2C44,0x801A2C44,0x11 -asm/non_matchings/code/code_8019AF00/func_801A2C88.s,func_801A2C88,0x801A2C88,0x33 -asm/non_matchings/code/code_8019AF00/func_801A2D54.s,func_801A2D54,0x801A2D54,0x23 +asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceInCutscene.s,Audio_PlaySequenceInCutscene,0x801A2C88,0x33 +asm/non_matchings/code/code_8019AF00/Audio_StopSequenceInCutscene.s,Audio_StopSequenceInCutscene,0x801A2D54,0x23 asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s,Audio_IsSequencePlaying,0x801A2DE0,0x1D -asm/non_matchings/code/code_8019AF00/func_801A2E54.s,func_801A2E54,0x801A2E54,0x21 -asm/non_matchings/code/code_8019AF00/func_801A2ED8.s,func_801A2ED8,0x801A2ED8,0x2C -asm/non_matchings/code/code_8019AF00/func_801A2F88.s,func_801A2F88,0x801A2F88,0xF -asm/non_matchings/code/code_8019AF00/func_801A2FC4.s,func_801A2FC4,0x801A2FC4,0xF +asm/non_matchings/code/code_8019AF00/Audio_PlayBgm_StorePrevBgm.s,Audio_PlayBgm_StorePrevBgm,0x801A2E54,0x21 +asm/non_matchings/code/code_8019AF00/Audio_RestorePrevBgm.s,Audio_RestorePrevBgm,0x801A2ED8,0x2C +asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience_StorePrevBgm.s,Audio_PlayAmbience_StorePrevBgm,0x801A2F88,0xF +asm/non_matchings/code/code_8019AF00/Audio_ForceRestorePreviousBgm.s,Audio_ForceRestorePreviousBgm,0x801A2FC4,0xF asm/non_matchings/code/code_8019AF00/func_801A3000.s,func_801A3000,0x801A3000,0xE asm/non_matchings/code/code_8019AF00/func_801A3038.s,func_801A3038,0x801A3038,0x18 -asm/non_matchings/code/code_8019AF00/func_801A3098.s,func_801A3098,0x801A3098,0x25 +asm/non_matchings/code/code_8019AF00/Audio_PlayFanfare.s,Audio_PlayFanfare,0x801A3098,0x25 asm/non_matchings/code/code_8019AF00/func_801A312C.s,func_801A312C,0x801A312C,0x30 asm/non_matchings/code/code_8019AF00/func_801A31EC.s,func_801A31EC,0x801A31EC,0x13 -asm/non_matchings/code/code_8019AF00/func_801A3238.s,func_801A3238,0x801A3238,0x25 -asm/non_matchings/code/code_8019AF00/func_801A32CC.s,func_801A32CC,0x801A32CC,0xB1 -asm/non_matchings/code/code_8019AF00/func_801A3590.s,func_801A3590,0x801A3590,0x58 +asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceWithSeqPlayerIO.s,Audio_PlaySequenceWithSeqPlayerIO,0x801A3238,0x25 +asm/non_matchings/code/code_8019AF00/Audio_SetSequenceMode.s,Audio_SetSequenceMode,0x801A32CC,0xB1 +asm/non_matchings/code/code_8019AF00/Audio_UpdateEnemyBgmVolume.s,Audio_UpdateEnemyBgmVolume,0x801A3590,0x58 asm/non_matchings/code/code_8019AF00/func_801A36F0.s,func_801A36F0,0x801A36F0,0x98 asm/non_matchings/code/code_8019AF00/func_801A3950.s,func_801A3950,0x801A3950,0x2A asm/non_matchings/code/code_8019AF00/func_801A39F8.s,func_801A39F8,0x801A39F8,0x21 @@ -3498,7 +3498,7 @@ asm/non_matchings/code/code_8019AF00/Audio_SetCutsceneFlag.s,Audio_SetCutsceneFl asm/non_matchings/code/code_8019AF00/func_801A3F6C.s,func_801A3F6C,0x801A3F6C,0x12 asm/non_matchings/code/code_8019AF00/func_801A3FB4.s,func_801A3FB4,0x801A3FB4,0x12 asm/non_matchings/code/code_8019AF00/func_801A3FFC.s,func_801A3FFC,0x801A3FFC,0x4 -asm/non_matchings/code/code_8019AF00/audio_setBGM.s,audio_setBGM,0x801A400C,0x13 +asm/non_matchings/code/code_8019AF00/Audio_SetSpec.s,Audio_SetSpec,0x801A400C,0x13 asm/non_matchings/code/code_8019AF00/func_801A4058.s,func_801A4058,0x801A4058,0x5C asm/non_matchings/code/code_8019AF00/func_801A41C8.s,func_801A41C8,0x801A41C8,0xC asm/non_matchings/code/code_8019AF00/func_801A41F8.s,func_801A41F8,0x801A41F8,0x29 @@ -3509,15 +3509,15 @@ asm/non_matchings/code/code_8019AF00/func_801A4348.s,func_801A4348,0x801A4348,0x asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeExceptSystemAndOcarinaBanks.s,Audio_SetSfxVolumeExceptSystemAndOcarinaBanks,0x801A4380,0x2A asm/non_matchings/code/code_8019AF00/func_801A4428.s,func_801A4428,0x801A4428,0x1F asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s,Audio_PreNMI,0x801A44A4,0x8 -asm/non_matchings/code/code_8019AF00/func_801A44C4.s,func_801A44C4,0x801A44C4,0x4 +asm/non_matchings/code/code_8019AF00/Audio_ResetRequestedSceneSeqId.s,Audio_ResetRequestedSceneSeqId,0x801A44C4,0x4 asm/non_matchings/code/code_8019AF00/func_801A44D4.s,func_801A44D4,0x801A44D4,0x89 asm/non_matchings/code/code_8019AF00/func_801A46F8.s,func_801A46F8,0x801A46F8,0x14 asm/non_matchings/code/code_8019AF00/func_801A4748.s,func_801A4748,0x801A4748,0x15 asm/non_matchings/code/code_8019AF00/func_801A479C.s,func_801A479C,0x801A479C,0x10 -asm/non_matchings/code/code_8019AF00/func_801A47DC.s,func_801A47DC,0x801A47DC,0x41 -asm/non_matchings/code/code_8019AF00/func_801A48E0.s,func_801A48E0,0x801A48E0,0x52 -asm/non_matchings/code/code_8019AF00/func_801A4A28.s,func_801A4A28,0x801A4A28,0x56 -asm/non_matchings/code/code_8019AF00/Audio_SetNatureAmbienceRandomBend.s,Audio_SetNatureAmbienceRandomBend,0x801A4B80,0x2C +asm/non_matchings/code/code_8019AF00/Audio_SetAmbienceChannelIO.s,Audio_SetAmbienceChannelIO,0x801A47DC,0x41 +asm/non_matchings/code/code_8019AF00/Audio_StartAmbience.s,Audio_StartAmbience,0x801A48E0,0x52 +asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience.s,Audio_PlayAmbience,0x801A4A28,0x56 +asm/non_matchings/code/code_8019AF00/Audio_SetAmbienceRandomBend.s,Audio_SetAmbienceRandomBend,0x801A4B80,0x2C asm/non_matchings/code/code_8019AF00/Audio_Init.s,Audio_Init,0x801A4C30,0x9 asm/non_matchings/code/code_8019AF00/AudioSfx_Init.s,AudioSfx_Init,0x801A4C54,0x2B asm/non_matchings/code/code_8019AF00/func_801A4D00.s,func_801A4D00,0x801A4D00,0x14 @@ -3569,11 +3569,11 @@ asm/non_matchings/code/code_801A5BD0/AudioSfx_ProcessActiveSfx.s,AudioSfx_Proces asm/non_matchings/code/code_801A5BD0/AudioSfx_IsPlaying.s,AudioSfx_IsPlaying,0x801A78E4,0x1A asm/non_matchings/code/code_801A5BD0/AudioSfx_Reset.s,AudioSfx_Reset,0x801A794C,0x71 asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s,Audio_StartSequence,0x801A7B10,0x7D -asm/non_matchings/code/code_801A7B10/func_801A7D04.s,func_801A7D04,0x801A7D04,0x20 +asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s,Audio_StopSequence,0x801A7D04,0x20 asm/non_matchings/code/code_801A7B10/func_801A7D84.s,func_801A7D84,0x801A7D84,0x309 asm/non_matchings/code/code_801A7B10/Audio_QueueSeqCmd.s,Audio_QueueSeqCmd,0x801A89A8,0xA asm/non_matchings/code/code_801A7B10/func_801A89D0.s,func_801A89D0,0x801A89D0,0x20 -asm/non_matchings/code/code_801A7B10/func_801A8A50.s,func_801A8A50,0x801A8A50,0x1B +asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s,Audio_GetActiveSequence,0x801A8A50,0x1B asm/non_matchings/code/code_801A7B10/func_801A8ABC.s,func_801A8ABC,0x801A8ABC,0x16 asm/non_matchings/code/code_801A7B10/func_801A8B14.s,func_801A8B14,0x801A8B14,0x6 asm/non_matchings/code/code_801A7B10/func_801A8B2C.s,func_801A8B2C,0x801A8B2C,0x29