mirror of
https://github.com/zeldaret/tmc
synced 2026-06-09 20:50:47 -04:00
+383
-46
@@ -1,8 +1,13 @@
|
||||
#ifndef AUDIO_H
|
||||
#define AUDIO_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define NUM_BGM 99
|
||||
|
||||
typedef enum {
|
||||
SFX_NONE,
|
||||
// BGM
|
||||
BGM_CASTLE_TOURNAMENT,
|
||||
BGM_VAATI_MOTIF,
|
||||
BGM_TITLE_SCREEN,
|
||||
@@ -20,8 +25,8 @@ typedef enum {
|
||||
BGM_STORY,
|
||||
BGM_FESTIVAL_APPROACH,
|
||||
BGM_BEAT_VAATI,
|
||||
|
||||
BGM_BEANSTALK = 0x13,
|
||||
BGM_UNUSED_12,
|
||||
BGM_BEANSTALK,
|
||||
BGM_HOUSE,
|
||||
BGM_CUCCO_MINIGAME,
|
||||
BGM_SYRUP_THEME,
|
||||
@@ -62,11 +67,48 @@ typedef enum {
|
||||
BGM_LOST_WOODS,
|
||||
BGM_FAIRY_FOUNTAIN2,
|
||||
BGM_WIND_RUINS,
|
||||
|
||||
BGM_LEARN_SCROLL = 0x5E,
|
||||
BGM_UNUSED_3C,
|
||||
BGM_UNUSED_3D,
|
||||
BGM_UNUSED_3E,
|
||||
BGM_UNUSED_3F,
|
||||
BGM_UNUSED_40,
|
||||
BGM_UNUSED_41,
|
||||
BGM_UNUSED_42,
|
||||
BGM_UNUSED_43,
|
||||
BGM_UNUSED_44,
|
||||
BGM_UNUSED_45,
|
||||
BGM_UNUSED_46,
|
||||
BGM_UNUSED_47,
|
||||
BGM_UNUSED_48,
|
||||
BGM_UNUSED_49,
|
||||
BGM_UNUSED_4A,
|
||||
BGM_UNUSED_4B,
|
||||
BGM_UNUSED_4C,
|
||||
BGM_UNUSED_4D,
|
||||
BGM_UNUSED_4E,
|
||||
BGM_UNUSED_4F,
|
||||
BGM_UNUSED_50,
|
||||
BGM_UNUSED_51,
|
||||
BGM_UNUSED_52,
|
||||
BGM_UNUSED_53,
|
||||
BGM_UNUSED_54,
|
||||
BGM_UNUSED_55,
|
||||
BGM_UNUSED_56,
|
||||
BGM_UNUSED_57,
|
||||
BGM_UNUSED_58,
|
||||
BGM_UNUSED_59,
|
||||
BGM_UNUSED_5A,
|
||||
BGM_UNUSED_5B,
|
||||
BGM_UNUSED_5C,
|
||||
BGM_UNUSED_5D,
|
||||
BGM_LEARN_SCROLL,
|
||||
BGM_EZLO_GET,
|
||||
|
||||
SFX_BEEP = 0x64,
|
||||
BGM_UNUSED_60,
|
||||
BGM_UNUSED_61,
|
||||
BGM_UNUSED_62,
|
||||
BGM_UNUSED_63,
|
||||
// SFX
|
||||
SFX_BEEP,
|
||||
SFX_TEXTBOX_OPEN,
|
||||
SFX_TEXTBOX_CLOSE,
|
||||
SFX_TEXTBOX_NEXT,
|
||||
@@ -147,8 +189,30 @@ typedef enum {
|
||||
SFX_VO_MINISH2,
|
||||
SFX_VO_MINISH3,
|
||||
SFX_VO_MINISH4,
|
||||
|
||||
SFX_REM_SLEEP = 0xCC,
|
||||
SFX_B5,
|
||||
SFX_B6,
|
||||
SFX_B7,
|
||||
SFX_B8,
|
||||
SFX_B9,
|
||||
SFX_BA,
|
||||
SFX_BB,
|
||||
SFX_BC,
|
||||
SFX_BD,
|
||||
SFX_BE,
|
||||
SFX_BF,
|
||||
SFX_C0,
|
||||
SFX_C1,
|
||||
SFX_C2,
|
||||
SFX_C3,
|
||||
SFX_C4,
|
||||
SFX_C5,
|
||||
SFX_C6,
|
||||
SFX_C7,
|
||||
SFX_C8,
|
||||
SFX_C9,
|
||||
SFX_CA,
|
||||
SFX_CB,
|
||||
SFX_REM_SLEEP,
|
||||
SFX_TASK_COMPLETE,
|
||||
SFX_KEY_APPEAR,
|
||||
SFX_CF,
|
||||
@@ -178,84 +242,357 @@ typedef enum {
|
||||
SFX_WIND1,
|
||||
SFX_WIND2,
|
||||
SFX_WIND3,
|
||||
|
||||
SFX_SUMMON = 0xF4,
|
||||
SFX_EA,
|
||||
SFX_EB,
|
||||
SFX_EC,
|
||||
SFX_ED,
|
||||
SFX_EE,
|
||||
SFX_EF,
|
||||
SFX_F0,
|
||||
SFX_F1,
|
||||
SFX_F2,
|
||||
SFX_F3,
|
||||
SFX_SUMMON,
|
||||
SFX_F5,
|
||||
SFX_EVAPORATE,
|
||||
SFX_APPARATE,
|
||||
SFX_F8,
|
||||
SFX_TELEPORTER,
|
||||
|
||||
SFX_ITEM_BOMB_EXPLODE = 0xFD,
|
||||
SFX_FA,
|
||||
SFX_FB,
|
||||
SFX_FC,
|
||||
SFX_ITEM_BOMB_EXPLODE,
|
||||
SFX_HIT,
|
||||
|
||||
SFX_ITEM_SHIELD_BOUNCE = 0x118,
|
||||
SFX_FF,
|
||||
SFX_100,
|
||||
SFX_101,
|
||||
SFX_102,
|
||||
SFX_103,
|
||||
SFX_104,
|
||||
SFX_105,
|
||||
SFX_106,
|
||||
SFX_107,
|
||||
SFX_108,
|
||||
SFX_109,
|
||||
SFX_10A,
|
||||
SFX_10B,
|
||||
SFX_10C,
|
||||
SFX_10D,
|
||||
SFX_10E,
|
||||
SFX_10F,
|
||||
SFX_110,
|
||||
SFX_111,
|
||||
SFX_112,
|
||||
SFX_113,
|
||||
SFX_114,
|
||||
SFX_115,
|
||||
SFX_116,
|
||||
SFX_117,
|
||||
SFX_ITEM_SHIELD_BOUNCE,
|
||||
SFX_ITEM_GLOVES_KNOCKBACK,
|
||||
SFX_EM_ARMOS_ON,
|
||||
|
||||
SFX_EM_MOBLIN_SPEAR = 0x11E,
|
||||
SFX_11B,
|
||||
SFX_11C,
|
||||
SFX_11D,
|
||||
SFX_EM_MOBLIN_SPEAR,
|
||||
SFX_LOW_HEALTH,
|
||||
SFX_CHARGING_UP,
|
||||
SFX_STAIRS,
|
||||
|
||||
SFX_BOSS_HIT = 0x127,
|
||||
SFX_122,
|
||||
SFX_123,
|
||||
SFX_124,
|
||||
SFX_125,
|
||||
SFX_126,
|
||||
SFX_BOSS_HIT,
|
||||
SFX_BOSS_DIE,
|
||||
SFX_BOSS_EXPLODE,
|
||||
|
||||
SFX_ITEM_LANTERN_ON = 0x13D,
|
||||
SFX_12A,
|
||||
SFX_12B,
|
||||
SFX_12C,
|
||||
SFX_12D,
|
||||
SFX_12E,
|
||||
SFX_12F,
|
||||
SFX_130,
|
||||
SFX_131,
|
||||
SFX_132,
|
||||
SFX_133,
|
||||
SFX_134,
|
||||
SFX_135,
|
||||
SFX_136,
|
||||
SFX_137,
|
||||
SFX_138,
|
||||
SFX_139,
|
||||
SFX_13A,
|
||||
SFX_13B,
|
||||
SFX_13C,
|
||||
SFX_ITEM_LANTERN_ON,
|
||||
SFX_ITEM_LANTERN_OFF,
|
||||
SFX_ITEM_SWORD_BEAM,
|
||||
SFX_140,
|
||||
SFX_HEART_CONTAINER_SPAWN,
|
||||
SFX_SPARKLES,
|
||||
|
||||
SFX_PLY_SHRINKING = 0x16F,
|
||||
SFX_143,
|
||||
SFX_144,
|
||||
SFX_145,
|
||||
SFX_146,
|
||||
SFX_147,
|
||||
SFX_148,
|
||||
SFX_149,
|
||||
SFX_14A,
|
||||
SFX_14B,
|
||||
SFX_14C,
|
||||
SFX_14D,
|
||||
SFX_14E,
|
||||
SFX_14F,
|
||||
SFX_150,
|
||||
SFX_151,
|
||||
SFX_152,
|
||||
SFX_153,
|
||||
SFX_154,
|
||||
SFX_155,
|
||||
SFX_156,
|
||||
SFX_157,
|
||||
SFX_158,
|
||||
SFX_159,
|
||||
SFX_15A,
|
||||
SFX_15B,
|
||||
SFX_15C,
|
||||
SFX_15D,
|
||||
SFX_15E,
|
||||
SFX_15F,
|
||||
SFX_160,
|
||||
SFX_161,
|
||||
SFX_162,
|
||||
SFX_163,
|
||||
SFX_164,
|
||||
SFX_165,
|
||||
SFX_166,
|
||||
SFX_167,
|
||||
SFX_168,
|
||||
SFX_169,
|
||||
SFX_16A,
|
||||
SFX_16B,
|
||||
SFX_16C,
|
||||
SFX_16D,
|
||||
SFX_16E,
|
||||
SFX_PLY_SHRINKING,
|
||||
SFX_PLY_GROW,
|
||||
|
||||
SFX_EZLO_UI = 0x173,
|
||||
|
||||
SFX_LAVA_TILE_STEP = 0x17B,
|
||||
SFX_171,
|
||||
SFX_172,
|
||||
SFX_EZLO_UI,
|
||||
SFX_174,
|
||||
SFX_175,
|
||||
SFX_176,
|
||||
SFX_177,
|
||||
SFX_178,
|
||||
SFX_179,
|
||||
SFX_17A,
|
||||
SFX_LAVA_TILE_STEP,
|
||||
SFX_LAVA_TILE_WOBBLE,
|
||||
SFX_LAVA_TILE_SINK,
|
||||
SFX_LAVA_TILE_FLIP,
|
||||
SFX_LAVA_TILE_LAND,
|
||||
|
||||
SFX_STAIRS_ASCEND = 0x187,
|
||||
SFX_180,
|
||||
SFX_181,
|
||||
SFX_182,
|
||||
SFX_183,
|
||||
SFX_184,
|
||||
SFX_185,
|
||||
SFX_186,
|
||||
SFX_STAIRS_ASCEND,
|
||||
SFX_STAIRS_DESCEND,
|
||||
|
||||
SFX_ICE_BLOCK_SLIDE = 0x1B1,
|
||||
SFX_189,
|
||||
SFX_18A,
|
||||
SFX_18B,
|
||||
SFX_18C,
|
||||
SFX_18D,
|
||||
SFX_18E,
|
||||
SFX_18F,
|
||||
SFX_190,
|
||||
SFX_191,
|
||||
SFX_192,
|
||||
SFX_193,
|
||||
SFX_194,
|
||||
SFX_195,
|
||||
SFX_196,
|
||||
SFX_197,
|
||||
SFX_198,
|
||||
SFX_199,
|
||||
SFX_19A,
|
||||
SFX_19B,
|
||||
SFX_19C,
|
||||
SFX_19D,
|
||||
SFX_19E,
|
||||
SFX_19F,
|
||||
SFX_1A0,
|
||||
SFX_1A1,
|
||||
SFX_1A2,
|
||||
SFX_1A3,
|
||||
SFX_1A4,
|
||||
SFX_1A5,
|
||||
SFX_1A6,
|
||||
SFX_1A7,
|
||||
SFX_1A8,
|
||||
SFX_1A9,
|
||||
SFX_1AA,
|
||||
SFX_1AB,
|
||||
SFX_1AC,
|
||||
SFX_1AD,
|
||||
SFX_1AE,
|
||||
SFX_1AF,
|
||||
SFX_1B0,
|
||||
SFX_ICE_BLOCK_SLIDE,
|
||||
SFX_ICE_BLOCK_STOP,
|
||||
SFX_ICE_BLOCK_MELT,
|
||||
|
||||
SFX_VO_GORON1 = 0x1B7,
|
||||
SFX_1B4,
|
||||
SFX_1B5,
|
||||
SFX_1B6,
|
||||
SFX_VO_GORON1,
|
||||
SFX_VO_GORON2,
|
||||
SFX_VO_GORON3,
|
||||
SFX_VO_GORON4,
|
||||
SFX_EM_DEKUSCRUB_HIT,
|
||||
|
||||
SFX_ELEMENT_PLACE = 0x1CD,
|
||||
SFX_1BC,
|
||||
SFX_1BD,
|
||||
SFX_1BE,
|
||||
SFX_1BF,
|
||||
SFX_1C0,
|
||||
SFX_1C1,
|
||||
SFX_1C2,
|
||||
SFX_1C3,
|
||||
SFX_1C4,
|
||||
SFX_1C5,
|
||||
SFX_1C6,
|
||||
SFX_1C7,
|
||||
SFX_1C8,
|
||||
SFX_1C9,
|
||||
SFX_1CA,
|
||||
SFX_1CB,
|
||||
SFX_1CC,
|
||||
SFX_ELEMENT_PLACE,
|
||||
SFX_ELEMENT_FLOAT,
|
||||
SFX_ELEMENT_CHARGE,
|
||||
SFX_1D0,
|
||||
SFX_ELEMENT_INFUSE,
|
||||
|
||||
SFX_VO_CUCCO1 = 0x1D6,
|
||||
SFX_1D2,
|
||||
SFX_1D3,
|
||||
SFX_1D4,
|
||||
SFX_1D5,
|
||||
SFX_VO_CUCCO1,
|
||||
SFX_VO_CUCCO2,
|
||||
SFX_VO_CUCCO3,
|
||||
SFX_VO_CUCCO4,
|
||||
SFX_VO_CUCCO5,
|
||||
|
||||
SND_STOP_ALL = 0x80010000,
|
||||
SONG_VOL_ZERO = 0x80020000,
|
||||
SND_VOL_RESET_ALL = 0x80030000,
|
||||
SND_VSYNC_OFF = 0x80040000,
|
||||
SFX_1DB,
|
||||
SFX_1DC,
|
||||
SFX_1DD,
|
||||
SFX_1DE,
|
||||
SFX_1DF,
|
||||
SFX_1E0,
|
||||
SFX_1E1,
|
||||
SFX_1E2,
|
||||
SFX_1E3,
|
||||
SFX_1E4,
|
||||
SFX_1E5,
|
||||
SFX_1E6,
|
||||
SFX_1E7,
|
||||
SFX_1E8,
|
||||
SFX_1E9,
|
||||
SFX_1EA,
|
||||
SFX_1EB,
|
||||
SFX_1EC,
|
||||
SFX_1ED,
|
||||
SFX_1EE,
|
||||
SFX_1EF,
|
||||
SFX_1F0,
|
||||
SFX_1F1,
|
||||
SFX_1F2,
|
||||
SFX_1F3,
|
||||
SFX_1F4,
|
||||
SFX_1F5,
|
||||
SFX_1F6,
|
||||
SFX_1F7,
|
||||
SFX_1F8,
|
||||
SFX_1F9,
|
||||
SFX_1FA,
|
||||
SFX_1FB,
|
||||
SFX_1FC,
|
||||
SFX_1FD,
|
||||
SFX_1FE,
|
||||
SFX_1FF,
|
||||
SFX_200,
|
||||
SFX_201,
|
||||
SFX_202,
|
||||
SFX_203,
|
||||
SFX_204,
|
||||
SFX_205,
|
||||
SFX_206,
|
||||
SFX_207,
|
||||
SFX_208,
|
||||
SFX_209,
|
||||
SFX_20A,
|
||||
SFX_20B,
|
||||
SFX_20C,
|
||||
SFX_20D,
|
||||
SFX_20E,
|
||||
SFX_20F,
|
||||
SFX_210,
|
||||
SFX_211,
|
||||
SFX_212,
|
||||
SFX_213,
|
||||
SFX_214,
|
||||
SFX_215,
|
||||
SFX_216,
|
||||
SFX_217,
|
||||
SFX_218,
|
||||
SFX_219,
|
||||
SFX_21A,
|
||||
SFX_21B,
|
||||
SFX_21C,
|
||||
SFX_21D,
|
||||
SFX_21E,
|
||||
SFX_21F,
|
||||
SFX_220,
|
||||
SFX_221,
|
||||
// special functions
|
||||
SONG_STOP_ALL = 0x80010000,
|
||||
SONG_MUTE = 0x80020000,
|
||||
SONG_PLAY_VOL_RESET_ALL = 0x80030000,
|
||||
SONG_VSYNC_OFF = 0x80040000,
|
||||
SONG_STOP = 0x80050000,
|
||||
SND_VSYNC_ON = 0x80060000,
|
||||
SONG_VSYNC_ON = 0x80060000,
|
||||
SONG_CONTINUE = 0x80070000,
|
||||
SONG_VOL_FADE_OUT = 0x80080000,
|
||||
SONG_VOL_RESET = 0x800B0000,
|
||||
SONG_VOL_CHAN1_SILENT = 0x800D0000,
|
||||
SONG_VOL_CHAN1_RESET = 0x800E0000,
|
||||
SONG_RESET_UNK = 0x80100000,
|
||||
SONG_FADE_IN = 0x80090000,
|
||||
SONG_FADE_IN_CONTINUE = 0x800A0000,
|
||||
SONG_PLAY_VOL_RESET = 0x800B0000,
|
||||
SONG_PLAY_TEMPO_CONTROL = 0x800C0000,
|
||||
SONG_FADE_OUT_BGM = 0x800D0000,
|
||||
SONG_FADE_IN_BGM = 0x800E0000,
|
||||
SONG_INIT = 0x800F0000,
|
||||
SONG_STOP_BGM = 0x80100000,
|
||||
SONG_BGM_0 = 0x80110000,
|
||||
} Sound;
|
||||
|
||||
typedef struct SoundPlayingInfo {
|
||||
u16 unk_00;
|
||||
bool8 stopBgm;
|
||||
// u8 unk_03;
|
||||
u16 unk_04;
|
||||
s16 volumeMasterUnk;
|
||||
s16 volumeMaster;
|
||||
s16 volumeMasterTarget;
|
||||
s16 volumeBgmUnk;
|
||||
s16 volumeBgm;
|
||||
s16 volumeBgmTarget;
|
||||
s16 volumeSfx;
|
||||
u16 currentBgm;
|
||||
} SoundPlayingInfo;
|
||||
|
||||
extern SoundPlayingInfo gSoundPlayingInfo;
|
||||
|
||||
void InitSound(void);
|
||||
void SoundReq(Sound sound);
|
||||
void SoundLoop(void);
|
||||
|
||||
#endif // AUDIO_H
|
||||
|
||||
+1
-2
@@ -11,7 +11,6 @@
|
||||
#include "structures.h"
|
||||
|
||||
// Identified - to be sorted into header files
|
||||
extern void SoundReq(u32);
|
||||
extern void ShowNPCDialogue(Entity*, Dialog*);
|
||||
extern void DoFade(u32, u32);
|
||||
extern u32 CheckKinstoneFused(u32);
|
||||
@@ -143,7 +142,7 @@ extern void sub_080AF2E4(void);
|
||||
extern void sub_0804F578(void);
|
||||
extern void sub_08059994(void);
|
||||
extern s32 sub_0801CFA8(u32);
|
||||
extern void sub_080A3210(void);
|
||||
extern void InitSoundPlayingInfo(void);
|
||||
extern void sub_080ADA14(u32, u32); // trampoline to sub_080B27F4
|
||||
extern void sub_0801E1B8(u32, u32);
|
||||
extern void sub_0801E1EC(s32, s32, s32);
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
#ifndef GUARD_M4A_INTERNAL_H
|
||||
#define GUARD_M4A_INTERNAL_H
|
||||
|
||||
#include "global.h"
|
||||
|
||||
typedef struct MusicPlayerTrack MusicPlayerTrack;
|
||||
typedef struct MusicPlayerInfo MusicPlayerInfo;
|
||||
|
||||
typedef struct WaveData {
|
||||
u16 type;
|
||||
u16 status;
|
||||
u32 freq;
|
||||
u32 loopStart;
|
||||
u32 size; // number of samples
|
||||
s8 data[1]; // samples
|
||||
} WaveData;
|
||||
|
||||
#define TONEDATA_TYPE_CGB 0x07
|
||||
#define TONEDATA_TYPE_FIX 0x08
|
||||
#define TONEDATA_TYPE_SPL 0x40 // key split
|
||||
#define TONEDATA_TYPE_RHY 0x80 // rhythm
|
||||
|
||||
#define TONEDATA_P_S_PAN 0xc0
|
||||
#define TONEDATA_P_S_PAM TONEDATA_P_S_PAN
|
||||
|
||||
typedef struct ToneData {
|
||||
u8 type;
|
||||
u8 key;
|
||||
u8 length; // sound length (compatible sound)
|
||||
u8 pan_sweep; // pan or sweep (compatible sound ch. 1)
|
||||
WaveData* wav;
|
||||
u8 attack;
|
||||
u8 decay;
|
||||
u8 sustain;
|
||||
u8 release;
|
||||
} ToneData;
|
||||
|
||||
typedef struct SongHeader {
|
||||
u8 trackCount;
|
||||
u8 blockCount;
|
||||
u8 priority;
|
||||
u8 reverb;
|
||||
ToneData* tone;
|
||||
u8* part[1];
|
||||
} SongHeader;
|
||||
|
||||
typedef struct Song {
|
||||
const SongHeader* header;
|
||||
u16 musicPlayerIndex;
|
||||
u16 me;
|
||||
} Song;
|
||||
|
||||
typedef struct SoundChannel {
|
||||
u8 statusFlags;
|
||||
u8 type;
|
||||
u8 rightVolume;
|
||||
u8 leftVolume;
|
||||
u8 attack;
|
||||
u8 decay;
|
||||
u8 sustain;
|
||||
u8 release;
|
||||
u8 key;
|
||||
u8 envelopeVolume;
|
||||
u8 envelopeVolumeRight;
|
||||
u8 envelopeVolumeLeft;
|
||||
u8 echoVolume;
|
||||
u8 echoLength;
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 gateTime;
|
||||
u8 midiKey;
|
||||
u8 velocity;
|
||||
u8 priority;
|
||||
u8 rhythmPan;
|
||||
u8 unk2[3];
|
||||
u32 count;
|
||||
u32 fw;
|
||||
u32 frequency;
|
||||
WaveData* wav;
|
||||
u32 currentPointer;
|
||||
MusicPlayerTrack* track;
|
||||
u32 prev;
|
||||
u32 next;
|
||||
u32 unk3;
|
||||
u16 xpi;
|
||||
u16 xpc;
|
||||
} SoundChannel;
|
||||
|
||||
typedef void (*MPlayMainFunc)(MusicPlayerInfo*);
|
||||
|
||||
// typedef above
|
||||
struct MusicPlayerInfo {
|
||||
const SongHeader* songHeader;
|
||||
u32 status;
|
||||
u8 trackCount;
|
||||
u8 priority;
|
||||
u8 cmd;
|
||||
u8 unk_B;
|
||||
u32 clock;
|
||||
u8 gap[8];
|
||||
u8* memAccArea;
|
||||
u16 tempoD;
|
||||
u16 tempoU;
|
||||
u16 tempoI;
|
||||
u16 tempoC;
|
||||
u16 fadeOI;
|
||||
u16 fadeOC;
|
||||
u16 fadeOV;
|
||||
MusicPlayerTrack* tracks;
|
||||
ToneData* tone;
|
||||
u32 ident;
|
||||
MPlayMainFunc func;
|
||||
u32* intp;
|
||||
};
|
||||
|
||||
#define MPT_FLG_VOLSET 0x01
|
||||
#define MPT_FLG_VOLCHG 0x03
|
||||
#define MPT_FLG_PITSET 0x04
|
||||
#define MPT_FLG_PITCHG 0x0C
|
||||
#define MPT_FLG_START 0x40
|
||||
#define MPT_FLG_EXIST 0x80
|
||||
|
||||
// typedef above
|
||||
struct MusicPlayerTrack {
|
||||
u8 flags;
|
||||
u8 wait;
|
||||
u8 patternLevel;
|
||||
u8 repN;
|
||||
u8 gateTime;
|
||||
u8 key;
|
||||
u8 velocity;
|
||||
u8 runningStatus;
|
||||
u8 keyM;
|
||||
u8 pitM;
|
||||
s8 keyShift;
|
||||
s8 keyShiftX;
|
||||
s8 tune;
|
||||
u8 pitX;
|
||||
s8 bend;
|
||||
u8 bendRange;
|
||||
u8 volMR;
|
||||
u8 volML;
|
||||
u8 vol;
|
||||
u8 volX;
|
||||
s8 pan;
|
||||
s8 panX;
|
||||
s8 modM;
|
||||
u8 mod;
|
||||
u8 modT;
|
||||
u8 lfoSpeed;
|
||||
u8 lfoSpeedC;
|
||||
u8 lfoDelay;
|
||||
u8 lfoDelayC;
|
||||
u8 priority;
|
||||
u8 echoVolume;
|
||||
u8 echoLength;
|
||||
SoundChannel* chan;
|
||||
ToneData tone;
|
||||
u8 gap[10];
|
||||
u16 unk_3A;
|
||||
u32 unk_3C;
|
||||
u8* cmdPtr;
|
||||
u8* patternStack[3];
|
||||
};
|
||||
|
||||
typedef struct MusicPlayer {
|
||||
MusicPlayerInfo* info;
|
||||
MusicPlayerTrack* tracks;
|
||||
u8 nTracks;
|
||||
u16 unk_A;
|
||||
} MusicPlayer;
|
||||
|
||||
extern const MusicPlayer gMusicPlayers[];
|
||||
extern const Song gSongTable[];
|
||||
|
||||
void m4aSoundInit(void);
|
||||
void m4aSongNumStart(u16 n);
|
||||
void m4aSongNumStartOrContinue(u16 n);
|
||||
void m4aSongNumStop(u16 n);
|
||||
void m4aMPlayAllStop(void);
|
||||
void m4aMPlayImmInit(MusicPlayerInfo* mplayInfo);
|
||||
void m4aMPlayTempoControl(MusicPlayerInfo* mplayInfo, u16 tempo);
|
||||
void m4aMPlayVolumeControl(MusicPlayerInfo* mplayInfo, u16 trackBits, u16 volume);
|
||||
void m4aSoundVSyncOn(void);
|
||||
void m4aSoundVSyncOff(void);
|
||||
|
||||
#endif // GUARD_M4A_INTERNAL_H
|
||||
@@ -1,397 +0,0 @@
|
||||
#ifndef GUARD_M4A_INTERNAL_H
|
||||
#define GUARD_M4A_INTERNAL_H
|
||||
|
||||
#include "gba/gba.h"
|
||||
|
||||
// ASCII encoding of 'Smsh' in reverse
|
||||
// This is presumably short for SMASH, the developer of MKS4AGB.
|
||||
#define ID_NUMBER 0x68736D53
|
||||
|
||||
#define C_V 0x40 // center value for PAN, BEND, and TUNE
|
||||
|
||||
#define SOUND_MODE_REVERB_VAL 0x0000007F
|
||||
#define SOUND_MODE_REVERB_SET 0x00000080
|
||||
#define SOUND_MODE_MAXCHN 0x00000F00
|
||||
#define SOUND_MODE_MAXCHN_SHIFT 8
|
||||
#define SOUND_MODE_MASVOL 0x0000F000
|
||||
#define SOUND_MODE_MASVOL_SHIFT 12
|
||||
#define SOUND_MODE_FREQ_05734 0x00010000
|
||||
#define SOUND_MODE_FREQ_07884 0x00020000
|
||||
#define SOUND_MODE_FREQ_10512 0x00030000
|
||||
#define SOUND_MODE_FREQ_13379 0x00040000
|
||||
#define SOUND_MODE_FREQ_15768 0x00050000
|
||||
#define SOUND_MODE_FREQ_18157 0x00060000
|
||||
#define SOUND_MODE_FREQ_21024 0x00070000
|
||||
#define SOUND_MODE_FREQ_26758 0x00080000
|
||||
#define SOUND_MODE_FREQ_31536 0x00090000
|
||||
#define SOUND_MODE_FREQ_36314 0x000A0000
|
||||
#define SOUND_MODE_FREQ_40137 0x000B0000
|
||||
#define SOUND_MODE_FREQ_42048 0x000C0000
|
||||
#define SOUND_MODE_FREQ 0x000F0000
|
||||
#define SOUND_MODE_FREQ_SHIFT 16
|
||||
#define SOUND_MODE_DA_BIT_9 0x00800000
|
||||
#define SOUND_MODE_DA_BIT_8 0x00900000
|
||||
#define SOUND_MODE_DA_BIT_7 0x00A00000
|
||||
#define SOUND_MODE_DA_BIT_6 0x00B00000
|
||||
#define SOUND_MODE_DA_BIT 0x00B00000
|
||||
#define SOUND_MODE_DA_BIT_SHIFT 20
|
||||
|
||||
struct WaveData {
|
||||
u16 type;
|
||||
u16 status;
|
||||
u32 freq;
|
||||
u32 loopStart;
|
||||
u32 size; // number of samples
|
||||
s8 data[1]; // samples
|
||||
};
|
||||
|
||||
#define TONEDATA_TYPE_CGB 0x07
|
||||
#define TONEDATA_TYPE_FIX 0x08
|
||||
#define TONEDATA_TYPE_SPL 0x40 // key split
|
||||
#define TONEDATA_TYPE_RHY 0x80 // rhythm
|
||||
|
||||
#define TONEDATA_P_S_PAN 0xc0
|
||||
#define TONEDATA_P_S_PAM TONEDATA_P_S_PAN
|
||||
|
||||
struct ToneData {
|
||||
u8 type;
|
||||
u8 key;
|
||||
u8 length; // sound length (compatible sound)
|
||||
u8 pan_sweep; // pan or sweep (compatible sound ch. 1)
|
||||
struct WaveData* wav;
|
||||
u8 attack;
|
||||
u8 decay;
|
||||
u8 sustain;
|
||||
u8 release;
|
||||
};
|
||||
|
||||
struct CgbChannel {
|
||||
u8 sf;
|
||||
u8 ty;
|
||||
u8 rightVolume;
|
||||
u8 leftVolume;
|
||||
u8 at;
|
||||
u8 de;
|
||||
u8 su;
|
||||
u8 re;
|
||||
u8 ky;
|
||||
u8 ev;
|
||||
u8 eg;
|
||||
u8 ec;
|
||||
u8 echoVolume;
|
||||
u8 echoLength;
|
||||
u8 d1;
|
||||
u8 d2;
|
||||
u8 gt;
|
||||
u8 mk;
|
||||
u8 ve;
|
||||
u8 pr;
|
||||
u8 rp;
|
||||
u8 d3[3];
|
||||
u8 d5;
|
||||
u8 sg;
|
||||
u8 n4;
|
||||
u8 pan;
|
||||
u8 panMask;
|
||||
u8 mo;
|
||||
u8 le;
|
||||
u8 sw;
|
||||
u32 fr;
|
||||
u32* wp;
|
||||
u32 cp;
|
||||
u32 tp;
|
||||
u32 pp;
|
||||
u32 np;
|
||||
u8 d4[8];
|
||||
};
|
||||
|
||||
struct MusicPlayerTrack;
|
||||
|
||||
struct SoundChannel {
|
||||
u8 status;
|
||||
u8 type;
|
||||
u8 rightVolume;
|
||||
u8 leftVolume;
|
||||
u8 attack;
|
||||
u8 decay;
|
||||
u8 sustain;
|
||||
u8 release;
|
||||
u8 ky;
|
||||
u8 ev;
|
||||
u8 er;
|
||||
u8 el;
|
||||
u8 echoVolume;
|
||||
u8 echoLength;
|
||||
u8 d1;
|
||||
u8 d2;
|
||||
u8 gt;
|
||||
u8 mk;
|
||||
u8 ve;
|
||||
u8 pr;
|
||||
u8 rp;
|
||||
u8 d3[3];
|
||||
u32 ct;
|
||||
u32 fw;
|
||||
u32 freq;
|
||||
struct WaveData* wav;
|
||||
u32 cp;
|
||||
struct MusicPlayerTrack* track;
|
||||
u32 pp;
|
||||
u32 np;
|
||||
u32 d4;
|
||||
u16 xpi;
|
||||
u16 xpc;
|
||||
};
|
||||
|
||||
#define MAX_DIRECTSOUND_CHANNELS 12
|
||||
|
||||
#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer
|
||||
|
||||
struct SoundInfo {
|
||||
// This field is normally equal to ID_NUMBER but it is set to other
|
||||
// values during sensitive operations for locking purposes.
|
||||
// This field should be volatile but isn't. This could potentially cause
|
||||
// race conditions.
|
||||
u32 ident;
|
||||
|
||||
vu8 pcmDmaCounter;
|
||||
|
||||
// Direct Sound
|
||||
u8 reverb;
|
||||
u8 maxChans;
|
||||
u8 masterVolume;
|
||||
u8 freq;
|
||||
|
||||
u8 mode;
|
||||
u8 c15;
|
||||
u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
|
||||
u8 maxLines;
|
||||
u8 gap[3];
|
||||
s32 pcmSamplesPerVBlank;
|
||||
s32 pcmFreq;
|
||||
s32 divFreq;
|
||||
struct CgbChannel* cgbChans;
|
||||
u32 func;
|
||||
u32 intp;
|
||||
void (*CgbSound)(void);
|
||||
void (*CgbOscOff)(u8);
|
||||
u32 (*MidiKeyToCgbFreq)(u8, u8, u8);
|
||||
u32 MPlayJumpTable;
|
||||
void* plynote;
|
||||
void (*ExtVolPit)(void);
|
||||
u8 gap2[16];
|
||||
struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
|
||||
s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
|
||||
};
|
||||
|
||||
struct SongHeader {
|
||||
u8 trackCount;
|
||||
u8 blockCount;
|
||||
u8 priority;
|
||||
u8 reverb;
|
||||
struct ToneData* tone;
|
||||
u8* part[1];
|
||||
};
|
||||
|
||||
#define MPT_FLG_VOLSET 0x01
|
||||
#define MPT_FLG_VOLCHG 0x03
|
||||
#define MPT_FLG_PITSET 0x04
|
||||
#define MPT_FLG_PITCHG 0x0C
|
||||
#define MPT_FLG_START 0x40
|
||||
#define MPT_FLG_EXIST 0x80
|
||||
|
||||
struct MusicPlayerTrack {
|
||||
u8 flags;
|
||||
u8 wait;
|
||||
u8 patternLevel;
|
||||
u8 repN;
|
||||
u8 gateTime;
|
||||
u8 key;
|
||||
u8 velocity;
|
||||
u8 runningStatus;
|
||||
u8 keyM;
|
||||
u8 pitM;
|
||||
s8 keyShift;
|
||||
s8 keyShiftX;
|
||||
s8 tune;
|
||||
u8 pitX;
|
||||
s8 bend;
|
||||
u8 bendRange;
|
||||
u8 volMR;
|
||||
u8 volML;
|
||||
u8 vol;
|
||||
u8 volX;
|
||||
s8 pan;
|
||||
s8 panX;
|
||||
s8 modM;
|
||||
u8 mod;
|
||||
u8 modT;
|
||||
u8 lfoSpeed;
|
||||
u8 lfoSpeedC;
|
||||
u8 lfoDelay;
|
||||
u8 lfoDelayC;
|
||||
u8 priority;
|
||||
u8 echoVolume;
|
||||
u8 echoLength;
|
||||
struct SoundChannel* chan;
|
||||
struct ToneData tone;
|
||||
u8 gap[10];
|
||||
u16 unk_3A;
|
||||
u32 unk_3C;
|
||||
u8* cmdPtr;
|
||||
u8* patternStack[3];
|
||||
};
|
||||
|
||||
#define MUSICPLAYER_STATUS_TRACK 0x0000ffff
|
||||
#define MUSICPLAYER_STATUS_PAUSE 0x80000000
|
||||
|
||||
#define MAX_MUSICPLAYER_TRACKS 16
|
||||
|
||||
#define TEMPORARY_FADE 0x0001
|
||||
#define FADE_IN 0x0002
|
||||
#define FADE_VOL_MAX 64
|
||||
#define FADE_VOL_SHIFT 2
|
||||
|
||||
struct MusicPlayerInfo {
|
||||
struct SongHeader* songHeader;
|
||||
u32 status;
|
||||
u8 trackCount;
|
||||
u8 priority;
|
||||
u8 cmd;
|
||||
u8 unk_B;
|
||||
u32 clock;
|
||||
u8 gap[8];
|
||||
u8* memAccArea;
|
||||
u16 tempoD;
|
||||
u16 tempoU;
|
||||
u16 tempoI;
|
||||
u16 tempoC;
|
||||
u16 fadeOI;
|
||||
u16 fadeOC;
|
||||
u16 fadeOV;
|
||||
struct MusicPlayerTrack* tracks;
|
||||
struct ToneData* tone;
|
||||
u32 ident;
|
||||
u32 func;
|
||||
u32 intp;
|
||||
};
|
||||
|
||||
struct MusicPlayer {
|
||||
struct MusicPlayerInfo* info;
|
||||
struct MusicPlayerTrack* track;
|
||||
u8 unk_8;
|
||||
u16 unk_A;
|
||||
};
|
||||
|
||||
struct Song {
|
||||
struct SongHeader* header;
|
||||
u16 ms;
|
||||
u16 me;
|
||||
};
|
||||
|
||||
extern const struct MusicPlayer gMPlayTable[];
|
||||
extern const struct Song gSongTable[];
|
||||
|
||||
extern u8 gMPlayMemAccArea[];
|
||||
|
||||
#define MAX_POKEMON_CRIES 2
|
||||
|
||||
extern char SoundMainRAM[];
|
||||
|
||||
extern void* gMPlayJumpTable[];
|
||||
|
||||
typedef void (*XcmdFunc)(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
extern const XcmdFunc gXcmdTable[];
|
||||
|
||||
extern struct CgbChannel gCgbChans[];
|
||||
extern const u8 gCgb3Vol[];
|
||||
|
||||
extern const u8 gScaleTable[];
|
||||
extern const u32 gFreqTable[];
|
||||
extern const u16 gPcmSamplesPerVBlankTable[];
|
||||
|
||||
extern const u8 gCgbScaleTable[];
|
||||
extern const s16 gCgbFreqTable[];
|
||||
extern const u8 gNoiseTable[];
|
||||
|
||||
extern char gNumMusicPlayers[];
|
||||
extern char gMaxLines[];
|
||||
|
||||
#define NUM_MUSIC_PLAYERS ((u16)gNumMusicPlayers)
|
||||
#define MAX_LINES ((u32)gMaxLines)
|
||||
|
||||
u32 umul3232H32(u32 multiplier, u32 multiplicand);
|
||||
void SoundMain(void);
|
||||
void SoundMainBTM(void);
|
||||
void TrackStop(struct MusicPlayerInfo* mplayInfo, struct MusicPlayerTrack* track);
|
||||
void MPlayMain(void);
|
||||
void RealClearChain(void* x);
|
||||
|
||||
void MPlayContinue(struct MusicPlayerInfo* mplayInfo);
|
||||
void MPlayStart(struct MusicPlayerInfo* mplayInfo, struct SongHeader* songHeader);
|
||||
void MPlayStop(struct MusicPlayerInfo* mplayInfo);
|
||||
void FadeOutBody(struct MusicPlayerInfo* mplayInfo);
|
||||
void TrkVolPitSet(struct MusicPlayerInfo* mplayInfo, struct MusicPlayerTrack* track);
|
||||
void MPlayFadeOut(struct MusicPlayerInfo* mplayInfo, u16 speed);
|
||||
void ClearChain(void* x);
|
||||
void Clear64byte(void* addr);
|
||||
void SoundInit(struct SoundInfo* soundInfo);
|
||||
void MPlayExtender(struct CgbChannel* cgbChans);
|
||||
void m4aSoundMode(u32 mode);
|
||||
void MPlayOpen(struct MusicPlayerInfo* mplayInfo, struct MusicPlayerTrack* track, u8 a3);
|
||||
void CgbSound(void);
|
||||
void CgbOscOff(u8);
|
||||
u32 MidiKeyToCgbFreq(u8, u8, u8);
|
||||
void nullsub_141(void);
|
||||
void MPlayJumpTableCopy(void** mplayJumpTable);
|
||||
void SampleFreqSet(u32 freq);
|
||||
void m4aSoundVSyncOn(void);
|
||||
void m4aSoundVSyncOff(void);
|
||||
|
||||
void m4aMPlayTempoControl(struct MusicPlayerInfo* mplayInfo, u16 tempo);
|
||||
void m4aMPlayVolumeControl(struct MusicPlayerInfo* mplayInfo, u16 trackBits, u16 volume);
|
||||
void m4aMPlayPitchControl(struct MusicPlayerInfo* mplayInfo, u16 trackBits, s16 pitch);
|
||||
void m4aMPlayPanpotControl(struct MusicPlayerInfo* mplayInfo, u16 trackBits, s8 pan);
|
||||
void ClearModM(struct MusicPlayerTrack* track);
|
||||
void m4aMPlayModDepthSet(struct MusicPlayerInfo* mplayInfo, u16 trackBits, u8 modDepth);
|
||||
void m4aMPlayLFOSpeedSet(struct MusicPlayerInfo* mplayInfo, u16 trackBits, u8 lfoSpeed);
|
||||
|
||||
// sound command handler functions
|
||||
void ply_fine(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_goto(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_patt(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_pend(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_rept(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_memacc(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_prio(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_tempo(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_keysh(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_voice(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_vol(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_pan(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_bend(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_bendr(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_lfos(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_lfodl(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_mod(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_modt(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_tune(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_port(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xcmd(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_endtie(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_note(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
|
||||
// extended sound command handler functions
|
||||
void ply_xxx(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xwave(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xtype(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xatta(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xdeca(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xsust(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xrele(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xiecv(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xiecl(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xleng(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
void ply_xswee(struct MusicPlayerInfo*, struct MusicPlayerTrack*);
|
||||
|
||||
#endif // GUARD_M4A_INTERNAL_H
|
||||
@@ -79,7 +79,6 @@ extern UI gUnk_02032EC0;
|
||||
|
||||
void InitScreen(u32 screen);
|
||||
|
||||
extern void InitSound(void);
|
||||
extern void sub_08056208(void);
|
||||
extern void sub_0804FFE4(void);
|
||||
extern void sub_080ADD30(void);
|
||||
@@ -89,7 +88,6 @@ extern void sub_08056260(void);
|
||||
extern void VBlankIntrWait();
|
||||
extern void MessageUpdate(void);
|
||||
extern void sub_08050154(void);
|
||||
extern void sub_080A3480(void);
|
||||
|
||||
extern u8 gUnk_03003DE4;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user