mirror of https://github.com/pmret/papermario.git
audio naming done (#1236)
This commit is contained in:
parent
2becd2b5a4
commit
bb936b7fd7
|
@ -14,6 +14,7 @@ typedef ApiStatus(*ApiFunc)(struct Evt*, s32);
|
|||
typedef Bytecode EvtScript[];
|
||||
|
||||
typedef void NoArgCallback(void*);
|
||||
typedef void (*AuCallback)(void);
|
||||
|
||||
#define MSG_PTR u8*
|
||||
#define IMG_PTR u8*
|
||||
|
@ -626,28 +627,28 @@ typedef struct Worker {
|
|||
|
||||
typedef Worker* WorkerList[MAX_WORKERS];
|
||||
|
||||
typedef struct MusicSettings {
|
||||
typedef struct MusicControlData {
|
||||
/* 0x00 */ u16 flags;
|
||||
/* 0x02 */ s16 state;
|
||||
/* 0x04 */ s32 fadeOutTime;
|
||||
/* 0x08 */ s32 fadeInTime;
|
||||
/* 0x0C */ s16 fadeStartVolume;
|
||||
/* 0x0E */ s16 fadeEndVolume;
|
||||
/* 0x10 */ s32 songID;
|
||||
/* 0x10 */ s32 requestedSongID;
|
||||
/* 0x14 */ s32 variation;
|
||||
/* 0x18 */ s32 songName;
|
||||
/* 0x18 */ s32 songName; /// name or handle of currently playing song
|
||||
/* 0x1C */ s32 battleSongID;
|
||||
/* 0x20 */ s32 battleVariation;
|
||||
/* 0x24 */ s32 savedSongID;
|
||||
/* 0x28 */ s32 savedVariation;
|
||||
/* 0x2C */ s32 savedSongName;
|
||||
} MusicSettings; // size = 0x30
|
||||
} MusicControlData; // size = 0x30
|
||||
|
||||
typedef struct MusicProximityTrigger {
|
||||
/* 0x00 */ VecXZf pos;
|
||||
/* 0x08 */ f32 innerDist;
|
||||
/* 0x0C */ f32 outerDist;
|
||||
/* 0x10 */ s32 unk;
|
||||
/* 0x10 */ s32 mix; /// which branch value to switch to
|
||||
/* 0x14 */ s32 manualActivationFlag;
|
||||
} MusicProximityTrigger; // size = 0x18
|
||||
|
||||
|
@ -2437,17 +2438,6 @@ typedef struct ImgFXWorkingTexture {
|
|||
/* 0x24 */ u8 alphaMultiplier;
|
||||
} ImgFXWorkingTexture; // size = 0x25
|
||||
|
||||
typedef struct SongUpdateEvent {
|
||||
/* 0x00 */ s32 songName;
|
||||
/* 0x04 */ s32 duration;
|
||||
/* 0x08 */ s32 startVolume;
|
||||
/* 0x0C */ s32 finalVolume;
|
||||
/* 0x10 */ s32 variation;
|
||||
/* 0x14 */ s32 unk14;
|
||||
/* 0x18 */ s32 unk18;
|
||||
/* 0x1C */ s32 unk1C; // may be fake
|
||||
} SongUpdateEvent; // size = 0x1C or 0x20
|
||||
|
||||
// unfortunately, cant use bitfield for this
|
||||
// format: ABCC00DD
|
||||
// A = playerID
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
#define dma_copy dead_dma_copy
|
||||
#define create_worker_scene dead_create_worker_scene
|
||||
#define GetEntryID dead_GetEntryID
|
||||
#define SetMusicTrack dead_SetMusicTrack
|
||||
#define SetMusic dead_SetMusic
|
||||
#define FadeInMusic dead_FadeInMusic
|
||||
#define RandInt dead_RandInt
|
||||
#define PlayEffect_impl dead_PlayEffect_impl
|
||||
|
@ -309,7 +309,7 @@
|
|||
#define SetTexPanner dead_SetTexPanner
|
||||
#define DismissEffect dead_DismissEffect
|
||||
#define Entity_Chest dead_Entity_Chest
|
||||
#define snd_ambient_mute dead_snd_ambient_mute
|
||||
#define snd_ambient_fade_out dead_snd_ambient_fade_out
|
||||
#define GetPlayerAnimation dead_GetPlayerAnimation
|
||||
#define SetPlayerSpeed dead_SetPlayerSpeed
|
||||
#define SetItemPos dead_SetItemPos
|
||||
|
|
|
@ -533,14 +533,17 @@ enum SoundIDBits {
|
|||
SOUND_ID_SECTION_MASK = 0x00000300, // corresponds to sections 0-3 for indices < 0xC0 and 4-7 for those above
|
||||
SOUND_ID_INDEX_MASK = 0x000000FF,
|
||||
SOUND_ID_UNK_INDEX_MASK = 0x000001FF, // indices for the special large section
|
||||
|
||||
SOUND_ID_UPPER_MASK = 0x03FF0000,
|
||||
SOUND_ID_TYPE_MASK = 0x70000000,
|
||||
SOUND_ID_TYPE_FLAG = 0x80000000,
|
||||
};
|
||||
|
||||
enum SoundType {
|
||||
SOUND_TYPE_SPECIAL = 0x80000000,
|
||||
SOUND_TYPE_LOOPING = 0, // 0x80000000 (with SOUND_TYPE_SPECIAL)
|
||||
SOUND_TYPE_EXIT_DOOR = 1, // 0x90000000 (with SOUND_TYPE_SPECIAL)
|
||||
SOUND_TYPE_ROOM_DOOR = 2, // 0xA0000000 (with SOUND_TYPE_SPECIAL)
|
||||
SOUND_TYPE_ALTERNATING = 3, // 0xB0000000 (with SOUND_TYPE_SPECIAL)
|
||||
SOUND_TYPE_LOOPING = 0, // 0x80000000 (with SOUND_ID_TYPE_FLAG)
|
||||
SOUND_TYPE_EXIT_DOOR = 1, // 0x90000000 (with SOUND_ID_TYPE_FLAG)
|
||||
SOUND_TYPE_ROOM_DOOR = 2, // 0xA0000000 (with SOUND_ID_TYPE_FLAG)
|
||||
SOUND_TYPE_ALTERNATING = 3, // 0xB0000000 (with SOUND_ID_TYPE_FLAG)
|
||||
};
|
||||
|
||||
enum SoundIDs {
|
||||
|
@ -1755,9 +1758,11 @@ enum SoundTriggers {
|
|||
typedef enum AuResult {
|
||||
AU_RESULT_OK = 0,
|
||||
AU_ERROR_1 = 1,
|
||||
AU_AMBIENCE_ERROR_1 = 1,
|
||||
AU_AMBIENCE_STOP_ERROR_1 = 1,
|
||||
AU_AMBIENCE_STOP_ERROR_2 = 2,
|
||||
AU_AMBIENCE_ERROR_PLAYER_BUSY = 1, // player already has an mseq playing
|
||||
AU_ERROR_SONG_NOT_PLAYING = 2, // player not found for songName
|
||||
AU_AMBIENCE_ERROR_2 = 2,
|
||||
AU_AMBIENCE_ERROR_MSEQ_NOT_FOUND = 2, // mseq not found
|
||||
AU_ERROR_NULL_SONG_NAME = 3, // songName is NULL
|
||||
AU_AMBIENCE_ERROR_3 = 3,
|
||||
AU_ERROR_INVALID_SONG_DURATION = 4, // duration out of bounds: (250,10000)
|
||||
|
@ -1786,16 +1791,37 @@ enum {
|
|||
};
|
||||
|
||||
typedef enum MusicTrackVols {
|
||||
TRACK_VOLS_0 = 0,
|
||||
TRACK_VOLS_1 = 1,
|
||||
TRACK_VOLS_2 = 2,
|
||||
TRACK_VOLS_3 = 3,
|
||||
TRACK_VOLS_JAN_FULL = 0,
|
||||
TRACK_VOLS_UNUSED_1 = 1,
|
||||
TRACK_VOLS_TIK_SHIVER = 2,
|
||||
TRACK_VOLS_UNUSED_3 = 3,
|
||||
TRACK_VOLS_KPA_OUTSIDE = 4,
|
||||
TRACK_VOLS_KPA_1 = 5,
|
||||
TRACK_VOLS_KPA_2 = 6,
|
||||
TRACK_VOLS_KPA_3 = 7
|
||||
} MusicTrackVols;
|
||||
|
||||
typedef enum BGMVariation {
|
||||
BGM_VARIATION_0 = 0,
|
||||
BGM_VARIATION_1 = 1,
|
||||
BGM_VARIATION_2 = 2,
|
||||
BGM_VARIATION_3 = 3,
|
||||
} BGMVariation;
|
||||
|
||||
/// Perceptual volume levels, 0 (mute) to 8 (max).
|
||||
/// Only attenuates, never amplifies.
|
||||
typedef enum VolumeLevels {
|
||||
VOL_LEVEL_MUTE = 0,
|
||||
VOL_LEVEL_1 = 1,
|
||||
VOL_LEVEL_2 = 2,
|
||||
VOL_LEVEL_3 = 3,
|
||||
VOL_LEVEL_4 = 4,
|
||||
VOL_LEVEL_5 = 5,
|
||||
VOL_LEVEL_6 = 6,
|
||||
VOL_LEVEL_7 = 7,
|
||||
VOL_LEVEL_FULL = 8,
|
||||
} VolumeLevels;
|
||||
|
||||
enum Cams {
|
||||
CAM_DEFAULT = 0,
|
||||
CAM_BATTLE = 1,
|
||||
|
@ -1881,18 +1907,20 @@ enum ActorPartTargetFlags {
|
|||
enum AmbientSounds {
|
||||
AMBIENT_SPOOKY = 0,
|
||||
AMBIENT_WIND = 1,
|
||||
AMBIENT_BEACH = 2,
|
||||
AMBIENT_SEA = 2,
|
||||
AMBIENT_JUNGLE = 3,
|
||||
AMBIENT_LAVA_1 = 4,
|
||||
AMBIENT_LAVA_2 = 5,
|
||||
AMBIENT_SILENCE = 6,
|
||||
AMBIENT_LAVA_FADE_IN = 6,
|
||||
AMBIENT_LAVA_3 = 7,
|
||||
AMBIENT_LAVA_4 = 8,
|
||||
AMBIENT_LAVA_5 = 9,
|
||||
AMBIENT_LAVA_6 = 10,
|
||||
AMBIENT_LAVA_7 = 11,
|
||||
AMBIENT_BIRDS = 12,
|
||||
AMBIENT_SEA = 13,
|
||||
AMBIENT_UNUSED_13 = 13, // copy of AMBIENT_SEA, available for replacement
|
||||
AMBIENT_UNUSED_14 = 14, // copy of AMBIENT_SEA, available for replacement
|
||||
AMBIENT_UNUSED_15 = 15, // copy of AMBIENT_SEA, available for replacement
|
||||
AMBIENT_RADIO = 16, // radio songs for nok
|
||||
// the following 4 IDs are reserved for additional radio songs,
|
||||
// and no more are expected to follow after that
|
||||
|
@ -4656,15 +4684,6 @@ enum ProjectileHitboxAttackStates {
|
|||
PROJECTILE_HITBOX_STATE_DONE = 100
|
||||
};
|
||||
|
||||
enum MusicSettingsFlags {
|
||||
MUSIC_SETTINGS_FLAG_1 = 0x00000001,
|
||||
MUSIC_SETTINGS_FLAG_ENABLE_PROXIMITY_MIX = 0x00000002,
|
||||
MUSIC_SETTINGS_FLAG_4 = 0x00000004,
|
||||
MUSIC_SETTINGS_FLAG_8 = 0x00000008,
|
||||
MUSIC_SETTINGS_FLAG_10 = 0x00000010,
|
||||
MUSIC_SETTINGS_FLAG_20 = 0x00000020,
|
||||
};
|
||||
|
||||
// the lower byte of ColliderFlags
|
||||
enum SurfaceType {
|
||||
SURFACE_TYPE_DEFAULT = 0,
|
||||
|
@ -6405,6 +6424,12 @@ enum WindowStyles {
|
|||
WINDOW_STYLE_MAX = 22,
|
||||
};
|
||||
|
||||
enum ThreadIDs {
|
||||
THREAD_ID_PI = 0,
|
||||
THREAD_ID_CRASH = 2,
|
||||
THREAD_ID_AUDIO = 3, // also = NU_MAIN_THREAD_ID
|
||||
};
|
||||
|
||||
// LANGUAGE_DEFAULT as 0 will be the first index into several arrays containing data based on the current language.
|
||||
// For non-PAL versions, this will be the first and only index.
|
||||
#define LANGUAGE_DEFAULT 0
|
||||
|
|
|
@ -540,22 +540,6 @@ f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by);
|
|||
f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz);
|
||||
void add_vec2D_polar(f32* x, f32* y, f32 r, f32 theta);
|
||||
|
||||
//TODO -- remove these and use audio/public.h instead
|
||||
|
||||
enum AuResult bgm_set_track_volumes(s32 playerIndex, s16 trackVolSet);
|
||||
enum AuResult bgm_clear_track_volumes(s32 playerIndex, s16 trackVolSet);
|
||||
enum AuResult bgm_set_variation(s32 playerIndex, s16 arg1);
|
||||
void bgm_quiet_max_volume(void);
|
||||
void bgm_reset_max_volume(void);
|
||||
void bgm_reset_volume(void);
|
||||
s32 bgm_init_music_players(void);
|
||||
s32 bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume);
|
||||
void bgm_set_battle_song(s32, s32);
|
||||
void bgm_push_battle_song(void);
|
||||
s32 bgm_adjust_proximity(s32 playerIndex, s32 arg1, s16 arg2);
|
||||
void func_801491E4(Matrix4f mtx, s32, s32, s32, s32, s32 alpha);
|
||||
s32 func_8014A964(s32 playerIndex, s32 songID, s32 variation, s32 fadeInTime, s16 arg4, s16 arg5);
|
||||
|
||||
#include "audio/public.h"
|
||||
|
||||
void basic_window_update(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY,
|
||||
|
@ -606,8 +590,6 @@ void update_scripts(void);
|
|||
void update_messages(void);
|
||||
void update_entities(void);
|
||||
void func_80138198(void);
|
||||
void bgm_update_music_settings(void);
|
||||
s32 func_8014AD40(void);
|
||||
void update_ambient_sounds(void);
|
||||
void update_windows(void);
|
||||
void player_render_interact_prompts(void);
|
||||
|
@ -623,12 +605,8 @@ void render_curtains(void);
|
|||
void fio_init_flash(void);
|
||||
void func_80028838(void);
|
||||
void clear_screen_overlays(void);
|
||||
void bgm_reset_sequence_players(void);
|
||||
void reset_ambient_sounds(void);
|
||||
void poll_rumble(void);
|
||||
void bgm_pop_song(void);
|
||||
void bgm_push_song(s32 songID, s32 variation);
|
||||
void bgm_pop_battle_song(void);
|
||||
s32 play_ambient_sounds(s32 fadeInTime, s32 fadeOutTime);
|
||||
s32 get_fortress_key_count(void);
|
||||
s32 subtract_fortress_keys(s32 amt);
|
||||
|
|
|
@ -1028,7 +1028,13 @@ API_CALLABLE(RegisterMusicEvents);
|
|||
API_CALLABLE(FadeOutMusic);
|
||||
|
||||
/// @evtapi
|
||||
API_CALLABLE(SetMusicTrack);
|
||||
/// Start playing a song.
|
||||
///
|
||||
/// @param playerID MusicPlayer to use, should almost always be 0 (MUSIC_PLAYER_MAIN).
|
||||
/// @param song Song from SongIDs.
|
||||
/// @param variation
|
||||
/// @param volumeLevel Perceptual loudness from VOL_LEVEL_MUTE to VOL_LEVEL_FULL.
|
||||
API_CALLABLE(SetMusic);
|
||||
|
||||
/// @evtapi
|
||||
API_CALLABLE(FadeInMusic);
|
||||
|
@ -1040,7 +1046,7 @@ API_CALLABLE(EnableMusicProximityMix);
|
|||
API_CALLABLE(AdjustMusicProximityMix);
|
||||
|
||||
/// @evtapi
|
||||
API_CALLABLE(SetMusicTrackVolumes);
|
||||
API_CALLABLE(SetTrackVolumes);
|
||||
|
||||
/// @evtapi
|
||||
API_CALLABLE(PopSong);
|
||||
|
|
|
@ -104,7 +104,7 @@ extern EvtScript EVS_NpcDefeat;
|
|||
extern EvtScript ShakeCam1;
|
||||
extern EvtScript ShakeCamX;
|
||||
|
||||
extern MusicSettings gMusicSettings[2];
|
||||
extern MusicControlData gMusicControlData[2];
|
||||
|
||||
// gfx
|
||||
extern DisplayContext* gDisplayContext;
|
||||
|
|
|
@ -80,7 +80,7 @@ s16 PopupContentScissorWidths[] = {
|
|||
#endif
|
||||
|
||||
BSS s32 gPopupState;
|
||||
BSS s32 D_8010D644;
|
||||
BSS s32 PopupDelayTime;
|
||||
BSS s32 PopupMenu_SelectedIndex;
|
||||
BSS s32 PopupMenu_PrevSelectedIndex;
|
||||
BSS s32 PopupMenu_Alpha;
|
||||
|
@ -97,12 +97,12 @@ BSS HudElemID PopupMenu_CursorHID;
|
|||
BSS HudElemID PopupMenu_UpArrowHID;
|
||||
BSS HudElemID PopupMenu_DownArrowHID;
|
||||
BSS HudElemID PopupMenu_EntryIconHID;
|
||||
BSS s16 D_8010D67C;
|
||||
BSS s16 D_8010D67E;
|
||||
BSS s16 D_8010D680;
|
||||
BSS s16 D_8010D682;
|
||||
BSS s16 D_8010D684;
|
||||
BSS s16 D_8010D686;
|
||||
BSS s16 PopupWinX;
|
||||
BSS s16 PopupWinY;
|
||||
BSS s16 PopupDescX;
|
||||
BSS s16 PopupDescY;
|
||||
BSS s16 PopupPromptX;
|
||||
BSS s16 PopupPromptY;
|
||||
BSS s16 PopupMenu_StarPieceCounterPosX;
|
||||
BSS s16 PopupMenu_StarPieceCounterPosY;
|
||||
BSS s16 D_8010D68C;
|
||||
|
@ -110,7 +110,7 @@ BSS s8 PopupNotBattle;
|
|||
BSS s8 PopupMenu_MaxDisplayableEntryCount;
|
||||
BSS s8 D_8010D690;
|
||||
BSS s8 D_8010D691;
|
||||
BSS s8 D_8010D692;
|
||||
BSS s8 PopupDelayLength;
|
||||
BSS s8 D_8010D693;
|
||||
BSS s32 gPopupWorker;
|
||||
BSS s8 PopupNotDipping;
|
||||
|
@ -138,14 +138,14 @@ enum PopupTypes {
|
|||
POPUP_TYPE_USE_KEY,
|
||||
};
|
||||
|
||||
void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void popup_menu_draw_title_contents(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void func_800F48F4(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void func_800F4944(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void func_800F4C1C(s32* userData, s32 x, s32 y);
|
||||
void popup_draw_menu_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void popup_draw_title_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void popup_draw_desc_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void popup_draw_prompt_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening);
|
||||
void popup_draw_dip_query_content(s32* userData, s32 x, s32 y);
|
||||
void popup_draw_cost_icon(s32* userData, s32 x, s32 y);
|
||||
void popup_draw_already_have_partner(s32* userData, s32 x, s32 y);
|
||||
void func_800F4D28(s32* userData, s32 x, s32 y);
|
||||
void popup_draw_star_pieces_content(s32* userData, s32 x, s32 y);
|
||||
|
||||
void hide_popup_menu(void) {
|
||||
if (PopupNotBattle) {
|
||||
|
@ -207,7 +207,7 @@ void hide_popup_menu(void) {
|
|||
set_window_update(WIN_CURRENCY_COUNTER, (s32) basic_hidden_window_update);
|
||||
}
|
||||
gPopupState = POPUP_STATE_10;
|
||||
D_8010D644 = D_8010D692;
|
||||
PopupDelayTime = PopupDelayLength;
|
||||
}
|
||||
|
||||
void destroy_popup_menu(void) {
|
||||
|
@ -365,17 +365,17 @@ s32 popup_menu_update(void) {
|
|||
switch (gPopupState) {
|
||||
case POPUP_STATE_INIT:
|
||||
#if VERSION_JP
|
||||
D_8010D67C = 32;
|
||||
D_8010D67E = 72;
|
||||
D_8010D680 = 32;
|
||||
PopupWinX = 32;
|
||||
PopupWinY = 72;
|
||||
PopupDescX = 32;
|
||||
#else
|
||||
D_8010D67C = 20;
|
||||
D_8010D67E = 72;
|
||||
D_8010D680 = 20;
|
||||
PopupWinX = 20;
|
||||
PopupWinY = 72;
|
||||
PopupDescX = 20;
|
||||
#endif
|
||||
D_8010D682 = 186;
|
||||
D_8010D684 = 16;
|
||||
D_8010D686 = 88;
|
||||
PopupDescY = 186;
|
||||
PopupPromptX = 16;
|
||||
PopupPromptY = 88;
|
||||
PopupMenu_StarPieceCounterPosX = 32;
|
||||
PopupMenu_StarPieceCounterPosY = 164;
|
||||
if (PopupNotBattle) {
|
||||
|
@ -389,33 +389,33 @@ s32 popup_menu_update(void) {
|
|||
case POPUP_MENU_READ_LETTER:
|
||||
case POPUP_MENU_TAKE_FROM_CHEST:
|
||||
case POPUP_MENU_USEKEY:
|
||||
D_8010D67C += 144;
|
||||
PopupWinX += 144;
|
||||
break;
|
||||
case POPUP_MENU_TRADE_FOR_BADGE:
|
||||
D_8010D67C += 122;
|
||||
PopupWinX += 122;
|
||||
break;
|
||||
case POPUP_MENU_UPGRADE_PARTNER:
|
||||
D_8010D67C += 134;
|
||||
PopupWinX += 134;
|
||||
break;
|
||||
case POPUP_MENU_SELL_ITEM:
|
||||
D_8010D67C += 122;
|
||||
PopupWinX += 122;
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
case POPUP_MENU_READ_DIARY_PAGE:
|
||||
case POPUP_MENU_READ_POSTCARD:
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
D_8010D67C += 160;
|
||||
PopupWinX += 160;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
D_8010D67C = PopupWorldStartX[gPopupMenu->popupType] + 20;
|
||||
PopupWinX = PopupWorldStartX[gPopupMenu->popupType] + 20;
|
||||
#endif
|
||||
}
|
||||
if (PopupMenu_MaxDisplayableEntryCount >= 7) {
|
||||
#if VERSION_JP
|
||||
D_8010D67E -= 10;
|
||||
PopupWinY -= 10;
|
||||
#else
|
||||
D_8010D67E = 62;
|
||||
PopupWinY = 62;
|
||||
#endif
|
||||
}
|
||||
D_8010D68C = 0;
|
||||
|
@ -477,14 +477,14 @@ s32 popup_menu_update(void) {
|
|||
}
|
||||
|
||||
D_8010D65A = -200;
|
||||
D_8010D644 = D_8010D691;
|
||||
PopupDelayTime = D_8010D691;
|
||||
if (!PopupNotBattle) {
|
||||
D_8010D644 = 1;
|
||||
PopupDelayTime = 1;
|
||||
}
|
||||
D_8010D690 = MSG_PAL_STANDARD;
|
||||
|
||||
posX = D_8010D67C;
|
||||
posY = D_8010D67E;
|
||||
posX = PopupWinX;
|
||||
posY = PopupWinY;
|
||||
|
||||
#if VERSION_PAL
|
||||
gPopupMenu->unk_338 = 0;
|
||||
|
@ -593,17 +593,17 @@ s32 popup_menu_update(void) {
|
|||
gPopupMenu->unk_334 = (80 - msgWidth) / 2;
|
||||
}
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, var_s6, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26,
|
||||
WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
if (gPopupMenu->unk_338 == 0) {
|
||||
posX = posX2; //! required to match
|
||||
set_window_properties(WIN_POPUP_TITLE_A, posX, -6, width2, 16, WINDOW_PRIORITY_21,
|
||||
popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, 1);
|
||||
set_window_update(WIN_POPUP_TITLE_B, 2);
|
||||
} else {
|
||||
posX = posX2; //! required to match
|
||||
set_window_properties(WIN_POPUP_TITLE_B, posX, -6, width2, 16, WINDOW_PRIORITY_21,
|
||||
popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, 2);
|
||||
set_window_update(WIN_POPUP_TITLE_B, 1);
|
||||
}
|
||||
|
@ -615,56 +615,56 @@ s32 popup_menu_update(void) {
|
|||
case POPUP_MENU_CLAIM_ITEM:
|
||||
case POPUP_MENU_TAKE_FROM_CHEST:
|
||||
case POPUP_MENU_USEKEY:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 130, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 130, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 104, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 14, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 104, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 14, -6, 72, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW);
|
||||
break;
|
||||
case POPUP_MENU_TRADE_FOR_BADGE:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_UPGRADE_PARTNER:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 126, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 12, -6, 66, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 126, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 12, -6, 66, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW);
|
||||
break;
|
||||
case POPUP_MENU_SELL_ITEM:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_READ_LETTER:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 120, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 24, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 120, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 24, -6, 72, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_READ_DIARY_PAGE:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 108, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 84, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 108, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 84, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_READ_POSTCARD:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 124, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 100, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 124, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 100, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 96, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 10, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 96, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 10, -6, 72, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW);
|
||||
break;
|
||||
|
@ -676,66 +676,66 @@ s32 popup_menu_update(void) {
|
|||
case POPUP_MENU_CHECK_ITEM:
|
||||
case POPUP_MENU_CLAIM_ITEM:
|
||||
case POPUP_MENU_USEKEY:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
if (gPopupMenu->dipMode == 0) {
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 25, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 25, -6, 95, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
} else {
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
}
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 139, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 13, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 139, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 13, -6, 114, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW);
|
||||
break;
|
||||
case POPUP_MENU_TRADE_FOR_BADGE:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 162, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 17, -6, 96, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 162, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 17, -6, 96, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_UPGRADE_PARTNER:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 146, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 12, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 146, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 12, -6, 114, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW);
|
||||
break;
|
||||
case POPUP_MENU_SELL_ITEM:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 167, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 22, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 167, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 22, -6, 95, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_READ_LETTER:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 170, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 32, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 170, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 32, -6, 104, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_TAKE_FROM_CHEST:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_READ_DIARY_PAGE:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 128, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 128, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 104, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_READ_POSTCARD:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 149, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 6, -6, 139, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 149, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_A, 6, -6, 139, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE);
|
||||
break;
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 131, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 10, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_properties(WIN_POPUP_CONTENT, posX, posY, 131, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_draw_menu_content, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_TITLE_B, 10, -6, 114, 16, WINDOW_PRIORITY_21, popup_draw_title_content, NULL, WIN_POPUP_CONTENT);
|
||||
set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE);
|
||||
set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW);
|
||||
break;
|
||||
|
@ -768,7 +768,7 @@ s32 popup_menu_update(void) {
|
|||
if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) {
|
||||
posX = PopupMenu_StarPieceCounterPosX;
|
||||
posY = PopupMenu_StarPieceCounterPosY;
|
||||
set_window_properties(WIN_CURRENCY_COUNTER, posX, posY, 64, 20, WINDOW_PRIORITY_21, func_800F4D28, NULL, -1);
|
||||
set_window_properties(WIN_CURRENCY_COUNTER, posX, posY, 64, 20, WINDOW_PRIORITY_21, popup_draw_star_pieces_content, NULL, -1);
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -791,20 +791,20 @@ s32 popup_menu_update(void) {
|
|||
if (gPopupMenu->popupType >= POPUP_MENU_USE_ITEM
|
||||
&& (gPopupMenu->popupType < POPUP_MENU_READ_DIARY_PAGE || gPopupMenu->popupType == POPUP_MENU_USEKEY))
|
||||
{
|
||||
posX = D_8010D680;
|
||||
posY = D_8010D682;
|
||||
set_window_properties(WIN_POPUP_DESC, posX, posY, WINDOW_KEY_WIDTH, 32, WINDOW_PRIORITY_20, func_800F48F4, NULL, -1);
|
||||
posX = PopupDescX;
|
||||
posY = PopupDescY;
|
||||
set_window_properties(WIN_POPUP_DESC, posX, posY, WINDOW_KEY_WIDTH, 32, WINDOW_PRIORITY_20, popup_draw_desc_content, NULL, -1);
|
||||
}
|
||||
|
||||
posX = D_8010D684;
|
||||
posY = D_8010D686;
|
||||
posX = PopupPromptX;
|
||||
posY = PopupPromptY;
|
||||
|
||||
#if VERSION_PAL
|
||||
height2 = 32;
|
||||
if (get_msg_lines(gPopupMenu->unk_33C) == 2) {
|
||||
height2 = 40;
|
||||
}
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, gPopupMenu->unk_340 + 144, height2, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, gPopupMenu->unk_340 + 144, height2, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
#else
|
||||
switch (gPopupMenu->popupType) {
|
||||
#if VERSION_JP
|
||||
|
@ -821,24 +821,24 @@ s32 popup_menu_update(void) {
|
|||
case POPUP_MENU_POST_OFFICE:
|
||||
switch (gPopupMenu->dipMode) {
|
||||
case 0:
|
||||
set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, PopupPromptX, PopupPromptY, 152, 32, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case 1:
|
||||
set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, PopupPromptX, PopupPromptY, 152, 32, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case 2:
|
||||
set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, PopupPromptX, PopupPromptY, 152, 32, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case POPUP_MENU_TRADE_FOR_BADGE:
|
||||
set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 136, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, PopupPromptX, PopupPromptY, 136, 32, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case POPUP_MENU_UPGRADE_PARTNER:
|
||||
set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 136, 48, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, PopupPromptX, PopupPromptY, 136, 48, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case POPUP_MENU_SELL_ITEM:
|
||||
set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 120, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, PopupPromptX, PopupPromptY, 120, 32, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
#else
|
||||
case POPUP_MENU_USE_ITEM:
|
||||
|
@ -846,26 +846,26 @@ s32 popup_menu_update(void) {
|
|||
case POPUP_MENU_CLAIM_ITEM:
|
||||
case POPUP_MENU_TAKE_FROM_CHEST:
|
||||
case POPUP_MENU_USEKEY:
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 144, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 144, 32, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
case POPUP_MENU_THROW_AWAY_ITEM:
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 144, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 144, 40, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case POPUP_MENU_TRADE_FOR_BADGE:
|
||||
case POPUP_MENU_READ_DIARY_PAGE:
|
||||
case POPUP_MENU_READ_POSTCARD:
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 128, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 128, 40, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case POPUP_MENU_UPGRADE_PARTNER:
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 136, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 136, 40, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case POPUP_MENU_READ_LETTER:
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 112, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 112, 40, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
case POPUP_MENU_SELL_ITEM:
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 120, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, posX, posY, 120, 32, WINDOW_PRIORITY_20, popup_draw_prompt_content, NULL, -1);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -940,176 +940,177 @@ s32 popup_menu_update(void) {
|
|||
gPopupState = POPUP_STATE_CHOOSING;
|
||||
break;
|
||||
case POPUP_STATE_CHOOSING:
|
||||
if (D_8010D644 != 0) {
|
||||
D_8010D644--;
|
||||
} else {
|
||||
PopupMenu_PrevSelectedIndex = PopupMenu_SelectedIndex;
|
||||
if (PopupDelayTime != 0) {
|
||||
PopupDelayTime--;
|
||||
break;
|
||||
}
|
||||
|
||||
// change selection on up input
|
||||
if (gGameStatusPtr->heldButtons[0] & (BUTTON_STICK_UP | BUTTON_Z) &&
|
||||
(PopupMenu_SelectedIndex > 0 || (gGameStatusPtr->pressedButtons[0] & (BUTTON_STICK_UP | BUTTON_Z))))
|
||||
{
|
||||
do {
|
||||
PopupMenu_SelectedIndex--;
|
||||
} while (0); // required to match
|
||||
}
|
||||
PopupMenu_PrevSelectedIndex = PopupMenu_SelectedIndex;
|
||||
|
||||
// change selection on down input
|
||||
if (gGameStatusPtr->heldButtons[0] & (BUTTON_STICK_DOWN | BUTTON_R) &&
|
||||
((PopupMenu_SelectedIndex < gPopupMenu->numEntries - 1) || (gGameStatusPtr->pressedButtons[0] & (BUTTON_STICK_DOWN | BUTTON_R))))
|
||||
{
|
||||
do {
|
||||
PopupMenu_SelectedIndex++;
|
||||
} while (0); // required to match
|
||||
}
|
||||
// change selection on up input
|
||||
if (gGameStatusPtr->heldButtons[0] & (BUTTON_STICK_UP | BUTTON_Z) &&
|
||||
(PopupMenu_SelectedIndex > 0 || (gGameStatusPtr->pressedButtons[0] & (BUTTON_STICK_UP | BUTTON_Z))))
|
||||
{
|
||||
do {
|
||||
PopupMenu_SelectedIndex--;
|
||||
} while (0); // required to match
|
||||
}
|
||||
|
||||
// wrap selected index
|
||||
if (PopupMenu_SelectedIndex < 0) {
|
||||
PopupMenu_SelectedIndex = gPopupMenu->numEntries - 1;
|
||||
}
|
||||
if (PopupMenu_SelectedIndex > gPopupMenu->numEntries - 1) {
|
||||
PopupMenu_SelectedIndex = 0;
|
||||
}
|
||||
// change selection on down input
|
||||
if (gGameStatusPtr->heldButtons[0] & (BUTTON_STICK_DOWN | BUTTON_R) &&
|
||||
((PopupMenu_SelectedIndex < gPopupMenu->numEntries - 1) || (gGameStatusPtr->pressedButtons[0] & (BUTTON_STICK_DOWN | BUTTON_R))))
|
||||
{
|
||||
do {
|
||||
PopupMenu_SelectedIndex++;
|
||||
} while (0); // required to match
|
||||
}
|
||||
|
||||
if (PopupMenu_PrevSelectedIndex != PopupMenu_SelectedIndex) {
|
||||
sfx_play_sound(SOUND_MENU_CHANGE_SELECTION);
|
||||
}
|
||||
// wrap selected index
|
||||
if (PopupMenu_SelectedIndex < 0) {
|
||||
PopupMenu_SelectedIndex = gPopupMenu->numEntries - 1;
|
||||
}
|
||||
if (PopupMenu_SelectedIndex > gPopupMenu->numEntries - 1) {
|
||||
PopupMenu_SelectedIndex = 0;
|
||||
}
|
||||
|
||||
// ensure one option is displayed above the selected index, if applicable
|
||||
// shift up to 4 entries at a time on list wrap
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (PopupMenu_SelectedIndex < PopupMenu_FirstDisplayIndex + 1) {
|
||||
PopupMenu_FirstDisplayIndex--;
|
||||
if (PopupMenu_PrevSelectedIndex != PopupMenu_SelectedIndex) {
|
||||
sfx_play_sound(SOUND_MENU_CHANGE_SELECTION);
|
||||
}
|
||||
|
||||
// ensure one option is displayed above the selected index, if applicable
|
||||
// shift up to 4 entries at a time on list wrap
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (PopupMenu_SelectedIndex < PopupMenu_FirstDisplayIndex + 1) {
|
||||
PopupMenu_FirstDisplayIndex--;
|
||||
if (PopupMenu_FirstDisplayIndex < 0) {
|
||||
PopupMenu_FirstDisplayIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ensure one option is displayed after the selected index, if applicable
|
||||
// shift up to 4 entries at a time on list wrap
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (PopupMenu_SelectedIndex >= PopupMenu_LastDisplayIndex - 1) {
|
||||
PopupMenu_FirstDisplayIndex++;
|
||||
if (PopupMenu_FirstDisplayIndex > gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount) {
|
||||
PopupMenu_FirstDisplayIndex = gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount;
|
||||
if (PopupMenu_FirstDisplayIndex < 0) {
|
||||
PopupMenu_FirstDisplayIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
PopupMenu_LastDisplayIndex = PopupMenu_FirstDisplayIndex + PopupMenu_MaxDisplayableEntryCount;
|
||||
}
|
||||
|
||||
// ensure one option is displayed after the selected index, if applicable
|
||||
// shift up to 4 entries at a time on list wrap
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (PopupMenu_SelectedIndex >= PopupMenu_LastDisplayIndex - 1) {
|
||||
PopupMenu_FirstDisplayIndex++;
|
||||
if (PopupMenu_FirstDisplayIndex > gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount) {
|
||||
PopupMenu_FirstDisplayIndex = gPopupMenu->numEntries - PopupMenu_MaxDisplayableEntryCount;
|
||||
if (PopupMenu_FirstDisplayIndex < 0) {
|
||||
PopupMenu_FirstDisplayIndex = 0;
|
||||
}
|
||||
// make selection on A button input
|
||||
if (gGameStatusPtr->pressedButtons[0] & BUTTON_A) {
|
||||
switch (gPopupMenu->popupType) {
|
||||
case POPUP_MENU_READ_LETTER:
|
||||
sfx_play_sound(SOUND_MENU_NEXT);
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_CHOSE_WORLD;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CHOSE_BATTLE;
|
||||
}
|
||||
}
|
||||
PopupMenu_LastDisplayIndex = PopupMenu_FirstDisplayIndex + PopupMenu_MaxDisplayableEntryCount;
|
||||
break;
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
sfx_play_sound(SOUND_MENU_NEXT);
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_CHOSE_WORLD;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CHOSE_BATTLE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (gPopupMenu->enabled[PopupMenu_SelectedIndex]) {
|
||||
sfx_play_sound(SOUND_MENU_NEXT);
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_CHOSE_WORLD;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CHOSE_BATTLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER) {
|
||||
sfx_play_sound(SOUND_MENU_ERROR);
|
||||
gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_BEGIN;
|
||||
break;
|
||||
}
|
||||
if (PopupNotBattle && (gPopupMenu->popupType == POPUP_MENU_USE_ITEM || gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE)) {
|
||||
sfx_play_sound(SOUND_MENU_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (gPopupMenu->popupType) {
|
||||
case POPUP_MENU_USE_ITEM:
|
||||
case POPUP_MENU_THROW_AWAY_ITEM:
|
||||
case POPUP_MENU_TRADE_FOR_BADGE:
|
||||
case POPUP_MENU_SELL_ITEM:
|
||||
case POPUP_MENU_CHECK_ITEM:
|
||||
case POPUP_MENU_CLAIM_ITEM:
|
||||
case POPUP_MENU_USEKEY:
|
||||
if (PopupNotBattle) {
|
||||
buttons = BUTTON_B | BUTTON_C_LEFT;
|
||||
} else {
|
||||
buttons = BUTTON_B;
|
||||
}
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
case POPUP_MENU_UPGRADE_PARTNER:
|
||||
if (PopupNotBattle) {
|
||||
buttons = BUTTON_B | BUTTON_C_RIGHT;
|
||||
} else {
|
||||
buttons = BUTTON_B;
|
||||
}
|
||||
break;
|
||||
case POPUP_MENU_READ_LETTER:
|
||||
case POPUP_MENU_TAKE_FROM_CHEST:
|
||||
case POPUP_MENU_READ_DIARY_PAGE:
|
||||
case POPUP_MENU_READ_POSTCARD:
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
buttons = BUTTON_B;
|
||||
break;
|
||||
default:
|
||||
buttons = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// make selection on A button input
|
||||
if (gGameStatusPtr->pressedButtons[0] & BUTTON_A) {
|
||||
switch (gPopupMenu->popupType) {
|
||||
case POPUP_MENU_READ_LETTER:
|
||||
sfx_play_sound(SOUND_MENU_NEXT);
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_CHOSE_WORLD;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CHOSE_BATTLE;
|
||||
}
|
||||
break;
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
sfx_play_sound(SOUND_MENU_NEXT);
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_CHOSE_WORLD;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CHOSE_BATTLE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (gPopupMenu->enabled[PopupMenu_SelectedIndex]) {
|
||||
sfx_play_sound(SOUND_MENU_NEXT);
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_CHOSE_WORLD;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CHOSE_BATTLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (gPopupMenu->popupType == POPUP_MENU_SWITCH_PARTNER) {
|
||||
sfx_play_sound(SOUND_MENU_ERROR);
|
||||
gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_BEGIN;
|
||||
break;
|
||||
}
|
||||
if (PopupNotBattle && (gPopupMenu->popupType == POPUP_MENU_USE_ITEM || gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE)) {
|
||||
sfx_play_sound(SOUND_MENU_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (gPopupMenu->popupType) {
|
||||
case POPUP_MENU_USE_ITEM:
|
||||
case POPUP_MENU_THROW_AWAY_ITEM:
|
||||
case POPUP_MENU_TRADE_FOR_BADGE:
|
||||
case POPUP_MENU_SELL_ITEM:
|
||||
case POPUP_MENU_CHECK_ITEM:
|
||||
case POPUP_MENU_CLAIM_ITEM:
|
||||
case POPUP_MENU_USEKEY:
|
||||
if (PopupNotBattle) {
|
||||
buttons = BUTTON_B | BUTTON_C_LEFT;
|
||||
} else {
|
||||
buttons = BUTTON_B;
|
||||
}
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
case POPUP_MENU_UPGRADE_PARTNER:
|
||||
if (PopupNotBattle) {
|
||||
buttons = BUTTON_B | BUTTON_C_RIGHT;
|
||||
} else {
|
||||
buttons = BUTTON_B;
|
||||
}
|
||||
break;
|
||||
case POPUP_MENU_READ_LETTER:
|
||||
case POPUP_MENU_TAKE_FROM_CHEST:
|
||||
case POPUP_MENU_READ_DIARY_PAGE:
|
||||
case POPUP_MENU_READ_POSTCARD:
|
||||
case POPUP_MENU_POST_OFFICE:
|
||||
buttons = BUTTON_B;
|
||||
break;
|
||||
default:
|
||||
buttons = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gGameStatusPtr->pressedButtons[0] & buttons) {
|
||||
sfx_play_sound(SOUND_MENU_BACK);
|
||||
if (PopupNotDipping) {
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_MINUS_3;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_MINUS_7;
|
||||
}
|
||||
if (gGameStatusPtr->pressedButtons[0] & buttons) {
|
||||
sfx_play_sound(SOUND_MENU_BACK);
|
||||
if (PopupNotDipping) {
|
||||
if (!PopupNotBattle) {
|
||||
gPopupState = POPUP_STATE_MINUS_3;
|
||||
} else {
|
||||
if (PopupDipMode == 0) {
|
||||
gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_BEGIN;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CANCEL_DIP;
|
||||
}
|
||||
gPopupState = POPUP_STATE_MINUS_7;
|
||||
}
|
||||
} else {
|
||||
if (PopupDipMode == 0) {
|
||||
gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_BEGIN;
|
||||
} else {
|
||||
gPopupState = POPUP_STATE_CANCEL_DIP;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (gPopupMenu->popupType) {
|
||||
default:
|
||||
buttons = 0;
|
||||
break;
|
||||
case POPUP_MENU_USE_ITEM:
|
||||
buttons = BUTTON_C_RIGHT;
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
buttons = BUTTON_C_LEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (PopupNotBattle && (gGameStatusPtr->pressedButtons[0] & buttons)) {
|
||||
sfx_play_sound(SOUND_MENU_BACK);
|
||||
gPopupState = POPUP_STATE_CHOSE_SWAP;
|
||||
switch (gPopupMenu->popupType) {
|
||||
default:
|
||||
buttons = 0;
|
||||
break;
|
||||
}
|
||||
case POPUP_MENU_USE_ITEM:
|
||||
buttons = BUTTON_C_RIGHT;
|
||||
break;
|
||||
case POPUP_MENU_SWITCH_PARTNER:
|
||||
buttons = BUTTON_C_LEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (PopupNotBattle && (gGameStatusPtr->pressedButtons[0] & buttons)) {
|
||||
sfx_play_sound(SOUND_MENU_BACK);
|
||||
gPopupState = POPUP_STATE_CHOSE_SWAP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1184,16 +1185,16 @@ s32 popup_menu_update(void) {
|
|||
gPopupMenu->result = POPUP_RESULT_CANCEL;
|
||||
return 255;
|
||||
case POPUP_STATE_10:
|
||||
D_8010D644--;
|
||||
if (D_8010D644 == 0) {
|
||||
PopupDelayTime--;
|
||||
if (PopupDelayTime == 0) {
|
||||
gPopupState = POPUP_STATE_11;
|
||||
gPopupMenu->result = PopupMenu_SelectedIndex + 1;
|
||||
return PopupMenu_SelectedIndex + 1;
|
||||
}
|
||||
break;
|
||||
case POPUP_STATE_20:
|
||||
D_8010D644++;
|
||||
if (D_8010D644 >= D_8010D692) {
|
||||
PopupDelayTime++;
|
||||
if (PopupDelayTime >= PopupDelayLength) {
|
||||
gPopupState = POPUP_STATE_CHOOSING;
|
||||
gPopupMenu->result = PopupMenu_SelectedIndex + 1;
|
||||
return PopupMenu_SelectedIndex + 1;
|
||||
|
@ -1222,15 +1223,15 @@ s32 popup_menu_update(void) {
|
|||
set_window_properties(WIN_BTL_POPUP, 160 - (width / 2), 80, width, ALREADY_PARTNER_HEIGHT, WINDOW_PRIORITY_20, popup_draw_already_have_partner, NULL, -1);
|
||||
#endif
|
||||
set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW);
|
||||
D_8010D644 = 60;
|
||||
PopupDelayTime = 60;
|
||||
gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_AWAIT;
|
||||
return 0;
|
||||
case POPUP_STATE_ALREADY_HAVE_PARTNER_AWAIT:
|
||||
if (gGameStatusPtr->pressedButtons[0] & (BUTTON_A | BUTTON_B | BUTTON_C_RIGHT)) {
|
||||
D_8010D644 = 0;
|
||||
PopupDelayTime = 0;
|
||||
}
|
||||
if (D_8010D644 != 0) {
|
||||
D_8010D644--;
|
||||
if (PopupDelayTime != 0) {
|
||||
PopupDelayTime--;
|
||||
return 0;
|
||||
}
|
||||
set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_HIDE);
|
||||
|
@ -1305,10 +1306,10 @@ s32 popup_menu_update(void) {
|
|||
height = 40;
|
||||
posY = 72;
|
||||
}
|
||||
set_window_properties(WIN_POPUP_PROMPT, 160 - (width / 2), posY, width, height, WINDOW_PRIORITY_19, func_800F4C1C, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, 160 - (width / 2), posY, width, height, WINDOW_PRIORITY_19, popup_draw_dip_query_content, NULL, -1);
|
||||
#else
|
||||
width = get_msg_width(msgID, 0) + 23;
|
||||
set_window_properties(WIN_POPUP_PROMPT, 160 - (width / 2), 76, width, 32, WINDOW_PRIORITY_19, func_800F4C1C, NULL, -1);
|
||||
set_window_properties(WIN_POPUP_PROMPT, 160 - (width / 2), 76, width, 32, WINDOW_PRIORITY_19, popup_draw_dip_query_content, NULL, -1);
|
||||
#endif
|
||||
set_window_update(WIN_POPUP_PROMPT, WINDOW_UPDATE_SHOW);
|
||||
D_8010D6A0 = msg_get_printer_for_msg(MSG_Choice_001D, &D_8010D6A4);
|
||||
|
@ -1385,7 +1386,7 @@ s32 popup_menu_update(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
void popup_draw_menu_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
s32 x, y;
|
||||
s32 x1, y1;
|
||||
s32 offset;
|
||||
|
@ -1827,7 +1828,7 @@ void popup_menu_draw_menu_contents(s32* userData, s32 baseX, s32 baseY, s32 widt
|
|||
}
|
||||
|
||||
#if VERSION_PAL
|
||||
void popup_menu_draw_title_contents(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
void popup_draw_title_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
draw_msg(gPopupMenu->unk_330, baseX + gPopupMenu->unk_334, baseY + 2, PopupMenu_Alpha, gPopupMenu->unk_338 == 0 ? MSG_PAL_32 : MSG_PAL_34, DRAW_MSG_STYLE_MENU);
|
||||
|
||||
switch (gPopupMenu->popupType) {
|
||||
|
@ -1879,7 +1880,7 @@ void popup_menu_draw_title_contents(s32* userData, s32 baseX, s32 baseY, s32 wid
|
|||
#define POPUP_POSTOFFICE_X 8
|
||||
#endif
|
||||
|
||||
void popup_menu_draw_title_contents(
|
||||
void popup_draw_title_content(
|
||||
s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening)
|
||||
{
|
||||
switch (gPopupMenu->popupType) {
|
||||
|
@ -1949,12 +1950,12 @@ void popup_menu_draw_title_contents(
|
|||
}
|
||||
#endif
|
||||
|
||||
void func_800F48F4(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
void popup_draw_desc_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
draw_msg(gPopupMenu->descMsg[PopupMenu_SelectedIndex], baseX + 8, baseY, PopupMenu_Alpha, D_8010D690, 0);
|
||||
}
|
||||
|
||||
#if VERSION_PAL
|
||||
void func_800F4944(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
void popup_draw_prompt_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
s32 x = baseX;
|
||||
s32 y = baseY + 7;
|
||||
|
||||
|
@ -1968,7 +1969,7 @@ void func_800F4944(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s
|
|||
}
|
||||
}
|
||||
#else
|
||||
void func_800F4944(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
void popup_draw_prompt_content(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) {
|
||||
s32 msgWidth;
|
||||
|
||||
#if VERSION_JP
|
||||
|
@ -2135,7 +2136,7 @@ void func_800F4944(s32* userData, s32 baseX, s32 baseY, s32 width, s32 height, s
|
|||
#define X_800F4C1C 11
|
||||
#endif
|
||||
|
||||
void func_800F4C1C(s32* userData, s32 x, s32 y) {
|
||||
void popup_draw_dip_query_content(s32* userData, s32 x, s32 y) {
|
||||
s32 xPos = x + X_800F4C1C;
|
||||
s32 yPos = y + 8;
|
||||
s32 msg;
|
||||
|
@ -2192,7 +2193,7 @@ void popup_draw_already_have_partner(s32* userData, s32 x, s32 y) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void func_800F4D28(s32* userData, s32 x, s32 y) {
|
||||
void popup_draw_star_pieces_content(s32* userData, s32 x, s32 y) {
|
||||
HudElemID hid = PopupMenu_TitleIconHID;
|
||||
PlayerData* playerData = &gPlayerData;
|
||||
s32 xPos = x + 14;
|
||||
|
@ -2271,7 +2272,7 @@ void create_standard_popup_menu(PopupMenu* popup) {
|
|||
|
||||
PopupMenu_Alpha = 255;
|
||||
D_8010D691 = 4;
|
||||
D_8010D692 = 6;
|
||||
PopupDelayLength = 6;
|
||||
gPopupWorker = create_worker_frontUI((void (*) (void)) popup_menu_update, NULL);
|
||||
}
|
||||
|
||||
|
@ -2316,7 +2317,7 @@ void create_shop_popup_menu(PopupMenu* popup) {
|
|||
|
||||
PopupMenu_Alpha = 255;
|
||||
D_8010D691 = 4;
|
||||
D_8010D692 = 6;
|
||||
PopupDelayLength = 6;
|
||||
gPopupWorker = create_worker_frontUI((void (*) (void)) popup_menu_update, NULL);
|
||||
}
|
||||
|
||||
|
@ -2360,7 +2361,7 @@ void create_battle_popup_menu(PopupMenu* popup) {
|
|||
|
||||
PopupMenu_Alpha = 255;
|
||||
D_8010D691 = 9;
|
||||
D_8010D692 = 2;
|
||||
PopupDelayLength = 2;
|
||||
gPopupWorker = create_worker_frontUI((void (*) (void)) popup_menu_update, NULL);
|
||||
}
|
||||
|
||||
|
|
1047
src/audio.h
1047
src/audio.h
File diff suppressed because it is too large
Load Diff
|
@ -1,254 +0,0 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
|
||||
void au_update_stopped_voices(AuGlobals* globals) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globals->voices); i++) {
|
||||
AuVoice* voice = &globals->voices[i];
|
||||
|
||||
if (voice->stopPending) {
|
||||
au_syn_stop_voice(i);
|
||||
voice->stopPending = FALSE;
|
||||
voice->cmdPtr = NULL;
|
||||
voice->priority = AU_PRIORITY_FREE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void au_init_voices(AuGlobals* globals) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globals->voices); i++) {
|
||||
AuVoice* voice = &globals->voices[i];
|
||||
|
||||
voice->cmdPtr = NULL;
|
||||
voice->unk_20 = 0;
|
||||
voice->volChangeTime = 0;
|
||||
voice->timeLeft = 0;
|
||||
voice->timeIntervalIndex = 0;
|
||||
voice->unk_3C = 0;
|
||||
voice->envelopeFlags = 0;
|
||||
voice->relativeReleaseVolumes = FALSE;
|
||||
voice->releaseVolumeMult = 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
void au_update_voices(AuGlobals* globals) {
|
||||
AuVoice* voice;
|
||||
s8 var_a0;
|
||||
s16 currentAmp;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globals->voices); i++) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->cmdPtr == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE) {
|
||||
// client volume changed on previous frame
|
||||
au_voice_after_volume_change(voice);
|
||||
continue;
|
||||
}
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_KEY_RELEASED) {
|
||||
// client released the key
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_KEY_RELEASED;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_STOP;
|
||||
voice->cmdPtr = (u8*)voice->envelope.cmdListRelease;
|
||||
|
||||
// the key can be released before press cmdlist processed completely, we must handle this case properly
|
||||
if (voice->timeLeft > AU_5750) {
|
||||
voice->initialAmp = voice->initialAmp + (s32) (voice->rate * (f32) (voice->volChangeTime - voice->timeLeft));
|
||||
} else {
|
||||
voice->initialAmp = voice->targetAmp;
|
||||
}
|
||||
|
||||
voice->timeIntervalIndex = *voice->cmdPtr++;
|
||||
var_a0 = *voice->cmdPtr;
|
||||
if (*(s8*)voice->cmdPtr++ < 0) {
|
||||
// in this case release volumes are relative to last press volume
|
||||
var_a0 &= 0x7F;
|
||||
voice->relativeReleaseVolumes = TRUE;
|
||||
voice->releaseVolumeMult = voice->initialAmp;
|
||||
}
|
||||
voice->targetAmp = var_a0;
|
||||
|
||||
voice->timeLeft = AuEnvelopeIntervals[voice->timeIntervalIndex];
|
||||
voice->volChangeTime = voice->timeLeft;
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
if (voice->timeLeft > AU_5750) {
|
||||
voice->timeLeft -= AU_5750;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
currentAmp = voice->initialAmp + (s32) (voice->rate * (voice->volChangeTime - voice->timeLeft));
|
||||
} else {
|
||||
currentAmp = voice->targetAmp;
|
||||
}
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
} else {
|
||||
voice->delta = au_voice_get_delta(voice->volChangeTime);
|
||||
currentAmp = voice->targetAmp;
|
||||
}
|
||||
voice->p_volume = (((currentAmp * voice->clientVolume * voice->releaseVolumeMult) >> 0xE) * voice->volMult) >> 7;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
} else {
|
||||
if (voice->timeLeft == -1) {
|
||||
// keep current volume, this is 'sustain' phase
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
voice->p_volume = (((voice->initialAmp * voice->clientVolume * voice->releaseVolumeMult) >> 0xE) * voice->volMult) >> 7;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
} else {
|
||||
voice->timeLeft -= AU_5750;
|
||||
if (voice->timeLeft <= 0) {
|
||||
if (*voice->cmdPtr == ENV_CMD_END) {
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_STOP) {
|
||||
// if we reached the end after key release, stop the voice completely
|
||||
voice->envelopeFlags = 0;
|
||||
voice->cmdPtr = NULL;
|
||||
voice->stopPending = TRUE;
|
||||
} else {
|
||||
// we reached the end of press cmdlist, keep the last volume until the key is released
|
||||
voice->timeLeft = -1;
|
||||
voice->volChangeTime = -1;
|
||||
voice->timeIntervalIndex = ENV_TIME_300MS; // doesn't seem to affect anything
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
voice->rate = 0.0f;
|
||||
voice->initialAmp = voice->targetAmp;
|
||||
}
|
||||
} else {
|
||||
// get next envelope point
|
||||
voice->timeIntervalIndex = au_voice_step(voice);
|
||||
voice->initialAmp = voice->targetAmp;
|
||||
voice->targetAmp = (*voice->cmdPtr++) & 0x7F;
|
||||
voice->timeLeft = AuEnvelopeIntervals[voice->timeIntervalIndex];
|
||||
voice->volChangeTime = voice->timeLeft;
|
||||
if (voice->volChangeTime != 0) {
|
||||
voice->rate = ((f32) voice->targetAmp - (f32) voice->initialAmp) / (f32) voice->volChangeTime;
|
||||
} else {
|
||||
voice->rate = 0.0f;
|
||||
}
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
if (voice->timeLeft > AU_5750) {
|
||||
voice->timeLeft -= AU_5750;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
currentAmp = voice->initialAmp + (s32) (voice->rate * (voice->volChangeTime - voice->timeLeft));
|
||||
} else {
|
||||
currentAmp = voice->targetAmp;
|
||||
}
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
} else {
|
||||
voice->delta = au_voice_get_delta(voice->volChangeTime);
|
||||
currentAmp = voice->targetAmp;
|
||||
}
|
||||
voice->p_volume = (((currentAmp * voice->clientVolume * voice->releaseVolumeMult) >> 0xE) * voice->volMult) >> 7;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
} else {
|
||||
// we are between two envelope points, do nothing, just handle client volume change
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
if (voice->timeLeft > AU_5750) {
|
||||
voice->timeLeft -= AU_5750;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
currentAmp = voice->initialAmp + (s32) (voice->rate * (voice->volChangeTime - voice->timeLeft));
|
||||
} else {
|
||||
currentAmp = voice->targetAmp;
|
||||
}
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
voice->p_volume = (((currentAmp * voice->clientVolume * voice->releaseVolumeMult) >> 0xE) * voice->volMult) >> 7;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void au_voice_after_volume_change(AuVoice* voice) {
|
||||
voice->p_volume = (((voice->targetAmp * voice->clientVolume * voice->releaseVolumeMult) >> 14) * voice->volMult) >> 7;
|
||||
voice->delta = au_voice_get_delta(voice->timeLeft);
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
|
||||
s32 au_voice_get_delta(s32 msecs) {
|
||||
return (msecs / AU_5750) * AUDIO_SAMPLES;
|
||||
}
|
||||
|
||||
void au_voice_start(AuVoice* voice, EnvelopeData* envData) {
|
||||
s32 intervalIndex;
|
||||
|
||||
voice->envelope.cmdListPress = envData->cmdListPress;
|
||||
voice->cmdPtr = voice->envelope.cmdListPress;
|
||||
voice->envelope.cmdListRelease = envData->cmdListRelease;
|
||||
voice->volMult = 0x80;
|
||||
voice->loopStart = NULL;
|
||||
|
||||
intervalIndex = au_voice_step(voice);
|
||||
voice->envelopeFlags = 0;
|
||||
voice->initialAmp = 0;
|
||||
voice->targetAmp = *voice->cmdPtr++;
|
||||
voice->timeIntervalIndex = intervalIndex;
|
||||
voice->volChangeTime = AuEnvelopeIntervals[intervalIndex];
|
||||
voice->timeLeft = voice->volChangeTime;
|
||||
|
||||
voice->p_volume = (voice->targetAmp * voice->clientVolume * voice->volMult) >> 14;
|
||||
voice->delta = au_voice_get_delta(voice->volChangeTime);
|
||||
if (voice->volChangeTime != 0) {
|
||||
voice->rate = ((f32) voice->targetAmp - (f32) voice->initialAmp) / voice->volChangeTime;
|
||||
} else {
|
||||
voice->rate = 0.0f;
|
||||
}
|
||||
voice->relativeReleaseVolumes = FALSE;
|
||||
voice->releaseVolumeMult = 0x80;
|
||||
}
|
||||
|
||||
// performs special commands and returns interval index
|
||||
u8 au_voice_step(AuVoice* voice) {
|
||||
u32 op;
|
||||
u8 arg;
|
||||
|
||||
while (TRUE) {
|
||||
if (((s8)(op = *voice->cmdPtr++)) >= 0) {
|
||||
break;
|
||||
}
|
||||
switch ((u8)op) {
|
||||
case ENV_CMD_SET_MULTIPLIER:
|
||||
arg = *voice->cmdPtr++;
|
||||
if (arg > 0x80) {
|
||||
arg = 0x80;
|
||||
}
|
||||
voice->volMult = arg;
|
||||
break;
|
||||
case ENV_CMD_ADD_MULTIPLIER:
|
||||
voice->volMult += (s8) *voice->cmdPtr++;
|
||||
if (voice->volMult > 0x80) {
|
||||
voice->volMult = 0x80;
|
||||
} else if (voice->volMult < 0) {
|
||||
voice->volMult = 0;
|
||||
}
|
||||
break;
|
||||
case ENV_CMD_START_LOOP:
|
||||
voice->loopCounter = *voice->cmdPtr++; // 0 means infinite loop
|
||||
voice->loopStart = voice->cmdPtr;
|
||||
break;
|
||||
case ENV_CMD_END_LOOP:
|
||||
voice->cmdPtr++;
|
||||
if (voice->loopCounter == 0 || --voice->loopCounter != 0) {
|
||||
voice->cmdPtr = voice->loopStart;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
voice->cmdPtr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return op;
|
||||
}
|
||||
|
||||
void au_voice_set_vol_changed(AuVoice* voice) {
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
}
|
|
@ -10,11 +10,15 @@ typedef struct {
|
|||
} AmbientSoundSettings;
|
||||
|
||||
typedef enum AmbientSoundState {
|
||||
AMBIENT_SOUND_IDLE = 0,
|
||||
AMBIENT_SOUND_FADE_OUT = 1, // fade out old sounds
|
||||
AMBIENT_SOUND_FADE_IN = 2 // fade in new sounds
|
||||
AMBIENCE_STATE_IDLE = 0,
|
||||
AMBIENCE_STATE_FADE_OUT = 1, // fade out old sounds
|
||||
AMBIENCE_STATE_FADE_IN = 2 // fade in new sounds
|
||||
} AmbientSoundState;
|
||||
|
||||
typedef enum AmbientSoundFlag {
|
||||
AMBIENCE_FLAG_PLAYING = 1,
|
||||
} AmbientSoundFlag;
|
||||
|
||||
AmbientSoundSettings DefaultAmbientSoundData = {
|
||||
.flags = 0,
|
||||
.fadeState = 0,
|
||||
|
@ -34,9 +38,9 @@ void update_ambient_sounds(void) {
|
|||
s32 error;
|
||||
|
||||
switch (ambientSoundState->fadeState) {
|
||||
case AMBIENT_SOUND_IDLE:
|
||||
case AMBIENCE_STATE_IDLE:
|
||||
break;
|
||||
case AMBIENT_SOUND_FADE_OUT:
|
||||
case AMBIENCE_STATE_FADE_OUT:
|
||||
if (ambientSoundState->flags & 1) {
|
||||
if (ambientSoundState->fadeTime < 250) {
|
||||
error = snd_ambient_stop_quick(0);
|
||||
|
@ -48,21 +52,21 @@ void update_ambient_sounds(void) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
ambientSoundState->fadeState = AMBIENT_SOUND_FADE_IN;
|
||||
ambientSoundState->fadeState = AMBIENCE_STATE_FADE_IN;
|
||||
break;
|
||||
case AMBIENT_SOUND_FADE_IN:
|
||||
if (ambientSoundState->flags & 1) {
|
||||
case AMBIENCE_STATE_FADE_IN:
|
||||
if (ambientSoundState->flags & AMBIENCE_FLAG_PLAYING) {
|
||||
if (snd_ambient_is_stopped(0) != AU_RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
ambientSoundState->flags &= ~1;
|
||||
ambientSoundState->flags &= ~AMBIENCE_FLAG_PLAYING;
|
||||
}
|
||||
if (ambientSoundState->soundID < 0) {
|
||||
ambientSoundState->fadeState = AMBIENT_SOUND_IDLE;
|
||||
ambientSoundState->fadeState = AMBIENCE_STATE_IDLE;
|
||||
} else if (snd_load_ambient(ambientSoundState->soundID) == AU_RESULT_OK) {
|
||||
if (snd_ambient_play(0, 0) == AU_RESULT_OK) {
|
||||
ambientSoundState->fadeState = AMBIENT_SOUND_IDLE;
|
||||
ambientSoundState->flags |= 1;
|
||||
ambientSoundState->fadeState = AMBIENCE_STATE_IDLE;
|
||||
ambientSoundState->flags |= AMBIENCE_FLAG_PLAYING;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -74,7 +78,7 @@ s32 play_ambient_sounds(s32 soundID, s32 fadeTime) {
|
|||
|
||||
if (!gGameStatusPtr->musicEnabled) {
|
||||
snd_ambient_stop_quick(state->soundID);
|
||||
state->flags &= ~1;
|
||||
state->flags &= ~AMBIENCE_FLAG_PLAYING;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -84,6 +88,6 @@ s32 play_ambient_sounds(s32 soundID, s32 fadeTime) {
|
|||
|
||||
state->soundID = soundID;
|
||||
state->fadeTime = fadeTime;
|
||||
state->fadeState = AMBIENT_SOUND_FADE_OUT;
|
||||
state->fadeState = AMBIENCE_STATE_FADE_OUT;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,439 @@
|
|||
#include "common.h"
|
||||
#include "npc.h"
|
||||
#include "audio.h"
|
||||
|
||||
void bgm_update_volume(void);
|
||||
void bgm_set_target_volume(s32 volume);
|
||||
|
||||
BSS s16 MusicDefaultVolume;
|
||||
BSS s16 MusicTargetVolume;
|
||||
BSS s16 MusicMaxVolume;
|
||||
BSS s16 MusicCurrentVolume;
|
||||
|
||||
MusicControlData gMusicControlData[2];
|
||||
|
||||
MusicControlData BlankMusicControlData = {
|
||||
.flags = 0,
|
||||
.state = MUSIC_STATE_IDLE,
|
||||
.fadeOutTime = -1,
|
||||
.fadeInTime = 0,
|
||||
.fadeStartVolume = 0,
|
||||
.fadeEndVolume = 0,
|
||||
.requestedSongID = AU_SONG_NONE,
|
||||
.variation = -1,
|
||||
.songName = -1,
|
||||
.battleSongID = 0,
|
||||
.battleVariation = 0,
|
||||
.savedSongID = 0,
|
||||
.savedVariation = 0,
|
||||
.savedSongName = 0
|
||||
};
|
||||
|
||||
/// Lists the songs that are forced to use the variation determined by `map.songVariation & 1`.
|
||||
/// @see bgm_get_map_default_variation
|
||||
s32 SongsUsingVariationFlag[] = {
|
||||
SONG_SPECIAL_BATTLE,
|
||||
SONG_TUBBA_BLUBBA_BATTLE,
|
||||
SONG_JR_TROOPA_BATTLE,
|
||||
SONG_YOSHI_KIDS_FOUND,
|
||||
SONG_ITEM_UPGRADE,
|
||||
SONG_NEW_PARTNER,
|
||||
};
|
||||
|
||||
s16 NextVolumeUpdateTimer = 0;
|
||||
|
||||
/// If the given song ID is present in SongsUsingVariationFlag, returns the current
|
||||
/// map's `songVariation & 1` value. Otherwise, returns -1.
|
||||
///
|
||||
/// @see SongsUsingVariationFlag
|
||||
/// @returns -1: no override; 0: override to variation 0; 1 override to variation 1
|
||||
s32 bgm_get_map_default_variation(s32 songID) {
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(SongsUsingVariationFlag); i++) {
|
||||
if (SongsUsingVariationFlag[i] == songID) {
|
||||
MapConfig* map = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID];
|
||||
|
||||
return map->songVariation & 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void bgm_reset_sequence_players(void) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gMusicControlData); i++) {
|
||||
gMusicControlData[i] = BlankMusicControlData;
|
||||
}
|
||||
|
||||
MusicTargetVolume = VOL_LEVEL_FULL;
|
||||
MusicMaxVolume = VOL_LEVEL_FULL;
|
||||
MusicCurrentVolume = VOL_LEVEL_FULL;
|
||||
snd_set_bgm_volume(VOL_LEVEL_FULL);
|
||||
}
|
||||
|
||||
void bgm_reset_volume(void) {
|
||||
MusicTargetVolume = VOL_LEVEL_FULL;
|
||||
MusicMaxVolume = VOL_LEVEL_FULL;
|
||||
}
|
||||
|
||||
//TODO refactor out constants
|
||||
void bgm_update_music_control(void) {
|
||||
MusicControlData* music = gMusicControlData;
|
||||
s32 i = 0;
|
||||
s16 stateFadeOut = MUSIC_STATE_AWAIT_FADEOUT;
|
||||
s16 pushedFlag = MUSIC_FLAG_PUSHING;
|
||||
s32 flags;
|
||||
|
||||
for (i; i < ARRAY_COUNT(gMusicControlData); i++, music++) {
|
||||
switch (music->state) {
|
||||
case MUSIC_STATE_IDLE:
|
||||
break;
|
||||
case MUSIC_STATE_STOP_CURRENT:
|
||||
if (music->flags & MUSIC_FLAG_PLAYING) {
|
||||
if (music->fadeOutTime < 250) {
|
||||
if (!(music->flags & MUSIC_FLAG_PUSHING)) {
|
||||
if (snd_song_stop(music->songName) == AU_RESULT_OK) {
|
||||
music->state = stateFadeOut;
|
||||
}
|
||||
} else {
|
||||
if (snd_song_push_stop(music->songName) == AU_RESULT_OK) {
|
||||
music->state = stateFadeOut;
|
||||
}
|
||||
}
|
||||
} else if (!(music->flags & MUSIC_FLAG_PUSHING)) {
|
||||
if (snd_song_request_fade_out(music->songName, music->fadeOutTime, NULL) == AU_RESULT_OK) {
|
||||
music->state = stateFadeOut;
|
||||
}
|
||||
} else {
|
||||
if (snd_song_request_push_fade_out(music->songName, 250) == AU_RESULT_OK) {
|
||||
music->state = stateFadeOut;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (music->flags & MUSIC_FLAG_PUSHING) {
|
||||
// nothing was playing in this case, so remember to skip the next pop
|
||||
music->flags |= MUSIC_FLAG_IGNORE_POP;
|
||||
}
|
||||
music->flags &= ~pushedFlag;
|
||||
music->state = MUSIC_STATE_PLAY_NEXT;
|
||||
}
|
||||
break;
|
||||
case MUSIC_STATE_AWAIT_FADEOUT:
|
||||
flags = music->flags;
|
||||
music->flags &= ~pushedFlag;
|
||||
if (flags & MUSIC_FLAG_PLAYING) {
|
||||
if (snd_song_is_playing(music->songName) == AU_RESULT_OK) {
|
||||
music->flags &= ~MUSIC_FLAG_PLAYING;
|
||||
music->state = MUSIC_STATE_DELAY_2;
|
||||
}
|
||||
} else {
|
||||
music->state = MUSIC_STATE_PLAY_NEXT;
|
||||
}
|
||||
break;
|
||||
case MUSIC_STATE_DELAY_2:
|
||||
music->state = MUSIC_STATE_DELAY_1;
|
||||
break;
|
||||
case MUSIC_STATE_DELAY_1:
|
||||
music->state = MUSIC_STATE_PLAY_NEXT;
|
||||
break;
|
||||
case MUSIC_STATE_PLAY_NEXT:
|
||||
if (!(music->flags & MUSIC_FLAG_POPPING)) {
|
||||
if (music->requestedSongID <= AU_SONG_NONE) {
|
||||
// new song is AU_SONG_NONE, play nothing
|
||||
music->state = MUSIC_STATE_IDLE;
|
||||
} else {
|
||||
music->songName = snd_song_load(music->requestedSongID, i);
|
||||
// snd_song_lond may return either songName or an AuResult error code.
|
||||
// since song names are 4-character big-endian identifiers packed into an s32, we require
|
||||
// the upper half of the return value to be nonzero for songs which loaded without error.
|
||||
// this reserves return values from 0 to 0xFFFF for AuResult codes.
|
||||
if (music->songName > 0xFFFFU) {
|
||||
if ((music->flags & MUSIC_FLAG_FADE_IN_NEXT)) {
|
||||
snd_song_request_fade_in(music->songName, music->variation,
|
||||
music->fadeInTime, music->fadeStartVolume, music->fadeEndVolume);
|
||||
music->flags &= ~MUSIC_FLAG_FADE_IN_NEXT;
|
||||
} else {
|
||||
// if we aren't fading in, just start at the default volume level
|
||||
bgm_set_target_volume(MusicDefaultVolume);
|
||||
}
|
||||
/// @bug this is called even if we are trying to fade in, immediately overriding any fade parameters
|
||||
if (snd_song_request_play(music->songName, music->variation) == AU_RESULT_OK) {
|
||||
music->flags |= MUSIC_FLAG_PLAYING;
|
||||
music->state = MUSIC_STATE_IDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (music->flags & MUSIC_FLAG_IGNORE_POP) {
|
||||
music->state = MUSIC_STATE_IDLE;
|
||||
music->flags &= ~(MUSIC_FLAG_IGNORE_POP | MUSIC_FLAG_POPPING);
|
||||
} else if (snd_song_request_pop(music->savedSongName) == AU_RESULT_OK) {
|
||||
music->requestedSongID = music->savedSongID;
|
||||
music->variation = music->savedVariation;
|
||||
music->songName = music->savedSongName;
|
||||
music->state = MUSIC_STATE_IDLE;
|
||||
music->flags |= MUSIC_FLAG_PLAYING;
|
||||
music->flags &= ~MUSIC_FLAG_POPPING;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
bgm_update_volume();
|
||||
}
|
||||
|
||||
s32 _bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume) {
|
||||
MusicControlData* music;
|
||||
s32 mapSongVariation;
|
||||
|
||||
if (gGameStatusPtr->demoState != DEMO_STATE_NONE) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
music = &gMusicControlData[playerIndex];
|
||||
|
||||
if (!gGameStatusPtr->musicEnabled) {
|
||||
snd_song_stop(music->songName);
|
||||
music->flags &= ~MUSIC_FLAG_PLAYING;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mapSongVariation = bgm_get_map_default_variation(songID);
|
||||
if (mapSongVariation >= 0) {
|
||||
variation = mapSongVariation;
|
||||
}
|
||||
|
||||
if (music->requestedSongID == songID && music->variation == variation) {
|
||||
bgm_set_target_volume(volume);
|
||||
|
||||
if (music->flags & MUSIC_FLAG_PUSHING) {
|
||||
snd_song_request_snapshot(music->songName);
|
||||
music->flags &= ~MUSIC_FLAG_PUSHING;
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
MusicDefaultVolume = volume;
|
||||
music->requestedSongID = songID;
|
||||
music->variation = variation;
|
||||
music->fadeOutTime = fadeOutTime;
|
||||
music->state = MUSIC_STATE_STOP_CURRENT;
|
||||
music->flags &= ~MUSIC_FLAG_ENABLE_PROX_MIX;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume) {
|
||||
gMusicControlData[playerIndex].flags &= ~MUSIC_FLAG_POPPING;
|
||||
|
||||
return _bgm_set_song(playerIndex, songID, variation, fadeOutTime, volume);
|
||||
}
|
||||
|
||||
b32 bgm_fade_in_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeInTime, s16 fadeStartVolume, s16 fadeEndVolume) {
|
||||
MusicControlData* music;
|
||||
s32 mapSongVariation;
|
||||
|
||||
if (gGameStatusPtr->demoState) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
music = &gMusicControlData[playerIndex];
|
||||
|
||||
if (!gGameStatusPtr->musicEnabled) {
|
||||
snd_song_stop(music->songName);
|
||||
music->flags &= ~MUSIC_FLAG_PLAYING;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
mapSongVariation = bgm_get_map_default_variation(songID);
|
||||
if (mapSongVariation >= 0) {
|
||||
variation = mapSongVariation;
|
||||
}
|
||||
|
||||
music->fadeInTime = fadeInTime;
|
||||
music->fadeStartVolume = fadeStartVolume;
|
||||
music->fadeEndVolume = fadeEndVolume;
|
||||
music->requestedSongID = songID;
|
||||
music->variation = variation;
|
||||
music->flags |= MUSIC_FLAG_FADE_IN_NEXT;
|
||||
music->state = MUSIC_STATE_STOP_CURRENT;
|
||||
music->flags &= ~MUSIC_FLAG_ENABLE_PROX_MIX;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
s32 bgm_adjust_proximity(s32 playerIndex, s32 mix, s16 state) {
|
||||
MusicControlData* music = &gMusicControlData[playerIndex];
|
||||
|
||||
if (!(music->flags & MUSIC_FLAG_PLAYING)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(music->flags & MUSIC_FLAG_ENABLE_PROX_MIX)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case MUSIC_PROXIMITY_FAR:
|
||||
snd_song_set_proximity_mix_far(music->songName, mix);
|
||||
break;
|
||||
case MUSIC_PROXIMITY_NEAR:
|
||||
snd_song_set_proximity_mix_near(music->songName, mix);
|
||||
break;
|
||||
case MUSIC_PROXIMITY_FULL:
|
||||
snd_song_set_proximity_mix_full(music->songName, mix);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
AuResult bgm_set_track_volumes(s32 playerIndex, s16 trackVolSet) {
|
||||
MusicControlData* music = &gMusicControlData[playerIndex];
|
||||
|
||||
if (!(music->flags & MUSIC_FLAG_PLAYING)) {
|
||||
return AU_RESULT_OK;
|
||||
}
|
||||
|
||||
return snd_song_set_track_volumes(music->songName, trackVolSet);
|
||||
}
|
||||
|
||||
AuResult bgm_clear_track_volumes(s32 playerIndex, s16 trackVolSet) {
|
||||
MusicControlData* music = &gMusicControlData[playerIndex];
|
||||
|
||||
if (!(music->flags & MUSIC_FLAG_PLAYING)) {
|
||||
return AU_RESULT_OK;
|
||||
}
|
||||
|
||||
return snd_song_clear_track_volumes(music->songName, trackVolSet);
|
||||
}
|
||||
|
||||
AuResult bgm_set_linked_mode(s32 playerIndex, b16 mode) {
|
||||
MusicControlData* music = &gMusicControlData[playerIndex];
|
||||
|
||||
if (!(music->flags & MUSIC_FLAG_PLAYING)) {
|
||||
return AU_RESULT_OK;
|
||||
}
|
||||
|
||||
return snd_song_set_linked_mode(music->songName, mode);
|
||||
}
|
||||
|
||||
s32 bgm_init_music_players(void) {
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 250, VOL_LEVEL_FULL);
|
||||
bgm_set_song(1, AU_SONG_NONE, 0, 250, VOL_LEVEL_FULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bgm_quiet_max_volume(void) {
|
||||
MusicMaxVolume = VOL_LEVEL_4;
|
||||
}
|
||||
|
||||
void bgm_reset_max_volume(void) {
|
||||
MusicMaxVolume = VOL_LEVEL_FULL;
|
||||
}
|
||||
|
||||
void bgm_set_target_volume(s32 volume) {
|
||||
MusicTargetVolume = volume;
|
||||
}
|
||||
|
||||
void bgm_update_volume(void) {
|
||||
s16 toVolume;
|
||||
|
||||
if (NextVolumeUpdateTimer != 0) {
|
||||
NextVolumeUpdateTimer--;
|
||||
return;
|
||||
}
|
||||
|
||||
toVolume = MusicTargetVolume;
|
||||
if (toVolume > MusicMaxVolume) {
|
||||
toVolume = MusicMaxVolume;
|
||||
}
|
||||
|
||||
if (MusicCurrentVolume != toVolume) {
|
||||
if (MusicCurrentVolume >= toVolume) {
|
||||
MusicCurrentVolume--;
|
||||
} else {
|
||||
MusicCurrentVolume++;
|
||||
}
|
||||
snd_set_bgm_volume(MusicCurrentVolume);
|
||||
NextVolumeUpdateTimer = 3;
|
||||
}
|
||||
}
|
||||
|
||||
b32 bgm_is_any_song_playing(void) {
|
||||
MusicControlData* music = gMusicControlData;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gMusicControlData); i++, music++) {
|
||||
if (music->flags & MUSIC_FLAG_PLAYING) {
|
||||
if (snd_song_is_playing(music->songName)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void bgm_pop_song(void) {
|
||||
MusicControlData* music = gMusicControlData;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
music->flags |= MUSIC_FLAG_POPPING;
|
||||
_bgm_set_song(0, music->savedSongID, music->savedVariation, 0, VOL_LEVEL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_push_song(s32 songID, s32 variation) {
|
||||
MusicControlData* music = gMusicControlData;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
music->savedSongID = music->requestedSongID;
|
||||
music->savedVariation = music->variation;
|
||||
music->savedSongName = music->songName;
|
||||
music->flags |= MUSIC_FLAG_PUSHING;
|
||||
bgm_set_song(0, songID, variation, 500, VOL_LEVEL_FULL);
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_pop_battle_song(void) {
|
||||
MusicControlData* music = gMusicControlData;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
if (gOverrideFlags & GLOBAL_OVERRIDES_DONT_RESUME_SONG_AFTER_BATTLE) {
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_DONT_RESUME_SONG_AFTER_BATTLE;
|
||||
} else {
|
||||
music->flags |= MUSIC_FLAG_POPPING;
|
||||
_bgm_set_song(0, music->savedSongID, music->savedVariation, 0, VOL_LEVEL_FULL);
|
||||
snd_ambient_resume(0, 250);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_push_battle_song(void) {
|
||||
MusicControlData* music = gMusicControlData;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
if (!(gOverrideFlags & GLOBAL_OVERRIDES_DONT_RESUME_SONG_AFTER_BATTLE)) {
|
||||
snd_ambient_pause(0, 250);
|
||||
music->savedSongID = music->requestedSongID;
|
||||
music->savedVariation = music->variation;
|
||||
music->savedSongName = music->songName;
|
||||
music->flags |= MUSIC_FLAG_PUSHING;
|
||||
bgm_set_song(0, music->battleSongID, music->battleVariation, 500, VOL_LEVEL_FULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_set_battle_song(s32 songID, s32 variation) {
|
||||
MusicControlData* music = gMusicControlData;
|
||||
|
||||
music->battleSongID = songID;
|
||||
music->battleVariation = variation;
|
||||
}
|
||||
|
||||
void bgm_NOOP(void) {
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,204 @@
|
|||
#ifndef _AUDIO_CORE_H_
|
||||
#define _AUDIO_CORE_H_
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// core/system.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void create_audio_system(void);
|
||||
//void nuAuPreNMIFuncSet(NUAuPreNMIFunc func);
|
||||
void nuAuMgr(void* arg);
|
||||
s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 useDma);
|
||||
//ALDMAproc nuAuDmaNew(NUDMAState** state);
|
||||
//void nuAuCleanDMABuffers(void);
|
||||
//void nuAuPreNMIProc(NUScMsg mesg_type, u32 frameCounter);
|
||||
//void alLink(ALLink* element, ALLink* after);
|
||||
//void alUnlink(ALLink* element);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
//core/engine.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void au_release_voice(u8 index);
|
||||
void au_engine_init(s32 outputRate);
|
||||
static void au_reset_instrument(Instrument* instrument);
|
||||
static void au_reset_drum_entry(BGMDrumInfo* arg0);
|
||||
static void au_reset_instrument_entry(BGMInstrumentInfo* arg0);
|
||||
|
||||
/// this is called once per video frame update (50 or 60 times per second)
|
||||
void au_update_clients_for_video_frame(void);
|
||||
|
||||
/// this is called per audio frame generated by alAudioFrame (every 184 audio samples)
|
||||
/// there will be multiuple of these per video frame
|
||||
void au_update_clients_for_audio_frame(void);
|
||||
|
||||
void au_syn_begin_audio_frame(AuGlobals* globals);
|
||||
void au_reset_nonfree_voice(AuVoice* arg0, u8 arg1);
|
||||
void au_reset_voice(AuVoice* voice, u8 voiceIdx);
|
||||
|
||||
/**
|
||||
* @brief Converts a linear pitch value (in cents) into a frequency ratio suitable for adjusting playback speed.
|
||||
*
|
||||
* This function computes the playback rate corresponding to a pitch shift (up or down) in cents.
|
||||
* Positive values increase pitch (higher frequency), and negative values decrease it.
|
||||
* Recall 100 cents = 1 semitone, and therefore 1200 cents = 1 octave.
|
||||
*
|
||||
* @param tuning The pitch offset in cents, from +4095 (~ 40.95 semitones up) to -16383 (~ 163.83 semitones down)
|
||||
*
|
||||
* @return Floating point output rate multiplier. Multiply this with the base sample rate to apply the pitch.
|
||||
*/
|
||||
f32 au_compute_pitch_ratio(s32 tuning);
|
||||
|
||||
void au_fade_init(Fade* fade, s32 time, s32 startValue, s32 endValue);
|
||||
void au_fade_clear(Fade* fade);
|
||||
void au_fade_update(Fade* fade);
|
||||
void au_fade_set_volume(u8 arg0, u16 arg1, s32 arg2);
|
||||
void au_fade_flush(Fade* fade);
|
||||
void au_fade_set_envelope(Fade* fade, s16 value);
|
||||
void au_fade_calc_envelope(Fade* fade, u32 arg1, s32 target);
|
||||
void au_fade_update_envelope(Fade* fade);
|
||||
Instrument* au_get_instrument(AuGlobals* globals, BankSetIndex bank, s32 patch, EnvelopeData* arg3);
|
||||
void au_get_bgm_player_and_file(u32 playerIndex, BGMHeader** outCurrentTrackData, BGMPlayer** outPlayer);
|
||||
void au_get_bgm_player(u32 playerIndex, BGMPlayer** outPlayer);
|
||||
AuResult au_load_song_files(u32 arg0, BGMHeader* arg1, BGMPlayer* arg2);
|
||||
AuResult au_reload_song_files(s32 songID, BGMHeader* arg1);
|
||||
BGMPlayer* au_get_snapshot_by_index(s32 index);
|
||||
AuResult au_ambient_load(u32 arg0);
|
||||
BGMPlayer* au_get_client_by_priority(u8 arg0);
|
||||
void au_load_INIT(AuGlobals* arg0, s32 romAddr, ALHeap* heap);
|
||||
AuResult au_fetch_SBN_file(u32 fileIdx, AuFileFormat format, SBNFileEntry* arg2);
|
||||
void au_load_PER(AuGlobals* globals, s32 romAddr);
|
||||
void au_load_PRG(AuGlobals* arg0, s32 romAddr);
|
||||
InstrumentBank* au_get_BK_instruments(BankSet bankSet, u32 bankIndex);
|
||||
BKFileBuffer* au_load_BK_to_bank(s32 bkFileOffset, BKFileBuffer* bkFile, s32 bankIndex, BankSet bankSet);
|
||||
void au_swizzle_BK_instruments(s32 bkFileOffset, BKFileBuffer* bkFile, InstrumentBank instruments, u32 instrumentCount, u8 arg4);
|
||||
BKFileBuffer* au_load_static_BK_to_bank(s32* bkFileOffset, void* vaddr, s32 bankIndex, BankSet bankSet);
|
||||
s32 au_load_aux_bank(s32 bkFileOffset, s32 bankIndex);
|
||||
void au_clear_instrument_group(s32 bankIndex, BankSet bankSet);
|
||||
void au_set_bus_volume_level(s32 arg0, u32 idx);
|
||||
s32 au_set_reverb_type(s32 arg0, s32 arg1);
|
||||
void au_sync_channel_delay_enabled(u32 arg0);
|
||||
void au_read_rom(s32 romAddr, void* buffer, u32 size);
|
||||
void au_memset(void* dst, s32 size, u8 value);
|
||||
void au_copy_bytes(s8* src, s8* dest, s32 size);
|
||||
void au_copy_words(void* src, void* dst, s32 size);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// core/syn_driver.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void au_driver_init(AuSynDriver* driver, ALConfig* config);
|
||||
void au_driver_release(void);
|
||||
//Acmd* alAudioFrame(Acmd* cmdList, s32* cmdLen, s16* outBuf, s32 outLen);
|
||||
void au_use_global_volume(void);
|
||||
void au_set_global_volume(s16 arg0);
|
||||
s16 au_get_global_volume(void);
|
||||
void au_set_stereo_enabled(b8 enabled);
|
||||
void au_bus_set_volume(u8 busID, u16 value);
|
||||
u16 au_bus_get_volume(u8 busID);
|
||||
void au_bus_set_effect(u8 busID, u8 effectID);
|
||||
void au_bus_set_fx_params(u8 busID, s16 arg1, s16 arg2, s32 arg3);
|
||||
void au_pvoice_set_bus(u8 voiceIdx, s8 busID);
|
||||
void au_syn_stop_voice(u8 voiceIdx);
|
||||
void au_syn_start_voice(u8 index);
|
||||
void au_syn_start_voice_params(u8 index, u8 reverbType, Instrument* table, f32 pitch, s16 vol, u8 pan, u8 fxMix, s32 delta);
|
||||
void au_syn_set_wavetable(u8 voiceIdx, Instrument* table);
|
||||
void au_syn_set_pitch(u8 voiceIdx, f32 pitchRatio);
|
||||
void au_syn_set_mixer_params(u8 voiceIdx, s16 volume, s32 arg2, u8 arg3, u8 arg4);
|
||||
void au_syn_set_pan_fxmix(u8 voiceIdx, u8 arg1, u8 arg2);
|
||||
void au_syn_set_volume_delta(u8 voiceIdx, s16 arg1, s32 arg2);
|
||||
void au_syn_set_pan(u8 voiceIdx, u8 pan);
|
||||
void au_syn_set_fxmix(u8 voiceIdx, u8 dryAmt);
|
||||
s32 au_syn_get_playing(u8 voiceIdx);
|
||||
s32 au_syn_get_bus(u8 voiceIdx);
|
||||
f32 au_syn_get_pitch(u8 voiceIdx);
|
||||
u8 au_syn_get_pan(u8 voiceIdx);
|
||||
s16 au_syn_get_dryamt(u8 voiceIdx);
|
||||
s16 au_syn_get_wetamt(u8 voiceIdx);
|
||||
s32 au_syn_get_volume_left(u8 voiceIdx);
|
||||
s32 au_syn_get_volume_right(u8 voiceIdx);
|
||||
void au_set_delay_time(s32 arg0);
|
||||
void au_delay_left_channel(u8 arg0);
|
||||
void au_delay_right_channel(u8 arg0);
|
||||
void au_disable_channel_delay(void);
|
||||
void au_init_delay_channel(s16 arg0);
|
||||
//void alHeapInit(ALHeap* hp, u8* base, s32 len);
|
||||
//void alCopy(void* src, void* dst, s32 size);
|
||||
#undef alHeapAlloc
|
||||
void* alHeapAlloc(ALHeap* heap, s32 count, s32 size);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// core/voice.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* (UNUSED)
|
||||
* Immediately flush all voices which have finished playing.
|
||||
* These are normally released automatically during the start of each audio frame.
|
||||
*/
|
||||
void au_flush_finished_voices(AuGlobals* globals);
|
||||
|
||||
/**
|
||||
* Initializes all voices in the audio system.
|
||||
* Sets default values and clears previous envelope state.
|
||||
*/
|
||||
void au_init_voices(AuGlobals* globals);
|
||||
|
||||
/**
|
||||
* Main envelope system update, called once per frame.
|
||||
* Progresses envelope state for all active voices.
|
||||
*/
|
||||
void au_update_voices(AuGlobals* globals);
|
||||
|
||||
/**
|
||||
* Applies volume update after a client-side volume change.
|
||||
* This is deferred to avoid modifying envelope state mid-step.
|
||||
*/
|
||||
void au_voice_after_volume_change(AuVoice* voice);
|
||||
|
||||
/**
|
||||
* @brief Converts envelope step duration from microseconds to num samples delta.
|
||||
*
|
||||
* Uses AU_FRAME_USEC as the base time slice, returning the number of audio samples
|
||||
* corresponding to the provided duration.
|
||||
*
|
||||
* @param msecs Time duration in microseconds.
|
||||
* @return Number of samples that should pass in this interval.
|
||||
*/
|
||||
s32 au_voice_get_delta(s32 usecs);
|
||||
|
||||
/**
|
||||
* @brief Starts a new voice with the given envelope data.
|
||||
*
|
||||
* Initializes envelope state and prepares the press phase for playback.
|
||||
*
|
||||
* @param voice Pointer to the voice being started.
|
||||
* @param envData Envelope command lists (press and release) to use.
|
||||
*/
|
||||
void au_voice_start(AuVoice* voice, EnvelopeData* envData);
|
||||
|
||||
/**
|
||||
* Parses and executes envelope commands until a time interval is found.
|
||||
* Commands include setting multipliers, loop control, etc.
|
||||
*/
|
||||
u8 au_voice_step(AuVoice* voice);
|
||||
|
||||
/**
|
||||
* (UNUSED)
|
||||
* Force recalculation of voice envelope volume during next update.
|
||||
*/
|
||||
void au_voice_set_vol_changed(AuVoice* voice);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// core/pull_voice.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// core/reverb.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void au_fx_create(AuFX* fx, u8 mode, ALHeap* heap);
|
||||
void au_filter_create(AuFilter* filter, ALHeap* heap);
|
||||
void au_filter_init(AuFilter* filter, s16 arg1, s16 arg2, s16 fc);
|
||||
void au_fx_load_preset(AuFX* fx, u8 effectType);
|
||||
Acmd* au_pull_fx(AuFX* fx, Acmd* cmdBusPos, s16, s16);
|
||||
s32 au_fx_param_hdl(AuFX* fx, s16 index, s16 paramID, s32 value);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,11 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "audio/core.h"
|
||||
|
||||
#define LFSAMPLES 4
|
||||
#define AUEQPOWER_LENGTH 128
|
||||
|
||||
// values for cosine from 0 to pi/2 multiplied by 32767
|
||||
// lookup table for constant-power panning
|
||||
// these are values for cosine from 0 to pi/2 multiplied by 32767
|
||||
// called n_eqpower in libultra
|
||||
s16 AuEqPower[AUEQPOWER_LENGTH] = {
|
||||
32767, 32764, 32757, 32744, 32727, 32704, 32677, 32644,
|
||||
|
@ -25,10 +26,10 @@ s16 AuEqPower[AUEQPOWER_LENGTH] = {
|
|||
2833, 2429, 2025, 1620, 1216, 810, 405, 0
|
||||
};
|
||||
|
||||
static Acmd* _decodeChunk(Acmd* cmdBufPos, AuLoadFilter* arg1, s32 count, s32 size, s16 arg4, s16 arg5, s32 flags);
|
||||
static s16 _getRate(f64 arg0, f64 arg1, s32 arg4, u16* arg5);
|
||||
static Acmd* _decodeChunk(Acmd* cmdBufPos, AuLoadFilter* filter, s32 tsam, s32 nbytes, s16 output, s16 input, s32 flags);
|
||||
static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel);
|
||||
|
||||
// decode, resample and mix
|
||||
// decode, resample, and mix
|
||||
Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
||||
Acmd* ptr = cmdBufPos;
|
||||
AuLoadFilter* decoder;
|
||||
|
@ -45,19 +46,27 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
resampler = &pvoice->resampler;
|
||||
decoder = &pvoice->decoder;
|
||||
|
||||
// return if voice is not playing
|
||||
if (envMixer->motion != AL_PLAYING) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// buffer to store decoded (or raw) samples before mixing
|
||||
outp = N_AL_DECODER_OUT;
|
||||
|
||||
if (resampler->ratio > MAX_RATIO) {
|
||||
resampler->ratio = MAX_RATIO;
|
||||
}
|
||||
|
||||
// convert pitch ratio to fixed-point resampling increment
|
||||
resampler->ratio = (s32)(resampler->ratio * UNITY_PITCH);
|
||||
resampler->ratio = resampler->ratio / UNITY_PITCH;
|
||||
finCount = resampler->delta + resampler->ratio * (f32)184;
|
||||
|
||||
// determine how many output samples are needed for this frame
|
||||
finCount = resampler->delta + resampler->ratio * (f32)AUDIO_SAMPLES;
|
||||
outCount = (s32) finCount;
|
||||
resampler->delta = finCount - (f32) outCount;
|
||||
|
||||
if (outCount != 0) {
|
||||
if (decoder->instrument->type == AL_ADPCM_WAVE) {
|
||||
s32 nSam;
|
||||
|
@ -73,8 +82,10 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
s32 looped = FALSE;
|
||||
inp = N_AL_DECODER_IN;
|
||||
|
||||
// load ADPCM predictor
|
||||
aLoadADPCM(ptr++, decoder->bookSize, K0_TO_PHYS(decoder->instrument->predictor));
|
||||
|
||||
// will loop be triggered during this frame? if so, only process up to loop end
|
||||
looped = (decoder->loop.end < outCount + decoder->sample) && (decoder->loop.count != 0);
|
||||
|
||||
if (looped) {
|
||||
|
@ -82,17 +93,21 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
} else {
|
||||
nSam = outCount;
|
||||
}
|
||||
|
||||
if (decoder->lastsam != 0) {
|
||||
nLeft = ADPCMFSIZE - decoder->lastsam;
|
||||
} else {
|
||||
nLeft = 0;
|
||||
}
|
||||
|
||||
tsam = nSam - nLeft;
|
||||
if (tsam < 0) {
|
||||
tsam = 0;
|
||||
}
|
||||
|
||||
nframes = (tsam + ADPCMFSIZE - 1) >> LFSAMPLES;
|
||||
nbytes = nframes * ADPCMFBYTES;
|
||||
|
||||
if (looped) {
|
||||
ptr = _decodeChunk(ptr, decoder, tsam, nbytes, outp, inp, decoder->first);
|
||||
if (decoder->lastsam != 0) {
|
||||
|
@ -102,12 +117,14 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
}
|
||||
|
||||
decoder->lastsam = decoder->loop.start & 0xF;
|
||||
decoder->memin = (s32)decoder->instrument->base + ADPCMFBYTES * ((s32)(decoder->loop.start >> LFSAMPLES) + 1);
|
||||
decoder->memin = (s32)decoder->instrument->wavData + ADPCMFBYTES * ((s32)(decoder->loop.start >> LFSAMPLES) + 1);
|
||||
decoder->sample = decoder->loop.start;
|
||||
|
||||
// continue decoding looped portion if needed
|
||||
bEnd = outp;
|
||||
while (outCount > nSam) {
|
||||
outCount -= nSam;
|
||||
op = (bEnd + ((nframes + 1) << (LFSAMPLES + 1)) + 16) & ~0x1f;
|
||||
op = (bEnd + ((nframes + 1) << (LFSAMPLES + 1)) + 16) & ~0x1F;
|
||||
bEnd += nSam << 1;
|
||||
if (decoder->loop.count != -1 && decoder->loop.count != 0) {
|
||||
decoder->loop.count--;
|
||||
|
@ -127,7 +144,7 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
decoder->memin += ADPCMFBYTES * nframes;
|
||||
} else {
|
||||
nSam = nframes << LFSAMPLES;
|
||||
overFlow = decoder->memin + nbytes - ((s32)decoder->instrument->base + decoder->instrument->wavDataLength);
|
||||
overFlow = decoder->memin + nbytes - ((s32)decoder->instrument->wavData + decoder->instrument->wavDataLength);
|
||||
|
||||
if (overFlow <= 0) {
|
||||
overFlow = 0;
|
||||
|
@ -177,7 +194,7 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
nSam = decoder->loop.end - decoder->sample;
|
||||
nbytes = nSam << 1;
|
||||
if (nSam > 0) {
|
||||
dramLoc = decoder->dmaFunc(decoder->memin, nbytes, decoder->dmaState, decoder->instrument->unk_25);
|
||||
dramLoc = decoder->dmaFunc(decoder->memin, nbytes, decoder->dmaState, decoder->instrument->useDma);
|
||||
dramAlign = dramLoc & 7;
|
||||
nbytes += dramAlign;
|
||||
n_aLoadBuffer(ptr++, nbytes + 8 - (nbytes & 7), outp, dramLoc - dramAlign);
|
||||
|
@ -185,7 +202,7 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
dramAlign = 0;
|
||||
}
|
||||
outp += dramAlign;
|
||||
decoder->memin = (s32)decoder->instrument->base + (decoder->loop.start << 1);
|
||||
decoder->memin = (s32)decoder->instrument->wavData + (decoder->loop.start << 1);
|
||||
decoder->sample = decoder->loop.start;
|
||||
op = outp;
|
||||
while (outCount > nSam){
|
||||
|
@ -196,7 +213,7 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
}
|
||||
nSam = MIN(outCount, decoder->loop.end - decoder->loop.start);
|
||||
nbytes = nSam << 1;
|
||||
dramLoc = decoder->dmaFunc(decoder->memin, nbytes, decoder->dmaState, decoder->instrument->unk_25);
|
||||
dramLoc = decoder->dmaFunc(decoder->memin, nbytes, decoder->dmaState, decoder->instrument->useDma);
|
||||
dramAlign = dramLoc & 7;
|
||||
nbytes += dramAlign;
|
||||
if ((op & 7) != 0) {
|
||||
|
@ -214,7 +231,7 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
decoder->memin += outCount << 1;
|
||||
} else {
|
||||
nbytes = outCount << 1;
|
||||
overFlow = decoder->memin + nbytes - ((s32)decoder->instrument->base + decoder->instrument->wavDataLength);
|
||||
overFlow = decoder->memin + nbytes - ((s32)decoder->instrument->wavData + decoder->instrument->wavDataLength);
|
||||
if (overFlow <= 0) {
|
||||
overFlow = 0;
|
||||
} else {
|
||||
|
@ -226,7 +243,7 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
if (overFlow < nbytes) {
|
||||
if (outCount > 0) {
|
||||
nbytes -= overFlow;
|
||||
dramLoc = decoder->dmaFunc(decoder->memin, nbytes, decoder->dmaState, decoder->instrument->unk_25);
|
||||
dramLoc = decoder->dmaFunc(decoder->memin, nbytes, decoder->dmaState, decoder->instrument->useDma);
|
||||
dramAlign = dramLoc & 7;
|
||||
nbytes += dramAlign;
|
||||
n_aLoadBuffer(ptr++, nbytes + 8 - (nbytes & 7), outp, dramLoc - dramAlign);
|
||||
|
@ -250,12 +267,15 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// resample audio from source buffer to output buffer
|
||||
incr = (s32)(resampler->ratio * UNITY_PITCH);
|
||||
n_aResample(ptr++, osVirtualToPhysical(resampler->state), resampler->first, incr, outp, 0);
|
||||
resampler->first = 0;
|
||||
resampler->first = FALSE;
|
||||
|
||||
if (envMixer->first != 0) {
|
||||
envMixer->first = 0;
|
||||
// set up envelope mixing
|
||||
if (envMixer->dirty) {
|
||||
envMixer->dirty = FALSE;
|
||||
if (!AuSynUseStereo) {
|
||||
envMixer->ltgt = (envMixer->volume * AuEqPower[AUEQPOWER_LENGTH / 2]) >> 15;
|
||||
envMixer->rtgt = (envMixer->volume * AuEqPower[AUEQPOWER_LENGTH / 2]) >> 15;
|
||||
|
@ -266,39 +286,43 @@ Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos) {
|
|||
envMixer->lratm = _getRate(envMixer->cvolL, envMixer->ltgt, envMixer->segEnd, &envMixer->lratl);
|
||||
envMixer->rratm = _getRate(envMixer->cvolR, envMixer->rtgt, envMixer->segEnd, &envMixer->rratl);
|
||||
n_aSetVolume(ptr++, A_RATE, envMixer->ltgt, envMixer->lratm, envMixer->lratl);
|
||||
n_aSetVolume(ptr++, A_LEFT | A_VOL, envMixer->cvolL, envMixer->dryamt, envMixer->wetamt);
|
||||
n_aSetVolume(ptr++, A_RIGHT | A_VOL, envMixer->rtgt, envMixer->rratm, envMixer->rratl);
|
||||
n_aSetVolume(ptr++, A_VOL | A_LEFT, envMixer->cvolL, envMixer->dryamt, envMixer->wetamt);
|
||||
n_aSetVolume(ptr++, A_VOL | A_RIGHT, envMixer->rtgt, envMixer->rratm, envMixer->rratl);
|
||||
n_aEnvMixer(ptr++, A_INIT, envMixer->cvolR, osVirtualToPhysical(envMixer->state));
|
||||
} else {
|
||||
n_aEnvMixer(ptr++, A_CONTINUE, 0, osVirtualToPhysical(envMixer->state));
|
||||
}
|
||||
|
||||
// advance envelope segment
|
||||
envMixer->delta += AUDIO_SAMPLES;
|
||||
if (envMixer->segEnd < envMixer->delta) {
|
||||
envMixer->delta = envMixer->segEnd;
|
||||
}
|
||||
|
||||
// if stopped, reset state
|
||||
if (envMixer->motion == AL_STOPPED) {
|
||||
envMixer->first = 1;
|
||||
envMixer->dirty = TRUE;
|
||||
envMixer->volume = 1;
|
||||
resampler->delta = 0.0f;
|
||||
resampler->first = 1;
|
||||
resampler->first = TRUE;
|
||||
decoder->lastsam = 0;
|
||||
decoder->first = 1;
|
||||
decoder->sample = 0;
|
||||
decoder->memin = (s32) decoder->instrument->base;
|
||||
decoder->memin = (s32) decoder->instrument->wavData;
|
||||
decoder->loop.count = decoder->instrument->loopCount;
|
||||
func_80052E30(pvoice->index);
|
||||
au_release_voice(pvoice->index);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/// loads and decodes a chunk of ADPCM data into RSP memory
|
||||
static Acmd* _decodeChunk(Acmd* cmdBufPos, AuLoadFilter* filter, s32 tsam, s32 nbytes, s16 output, s16 input, s32 flags) {
|
||||
s32 endAddr;
|
||||
s32 endAlign;
|
||||
s32 paddedSize;
|
||||
|
||||
if (nbytes > 0) {
|
||||
endAddr = filter->dmaFunc((s32) filter->memin, nbytes, filter->dmaState, filter->instrument->unk_25);
|
||||
endAddr = filter->dmaFunc((s32) filter->memin, nbytes, filter->dmaState, filter->instrument->useDma);
|
||||
endAlign = endAddr & 7;
|
||||
nbytes += endAlign;
|
||||
paddedSize = nbytes + 8 - (nbytes & 7);
|
||||
|
@ -317,6 +341,8 @@ static Acmd* _decodeChunk(Acmd* cmdBufPos, AuLoadFilter* filter, s32 tsam, s32 n
|
|||
return cmdBufPos;
|
||||
}
|
||||
|
||||
// computes an audio volume ramp rate
|
||||
// used for smooth volume transitions in envelope segments
|
||||
static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel) {
|
||||
f64 inv;
|
||||
f64 a;
|
|
@ -1,5 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "audio/core.h"
|
||||
|
||||
#define SWAP16(in, out) \
|
||||
{ \
|
||||
|
@ -8,9 +9,8 @@
|
|||
in = t; \
|
||||
}
|
||||
|
||||
static void _init_lpfilter(AuLowPass* lp);
|
||||
static Acmd* _saveBuffer(AuFX* fx, s16* oldPos, s32 buff, s32 count, Acmd* cmdBufPos);
|
||||
static f32 func_80059BD4(AuDelay* delay, s32 rsdelta);
|
||||
static Acmd* _loadDelayLineBuffer(AuFX* fx, s16* oldPos, s32 buff, s32 count, Acmd* cmdBufPos);
|
||||
static f32 updateTriangleModulation(AuDelay* delay, s32 rsdelta);
|
||||
|
||||
/*
|
||||
* the following constant is derived from:
|
||||
|
@ -26,13 +26,16 @@ static f32 func_80059BD4(AuDelay* delay, s32 rsdelta);
|
|||
*/
|
||||
#define CONVERT 173123.404906676
|
||||
|
||||
/*
|
||||
* WARNING: THE FOLLOWING CONSTANT MUST BE KEPT IN SYNC
|
||||
* WITH SCALING IN MICROCODE!!!
|
||||
*/
|
||||
#define SCALE 16384
|
||||
|
||||
// #define ms *(((s32)((f32)44.1))&~0x7)
|
||||
#define INPUT_PARAM 0
|
||||
#define OUTPUT_PARAM 1
|
||||
#define FBCOEF_PARAM 2
|
||||
#define FFCOEF_PARAM 3
|
||||
#define GAIN_PARAM 4
|
||||
#define CHORUSRATE_PARAM 5
|
||||
#define CHORUSDEPTH_PARAM 6
|
||||
#define LPFILT_PARAM 7
|
||||
|
||||
s32 SMALL_ROOM_PARAMS[] = {
|
||||
/* sections length */
|
||||
|
@ -104,80 +107,78 @@ s32* AU_FX_CUSTOM_PARAMS[] = {
|
|||
NULL_PARAMS, NULL_PARAMS, NULL_PARAMS, NULL_PARAMS
|
||||
};
|
||||
|
||||
static void _init_lpfilter(AuLowPass* lp) {
|
||||
static void _init_lpfilter(AuLowPass* filter) {
|
||||
f64 attenuation;
|
||||
s16 timeConstant;
|
||||
u32 temp;
|
||||
s32 i;
|
||||
|
||||
lp->first = 1;
|
||||
temp = lp->fc;
|
||||
filter->first = 1;
|
||||
temp = filter->fc;
|
||||
timeConstant = temp;
|
||||
timeConstant = timeConstant >> 1;
|
||||
lp->fgain = SCALE - timeConstant;
|
||||
filter->fgain = SCALE - timeConstant;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(lp->fccoef) / 2; i++) {
|
||||
lp->fccoef[i] = 0;
|
||||
for (i = 0; i < 8; i++) {
|
||||
filter->fccoef[i] = 0;
|
||||
}
|
||||
|
||||
lp->fccoef[8] = timeConstant;
|
||||
filter->fccoef[8] = timeConstant;
|
||||
|
||||
// ith value is 16384 * (timeConstant / 16384)^(i-7)
|
||||
// ex: i = 9 --> timeConstant^2 / 16384
|
||||
attenuation = ((f64)timeConstant / SCALE);
|
||||
for (i = 9; i < ARRAY_COUNT(lp->fccoef); i++) {
|
||||
attenuation *= ((f64)timeConstant /SCALE);
|
||||
lp->fccoef[i] = attenuation * SCALE;
|
||||
for (i = 9; i < ARRAY_COUNT(filter->fccoef); i++) {
|
||||
attenuation *= ((f64)timeConstant / SCALE);
|
||||
filter->fccoef[i] = attenuation * SCALE;
|
||||
}
|
||||
}
|
||||
|
||||
// definately AuFX, evidenced by call to func_8005904C
|
||||
// this is n_alFxNew
|
||||
/// @param effectType from enum AuEffectType
|
||||
void func_80058E84(AuFX* fx, u8 effectType, ALHeap* heap) {
|
||||
void au_fx_create(AuFX* fx, u8 effectType, ALHeap* heap) {
|
||||
AuDelay* delay;
|
||||
u16 i;
|
||||
|
||||
// allocate space for 4 AuDelay
|
||||
fx->delays = alHeapAlloc(heap, AU_FX_DELAY_COUNT, sizeof(AuDelay));
|
||||
fx->delays = alHeapAlloc(heap, AU_FX_MAX_TAPS, sizeof(AuDelay));
|
||||
fx->base = alHeapAlloc(heap, AU_FX_LENGTH, sizeof(s16));
|
||||
|
||||
for (i = 0; i < AU_FX_DELAY_COUNT; i++) {
|
||||
for (i = 0; i < AU_FX_MAX_TAPS; i++) {
|
||||
delay = &fx->delays[i];
|
||||
delay->resampler_2C = alHeapAlloc(heap, 1, sizeof(AuResampler));
|
||||
delay->resampler_2C->state = alHeapAlloc(heap, 1, sizeof(RESAMPLE_STATE));
|
||||
delay->lowpass_24 = alHeapAlloc(heap, 1, sizeof(AuLowPass));
|
||||
delay->lowpass_24->fstate = alHeapAlloc(heap, 1, sizeof(POLEF_STATE));
|
||||
delay->resamplerTemplate = alHeapAlloc(heap, 1, sizeof(AuResampler));
|
||||
delay->resamplerTemplate->state = alHeapAlloc(heap, 1, sizeof(RESAMPLE_STATE));
|
||||
delay->lowpassTemplate = alHeapAlloc(heap, 1, sizeof(AuLowPass));
|
||||
delay->lowpassTemplate->fstate = alHeapAlloc(heap, 1, sizeof(POLEF_STATE));
|
||||
}
|
||||
|
||||
func_8005904C(fx, effectType);
|
||||
au_fx_load_preset(fx, effectType);
|
||||
}
|
||||
|
||||
// no known calls to this function
|
||||
void func_80058F88(AlUnkKappa* kappa, ALHeap* heap) {
|
||||
kappa->unk_00 = alHeapAlloc(heap, 0x1420, sizeof(s16));
|
||||
kappa->lowpass_10 = alHeapAlloc(heap, 1, sizeof(AuLowPass));
|
||||
kappa->lowpass_10->fstate = alHeapAlloc(heap, 1, sizeof(POLEF_STATE));
|
||||
func_80059008(kappa, 0, 0, 0x5000);
|
||||
void au_filter_create(AuFilter* filter, ALHeap* heap) {
|
||||
filter->base = alHeapAlloc(heap, AU_FILTER_LENGTH, sizeof(s16));
|
||||
filter->lowpassTemplate = alHeapAlloc(heap, 1, sizeof(AuLowPass));
|
||||
filter->lowpassTemplate->fstate = alHeapAlloc(heap, 1, sizeof(POLEF_STATE));
|
||||
au_filter_init(filter, 0, 0, 0x5000);
|
||||
}
|
||||
|
||||
// no known entry point to this function, called only by func_80058F88
|
||||
void func_80059008(AlUnkKappa* kappa, s16 arg1, s16 arg2, s16 fc) {
|
||||
kappa->unk_06 = arg1;
|
||||
kappa->unk_08 = arg2;
|
||||
// no known entry point to this function, called only by au_filter_create
|
||||
void au_filter_init(AuFilter* filter, s16 arg1, s16 arg2, s16 cutoff) {
|
||||
filter->unused_06 = arg1;
|
||||
filter->unused_08 = arg2;
|
||||
|
||||
if (fc != 0) {
|
||||
kappa->lowpass_0C = kappa->lowpass_10;
|
||||
kappa->lowpass_0C->fc = fc;
|
||||
_init_lpfilter(kappa->lowpass_0C);
|
||||
if (cutoff != 0) {
|
||||
filter->activeLowpass = filter->lowpassTemplate;
|
||||
filter->activeLowpass->fc = cutoff;
|
||||
_init_lpfilter(filter->activeLowpass);
|
||||
return;
|
||||
}
|
||||
|
||||
kappa->lowpass_0C = NULL;
|
||||
filter->activeLowpass = NULL;
|
||||
}
|
||||
|
||||
// part of n_alFxNew, extracted to allow reseting fx without reallocating AuFX
|
||||
void func_8005904C(AuFX* fx, u8 effectType) {
|
||||
// reset fx without reallocating AuFX
|
||||
void au_fx_load_preset(AuFX* fx, u8 effectType) {
|
||||
s32* params;
|
||||
s32* clr;
|
||||
s32 i, j;
|
||||
|
@ -241,49 +242,68 @@ void func_8005904C(AuFX* fx, u8 effectType) {
|
|||
delay->rsgain = ((f32)params[j++] / CONVERT) * (delay->output - delay->input);
|
||||
delay->rsval = 1.0f;
|
||||
delay->rsdelta = 0.0f;
|
||||
delay->resampler_28 = delay->resampler_2C;
|
||||
delay->resampler_2C->delta = 0.0;
|
||||
delay->resampler_28->first = 1;
|
||||
delay->activeResampler = delay->resamplerTemplate;
|
||||
delay->resamplerTemplate->delta = 0.0;
|
||||
delay->activeResampler->first = TRUE;
|
||||
} else {
|
||||
delay->resampler_28 = NULL;
|
||||
delay->activeResampler = NULL;
|
||||
j++;
|
||||
j++;
|
||||
}
|
||||
|
||||
if (params[j]) {
|
||||
delay->lowpass_20 = delay->lowpass_24;
|
||||
delay->lowpass_20->fc = params[j++];
|
||||
_init_lpfilter(delay->lowpass_20);
|
||||
delay->activeLowpass = delay->lowpassTemplate;
|
||||
delay->activeLowpass->fc = params[j++];
|
||||
_init_lpfilter(delay->activeLowpass);
|
||||
} else {
|
||||
delay->lowpass_20 = NULL;
|
||||
delay->activeLowpass = NULL;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// au_pull_fx -- based on alFxPull
|
||||
// AuFX from gSynDriverPtr
|
||||
|
||||
Acmd* au_pull_fx(AuFX* fx, Acmd* ptr, s16 outputBuf, s16 arg3) {
|
||||
/**
|
||||
* Applies a chain of delay-line based effects to audio and mixes into output.
|
||||
*
|
||||
* For each delay tap in the FX chain:
|
||||
* - Loads delay input/output from circular buffer.
|
||||
* - Applies optional modulation and resampling.
|
||||
* - Applies feedforward/feedback mixing.
|
||||
* - Applies optional lowpass filtering.
|
||||
* - Mixes result into wet output buffer.
|
||||
*
|
||||
* @param fx Pointer to FX state (delay taps, buffers, etc.)
|
||||
* @param ptr Pointer to the current audio command list position.
|
||||
* @param wetDmem DMEM offset to mix wet output into.
|
||||
* @param tempDmem Base DMEM offset for temporary working buffers.
|
||||
* @return Updated command list pointer.
|
||||
*/
|
||||
Acmd* au_pull_fx(AuFX* fx, Acmd* ptr, s16 wetDmem, s16 tempDmem) {
|
||||
Acmd* cmdBufPos = ptr;
|
||||
s16 delayIdx;
|
||||
|
||||
s16* inPtr;
|
||||
s16* outPtr;
|
||||
|
||||
s16 buff1 = arg3 + N_AL_TEMP_0;
|
||||
s16 buff2 = arg3 + N_AL_TEMP_1;
|
||||
s16 rbuff = arg3 + N_AL_TEMP_2;
|
||||
s16* prevOutPtr = 0;
|
||||
s16 outputBufCopy = outputBuf;
|
||||
// DMEM temp buffer layout:
|
||||
s16 inputTapBuffer = tempDmem;
|
||||
s16 outputTapBuffer = tempDmem + 2 * AUDIO_SAMPLES;
|
||||
s16 resampleBuffer = tempDmem + 4 * AUDIO_SAMPLES;
|
||||
|
||||
n_aSaveBuffer(cmdBufPos++, FIXED_SAMPLE<<1, outputBuf, osVirtualToPhysical(fx->input));
|
||||
aClearBuffer(cmdBufPos++, outputBuf, FIXED_SAMPLE<<1);
|
||||
s16* prevOutPtr = 0;
|
||||
s16 outDmem = wetDmem;
|
||||
|
||||
// save wet input from voice mixing into circular delay buffer
|
||||
n_aSaveBuffer(cmdBufPos++, 2 * AUDIO_SAMPLES, wetDmem, osVirtualToPhysical(fx->input));
|
||||
|
||||
// clear the wet output buffer for this frame
|
||||
aClearBuffer(cmdBufPos++, wetDmem, 2 * AUDIO_SAMPLES);
|
||||
|
||||
for (delayIdx = 0; delayIdx < fx->delayCount; delayIdx++) {
|
||||
AuDelay* delay = &fx->delays[delayIdx];
|
||||
f32 fUnityPitch = UNITY_PITCH;
|
||||
|
||||
// calculate read positions for input and output taps, wrapping the circular buffer if necessary
|
||||
inPtr = &fx->input[-delay->input];
|
||||
if (inPtr < fx->base) {
|
||||
inPtr += fx->length;
|
||||
|
@ -292,13 +312,17 @@ Acmd* au_pull_fx(AuFX* fx, Acmd* ptr, s16 outputBuf, s16 arg3) {
|
|||
if (outPtr < fx->base) {
|
||||
outPtr += fx->length;
|
||||
}
|
||||
|
||||
// if output is same as previous tap, reuse loaded data by swapping buffers
|
||||
if (inPtr == prevOutPtr) {
|
||||
SWAP16(buff1, buff2);
|
||||
SWAP16(inputTapBuffer, outputTapBuffer);
|
||||
} else {
|
||||
n_aLoadBuffer(cmdBufPos++, FIXED_SAMPLE<<1, buff1, osVirtualToPhysical(inPtr));
|
||||
// load from input tap into buffer
|
||||
n_aLoadBuffer(cmdBufPos++, 2 * AUDIO_SAMPLES, inputTapBuffer, osVirtualToPhysical(inPtr));
|
||||
}
|
||||
if (delay->resampler_28) {
|
||||
// modified _n_loadOutputBuffer
|
||||
|
||||
if (delay->activeResampler) {
|
||||
// triangle wave modulation for chorus/flange
|
||||
s32 ratio;
|
||||
s32 length, count;
|
||||
f32 delta, fratio, fincount;
|
||||
|
@ -306,80 +330,89 @@ Acmd* au_pull_fx(AuFX* fx, Acmd* ptr, s16 outputBuf, s16 arg3) {
|
|||
s16 tmp;
|
||||
s16* rsOutPtr;
|
||||
|
||||
// modulate delay time (triangle wave)
|
||||
length = delay->output - delay->input;
|
||||
delta = func_80059BD4(delay, AUDIO_SAMPLES);
|
||||
delta = updateTriangleModulation(delay, AUDIO_SAMPLES);
|
||||
delta /= length;
|
||||
delta = (s32)(delta * fUnityPitch);
|
||||
delta = delta / UNITY_PITCH;
|
||||
fratio = 1.0 - delta;
|
||||
fincount = delay->resampler_28->delta + (fratio * AUDIO_SAMPLES);
|
||||
count = (s32) fincount;
|
||||
delay->resampler_28->delta = fincount - count;
|
||||
|
||||
fratio = 1.0 - delta;
|
||||
|
||||
// calculate fractional resampling count
|
||||
fincount = delay->activeResampler->delta + (fratio * AUDIO_SAMPLES);
|
||||
count = (s32) fincount;
|
||||
delay->activeResampler->delta = fincount - count;
|
||||
|
||||
// prepare delay line for resampling (wrap if needed)
|
||||
rsOutPtr = &fx->input[-(delay->output - delay->rsdelta)];
|
||||
ramAlign = ((s32) rsOutPtr & 7) >> 1;
|
||||
|
||||
rsOutPtr -= ramAlign;
|
||||
if (rsOutPtr < fx->base) {
|
||||
rsOutPtr += fx->length;
|
||||
}
|
||||
|
||||
cmdBufPos = _saveBuffer(fx, rsOutPtr, rbuff, count + ramAlign, cmdBufPos);
|
||||
// load from delay line
|
||||
cmdBufPos = _loadDelayLineBuffer(fx, rsOutPtr, resampleBuffer, count + ramAlign, cmdBufPos);
|
||||
|
||||
// process resampler
|
||||
ratio = fratio * fUnityPitch;
|
||||
|
||||
tmp = buff2 >> 8;
|
||||
n_aResample(cmdBufPos++, osVirtualToPhysical(delay->resampler_28->state),
|
||||
delay->resampler_28->first, ratio, rbuff + (ramAlign<<1), tmp);
|
||||
|
||||
delay->resampler_28->first = 0;
|
||||
tmp = outputTapBuffer >> 8;
|
||||
n_aResample(cmdBufPos++, osVirtualToPhysical(delay->activeResampler->state),
|
||||
delay->activeResampler->first, ratio, resampleBuffer + (ramAlign<<1), tmp);
|
||||
delay->activeResampler->first = FALSE;
|
||||
delay->rsdelta += count - AUDIO_SAMPLES;
|
||||
} else {
|
||||
n_aLoadBuffer(cmdBufPos++, FIXED_SAMPLE<<1, buff2, osVirtualToPhysical(outPtr));
|
||||
// no resampling -- just load from output pointer
|
||||
n_aLoadBuffer(cmdBufPos++, 2 * AUDIO_SAMPLES, outputTapBuffer, osVirtualToPhysical(outPtr));
|
||||
}
|
||||
if (delay->ffcoef) {
|
||||
aMix(cmdBufPos++, 0, (u16)delay->ffcoef, buff1, buff2);
|
||||
|
||||
if (delay->resampler_28 == NULL && delay->lowpass_20 == NULL) {
|
||||
n_aSaveBuffer(cmdBufPos++, FIXED_SAMPLE<<1, buff2, osVirtualToPhysical(outPtr));
|
||||
// feedforward: input -> output
|
||||
if (delay->ffcoef) {
|
||||
aMix(cmdBufPos++, 0, (u16)delay->ffcoef, inputTapBuffer, outputTapBuffer);
|
||||
|
||||
// save output if no additional processing needed
|
||||
if (delay->activeResampler == NULL && delay->activeLowpass == NULL) {
|
||||
n_aSaveBuffer(cmdBufPos++, 2 * AUDIO_SAMPLES, outputTapBuffer, osVirtualToPhysical(outPtr));
|
||||
}
|
||||
}
|
||||
|
||||
// feedback: output -> input
|
||||
if (delay->fbcoef) {
|
||||
aMix(cmdBufPos++, 0, (u16)delay->fbcoef, buff2, buff1);
|
||||
n_aSaveBuffer(cmdBufPos++, FIXED_SAMPLE<<1, buff1, osVirtualToPhysical(inPtr));
|
||||
aMix(cmdBufPos++, 0, (u16)delay->fbcoef, outputTapBuffer, inputTapBuffer);
|
||||
n_aSaveBuffer(cmdBufPos++, 2 * AUDIO_SAMPLES, inputTapBuffer, osVirtualToPhysical(inPtr));
|
||||
}
|
||||
if (delay->lowpass_20 != NULL) {
|
||||
|
||||
// Save processed output back into delay line (if not resampled)
|
||||
if (delay->activeLowpass != NULL) {
|
||||
// modified _n_filterBuffer
|
||||
s16 tmp = buff2 >> 8;
|
||||
n_aLoadADPCM(cmdBufPos++, 32, osVirtualToPhysical(delay->lowpass_20->fccoef));
|
||||
n_aPoleFilter(cmdBufPos++, delay->lowpass_20->first, delay->lowpass_20->fgain, tmp, osVirtualToPhysical(delay->lowpass_20->fstate));
|
||||
delay->lowpass_20->first = 0;
|
||||
s16 alignedBuffer = outputTapBuffer >> 8;
|
||||
n_aLoadADPCM(cmdBufPos++, 32, osVirtualToPhysical(delay->activeLowpass->fccoef));
|
||||
n_aPoleFilter(cmdBufPos++, delay->activeLowpass->first, delay->activeLowpass->fgain, alignedBuffer, osVirtualToPhysical(delay->activeLowpass->fstate));
|
||||
delay->activeLowpass->first = 0;
|
||||
}
|
||||
if (!delay->resampler_28) {
|
||||
n_aSaveBuffer(cmdBufPos++, FIXED_SAMPLE<<1, buff2, osVirtualToPhysical(outPtr));
|
||||
|
||||
// save output (if not already saved earlier)
|
||||
if (!delay->activeResampler) {
|
||||
n_aSaveBuffer(cmdBufPos++, 2 * AUDIO_SAMPLES, outputTapBuffer, osVirtualToPhysical(outPtr));
|
||||
}
|
||||
|
||||
// mix input from this delay into wet output buffer
|
||||
if (delay->gain) {
|
||||
aMix(cmdBufPos++, 0, (u16)delay->gain, buff2, outputBufCopy);
|
||||
aMix(cmdBufPos++, 0, (u16)delay->gain, outputTapBuffer, outDmem);
|
||||
}
|
||||
prevOutPtr = &fx->input[delay->output];
|
||||
}
|
||||
|
||||
// advance position in ring buffer
|
||||
fx->input += AUDIO_SAMPLES;
|
||||
if (fx->input >= &fx->base[fx->length]) {
|
||||
fx->input = fx->base;
|
||||
}
|
||||
|
||||
return cmdBufPos;
|
||||
}
|
||||
|
||||
#define INPUT_PARAM 0
|
||||
#define OUTPUT_PARAM 1
|
||||
#define FBCOEF_PARAM 2
|
||||
#define FFCOEF_PARAM 3
|
||||
#define GAIN_PARAM 4
|
||||
#define CHORUSRATE_PARAM 5
|
||||
#define CHORUSDEPTH_PARAM 6
|
||||
#define LPFILT_PARAM 7
|
||||
|
||||
// based on alFxParamHdl
|
||||
s32 au_fx_param_hdl(AuFX* fx, s16 index, s16 paramID, s32 value) {
|
||||
switch (paramID) {
|
||||
case INPUT_PARAM:
|
||||
|
@ -404,17 +437,20 @@ s32 au_fx_param_hdl(AuFX* fx, s16 index, s16 paramID, s32 value) {
|
|||
fx->delays[index].rsgain = ((f32)value / CONVERT) * (fx->delays[index].output - fx->delays[index].input);
|
||||
break;
|
||||
case LPFILT_PARAM:
|
||||
if (fx->delays[index].lowpass_20) {
|
||||
fx->delays[index].lowpass_20->fc = value;
|
||||
_init_lpfilter(fx->delays[index].lowpass_20);
|
||||
if (fx->delays[index].activeLowpass) {
|
||||
fx->delays[index].activeLowpass->fc = value;
|
||||
_init_lpfilter(fx->delays[index].activeLowpass);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: _n_loadBuffer
|
||||
static Acmd* _saveBuffer(AuFX* fx, s16* oldPos, s32 buf, s32 count, Acmd* cmdBufPos) {
|
||||
/**
|
||||
* Loads a possibly wrapped segment of the FX delay line into DMEM.
|
||||
* Used to prepare samples for resampling or filtering.
|
||||
*/
|
||||
static Acmd* _loadDelayLineBuffer(AuFX* fx, s16* oldPos, s32 buf, s32 count, Acmd* cmdBufPos) {
|
||||
Acmd *ptr = cmdBufPos;
|
||||
s16* newPos = oldPos + count;
|
||||
s16* delayEnd = &fx->base[fx->length];
|
||||
|
@ -433,11 +469,10 @@ static Acmd* _saveBuffer(AuFX* fx, s16* oldPos, s32 buf, s32 count, Acmd* cmdBuf
|
|||
|
||||
// updates rsval, producing a triangle wave between ±1
|
||||
// time delta specified in samples
|
||||
//TODO rename to _updateTriWaveModulation
|
||||
static f32 func_80059BD4(AuDelay* delay, s32 rsdelta) {
|
||||
static f32 updateTriangleModulation(AuDelay* delay, s32 numSamples) {
|
||||
f32 result;
|
||||
|
||||
delay->rsval += delay->rsinc * rsdelta;
|
||||
delay->rsval += delay->rsinc * numSamples;
|
||||
delay->rsval = (delay->rsval > 2.0) ? delay->rsval - 4.0 : delay->rsval;
|
||||
|
||||
result = delay->rsval;
|
||||
|
@ -445,7 +480,7 @@ static f32 func_80059BD4(AuDelay* delay, s32 rsdelta) {
|
|||
result = -result;
|
||||
}
|
||||
|
||||
result = result - 1.0;
|
||||
result -= 1.0;
|
||||
|
||||
return delay->rsgain * result;
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "nu/nualsgi.h"
|
||||
#include "audio/core.h"
|
||||
|
||||
static s16 _getVol(s16 arg0, s32 arg1, s16 arg2, u16 arg3);
|
||||
|
||||
BSS s16* AuDelayBufferMain;
|
||||
BSS s16* AuDelayBufferAux;
|
||||
BSS s32 AuDelayCounter;
|
||||
BSS u8 AuDelayedVoiceGroup;
|
||||
BSS u8 AuDelayedBusID;
|
||||
BSS s16 AuDelayedChannel;
|
||||
BSS s32 AuDelayCount;
|
||||
|
||||
AuSynDriver* gActiveSynDriverPtr = NULL;
|
||||
AuSynDriver* gSynDriverPtr = NULL;
|
||||
u8 AuUseGlobalVolume = FALSE;
|
||||
u16 AuGlobalVolume = 0x7FFF;
|
||||
u16 AuGlobalVolume = AU_MAX_VOLUME_16;
|
||||
u8 AuSynStereoDirty = FALSE;
|
||||
|
||||
extern s16 AuEqPower[128];
|
||||
|
@ -33,14 +33,14 @@ void au_driver_init(AuSynDriver* driver, ALConfig* config) {
|
|||
driver->num_pvoice = config->num_pvoice;
|
||||
driver->num_bus = config->num_bus;
|
||||
driver->curSamples = 0;
|
||||
driver->unk_04 = 0;
|
||||
driver->unused_04 = 0;
|
||||
driver->outputRate = config->outputRate;
|
||||
driver->dmaNew = config->dmaNew;
|
||||
|
||||
gActiveSynDriverPtr = driver;
|
||||
gSynDriverPtr = driver;
|
||||
AuUseGlobalVolume = FALSE;
|
||||
AuGlobalVolume = 0x7FFF;
|
||||
AuGlobalVolume = AU_MAX_VOLUME_16;
|
||||
AuSynStereoDirty = TRUE;
|
||||
|
||||
gSynDriverPtr->pvoices = alHeapAlloc(heap, config->num_pvoice, sizeof(*gSynDriverPtr->pvoices));
|
||||
|
@ -56,10 +56,10 @@ void au_driver_init(AuSynDriver* driver, ALConfig* config) {
|
|||
voice->decoder.memin = NULL;
|
||||
voice->resampler.state = alHeapAlloc(heap, 1, sizeof(*voice->resampler.state));
|
||||
voice->resampler.delta = 0;
|
||||
voice->resampler.first = 1;
|
||||
voice->resampler.first = TRUE;
|
||||
voice->resampler.ratio = 1.0f;
|
||||
voice->envMixer.state = alHeapAlloc(heap, 1, sizeof(*voice->envMixer.state));
|
||||
voice->envMixer.first = 1;
|
||||
voice->envMixer.dirty = TRUE;
|
||||
voice->envMixer.motion = AL_STOPPED;
|
||||
voice->envMixer.volume = 1;
|
||||
voice->envMixer.ltgt = 1;
|
||||
|
@ -75,9 +75,9 @@ void au_driver_init(AuSynDriver* driver, ALConfig* config) {
|
|||
voice->envMixer.delta = 0;
|
||||
voice->envMixer.segEnd = 0;
|
||||
voice->envMixer.pan = 64;
|
||||
voice->unk_74 = 0;
|
||||
voice->unused_74 = 0;
|
||||
voice->next = NULL;
|
||||
voice->busId = FX_BUS_BGMA_MAIN;
|
||||
voice->busID = FX_BUS_BGMA_MAIN;
|
||||
voice->index = i;
|
||||
}
|
||||
|
||||
|
@ -91,14 +91,14 @@ void au_driver_init(AuSynDriver* driver, ALConfig* config) {
|
|||
fxBus->curEffectType = AU_FX_NONE;
|
||||
fxBus->fxL = alHeapAlloc(heap, 1, sizeof(*fxBus->fxL));
|
||||
fxBus->fxR = alHeapAlloc(heap, 1, sizeof(*fxBus->fxR));
|
||||
func_80058E84(fxBus->fxL, fxBus->curEffectType, heap);
|
||||
func_80058E84(fxBus->fxR, fxBus->curEffectType, heap);
|
||||
au_fx_create(fxBus->fxL, fxBus->curEffectType, heap);
|
||||
au_fx_create(fxBus->fxR, fxBus->curEffectType, heap);
|
||||
}
|
||||
|
||||
gSynDriverPtr->savedMainOut = alHeapAlloc(heap, 2 * AUDIO_SAMPLES, 2);
|
||||
gSynDriverPtr->savedAuxOut = alHeapAlloc(heap, 2 * AUDIO_SAMPLES, 2);
|
||||
AuDelayedVoiceGroup = 0;
|
||||
AuDelayedChannel = 0;
|
||||
gSynDriverPtr->dryAccumBuffer = alHeapAlloc(heap, 2 * AUDIO_SAMPLES, 2);
|
||||
gSynDriverPtr->wetAccumBuffer = alHeapAlloc(heap, 2 * AUDIO_SAMPLES, 2);
|
||||
AuDelayedBusID = 0;
|
||||
AuDelayedChannel = AU_DELAY_CHANNEL_NONE;
|
||||
AuDelayCount = 4;
|
||||
|
||||
AuDelayBufferMain = alHeapAlloc(heap, 4 * AUDIO_SAMPLES, 2);
|
||||
|
@ -117,133 +117,155 @@ void au_driver_release(void) {
|
|||
}
|
||||
|
||||
Acmd* alAudioFrame(Acmd* cmdList, s32* cmdLen, s16* outBuf, s32 outLen) {
|
||||
Acmd* cmdListPos;
|
||||
Acmd* cmdListPos = cmdList;
|
||||
s16* bufPos = outBuf;
|
||||
AuPVoice* pvoice;
|
||||
AuFxBus* fxBus;
|
||||
|
||||
s16* bufPos;
|
||||
s16 auxOut;
|
||||
s16 mainOut;
|
||||
s16 auxOut;
|
||||
s32 busID;
|
||||
b32 firstBus;
|
||||
|
||||
s32 i;
|
||||
s32 first = FALSE;
|
||||
|
||||
cmdListPos = cmdList;
|
||||
bufPos = outBuf;
|
||||
// sanity check: ensure audio system is initialized
|
||||
if (gActiveSynDriverPtr == NULL) {
|
||||
*cmdLen = 0;
|
||||
} else {
|
||||
au_update_players_main();
|
||||
if (AuSynStereoDirty) {
|
||||
for (i = 0; i < gSynDriverPtr->num_pvoice; i++) {
|
||||
pvoice = &gSynDriverPtr->pvoices[i];
|
||||
if (pvoice->envMixer.motion == AL_PLAYING) {
|
||||
au_syn_set_pan(i, pvoice->envMixer.pan);
|
||||
}
|
||||
}
|
||||
AuSynStereoDirty = FALSE;
|
||||
}
|
||||
while (outLen > 0) {
|
||||
au_update_clients_2();
|
||||
for (i = 0; i < gSynDriverPtr->num_pvoice; i++) {
|
||||
pvoice = &gSynDriverPtr->pvoices[i];
|
||||
|
||||
if ((pvoice->busId != 0xFF) && (pvoice->busId < gSynDriverPtr->num_bus)) {
|
||||
fxBus = &gSynDriverPtr->fxBus[pvoice->busId];
|
||||
if (fxBus->tail != NULL) {
|
||||
fxBus->tail->next = pvoice;
|
||||
} else {
|
||||
fxBus->head = pvoice;
|
||||
}
|
||||
fxBus->tail = pvoice;
|
||||
}
|
||||
}
|
||||
first = TRUE;
|
||||
for (i = 0; i < gSynDriverPtr->num_bus; i++) {
|
||||
fxBus = &gSynDriverPtr->fxBus[i];
|
||||
if (fxBus->head != NULL) {
|
||||
// clear all main and aux outputs
|
||||
aClearBuffer(cmdListPos++, N_AL_MAIN_L_OUT, 8 * AUDIO_SAMPLES);
|
||||
if (fxBus->head != NULL) {
|
||||
AuPVoice* next;
|
||||
do {
|
||||
cmdListPos = au_pull_voice(fxBus->head, cmdListPos);
|
||||
next = fxBus->head->next;
|
||||
fxBus->head->next = NULL;
|
||||
fxBus->head = next;
|
||||
} while (next != NULL);
|
||||
fxBus->tail = NULL;
|
||||
}
|
||||
if (fxBus->curEffectType != AU_FX_NONE) {
|
||||
cmdListPos = au_pull_fx(fxBus->fxL, cmdListPos, N_AL_AUX_L_OUT, 0);
|
||||
cmdListPos = au_pull_fx(fxBus->fxR, cmdListPos, N_AL_AUX_R_OUT, 0);
|
||||
}
|
||||
|
||||
// apply channel delay
|
||||
if (i == AuDelayedVoiceGroup) {
|
||||
mainOut = -1;
|
||||
switch (AuDelayedChannel) {
|
||||
case 1:
|
||||
mainOut = N_AL_MAIN_L_OUT;
|
||||
auxOut = N_AL_AUX_L_OUT;
|
||||
break;
|
||||
case 2:
|
||||
mainOut = N_AL_MAIN_R_OUT;
|
||||
auxOut = N_AL_AUX_R_OUT;
|
||||
break;
|
||||
}
|
||||
if (mainOut != -1) {
|
||||
n_aSaveBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, mainOut, osVirtualToPhysical(AuDelayBufferMain + (AuDelayCounter % AuDelayCount) * AUDIO_SAMPLES));
|
||||
n_aLoadBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, mainOut, osVirtualToPhysical(AuDelayBufferMain + ((AuDelayCounter + 1) % AuDelayCount) * AUDIO_SAMPLES));
|
||||
n_aSaveBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, auxOut, osVirtualToPhysical(AuDelayBufferAux + (AuDelayCounter % AuDelayCount) * AUDIO_SAMPLES));
|
||||
n_aLoadBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, auxOut, osVirtualToPhysical(AuDelayBufferAux + ((AuDelayCounter + 1) % AuDelayCount) * AUDIO_SAMPLES));
|
||||
}
|
||||
}
|
||||
|
||||
// mix voice groups
|
||||
if (first) {
|
||||
aClearBuffer(cmdListPos++, 0, 4 * AUDIO_SAMPLES);
|
||||
} else {
|
||||
n_aLoadBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, 0, osVirtualToPhysical(gSynDriverPtr->savedAuxOut));
|
||||
}
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_AUX_L_OUT, 0);
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_AUX_R_OUT, 2 * AUDIO_SAMPLES);
|
||||
n_aSaveBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, 0, osVirtualToPhysical(gSynDriverPtr->savedAuxOut));
|
||||
if (first) {
|
||||
aClearBuffer(cmdListPos++, 0, 4 * AUDIO_SAMPLES);
|
||||
first = FALSE;
|
||||
} else {
|
||||
n_aLoadBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, 0, osVirtualToPhysical(gSynDriverPtr->savedMainOut));
|
||||
}
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_MAIN_L_OUT, 0);
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_MAIN_R_OUT, 2 * AUDIO_SAMPLES);
|
||||
n_aSaveBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, 0, osVirtualToPhysical(gSynDriverPtr->savedMainOut));
|
||||
}
|
||||
}
|
||||
|
||||
aDMEMMove(cmdListPos++, 0, N_AL_MAIN_L_OUT, 4 * AUDIO_SAMPLES);
|
||||
n_aLoadBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, N_AL_AUX_L_OUT, osVirtualToPhysical(gSynDriverPtr->savedAuxOut));
|
||||
aMix(cmdListPos++, 0, 0x7FFF, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(cmdListPos++, 0, 0x7FFF, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
|
||||
if (AuUseGlobalVolume) {
|
||||
u16 vol;
|
||||
aDMEMMove(cmdListPos++, N_AL_MAIN_L_OUT, 0, 4 * AUDIO_SAMPLES);
|
||||
aClearBuffer(cmdListPos++, N_AL_MAIN_L_OUT, 4 * AUDIO_SAMPLES);
|
||||
vol = AuGlobalVolume;
|
||||
aMix(cmdListPos++, 0, vol, 0, N_AL_MAIN_L_OUT);
|
||||
aMix(cmdListPos++, 0, vol, 2 * AUDIO_SAMPLES, N_AL_MAIN_R_OUT);
|
||||
}
|
||||
|
||||
outLen -= AUDIO_SAMPLES;
|
||||
n_aInterleave(cmdListPos++);
|
||||
n_aSaveBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, 0, bufPos);
|
||||
bufPos += 2 * AUDIO_SAMPLES;
|
||||
AuDelayCounter++;
|
||||
gSynDriverPtr->curSamples += AUDIO_SAMPLES;
|
||||
}
|
||||
*cmdLen = (cmdListPos - cmdList);
|
||||
return cmdListPos;
|
||||
}
|
||||
|
||||
au_update_clients_for_video_frame();
|
||||
|
||||
// reapply panning if dirty
|
||||
if (AuSynStereoDirty) {
|
||||
for (busID = 0; busID < gSynDriverPtr->num_pvoice; busID++) {
|
||||
pvoice = &gSynDriverPtr->pvoices[busID];
|
||||
if (pvoice->envMixer.motion == AL_PLAYING) {
|
||||
au_syn_set_pan(busID, pvoice->envMixer.pan);
|
||||
}
|
||||
}
|
||||
AuSynStereoDirty = FALSE;
|
||||
}
|
||||
|
||||
// process blocks of AUDIO_SAMPLES until outLen is consumed
|
||||
while (outLen > 0) {
|
||||
au_update_clients_for_audio_frame();
|
||||
|
||||
// organize all voices by which FX bus they send to
|
||||
for (busID = 0; busID < gSynDriverPtr->num_pvoice; busID++) {
|
||||
pvoice = &gSynDriverPtr->pvoices[busID];
|
||||
|
||||
if ((pvoice->busID != 0xFF) && (pvoice->busID < gSynDriverPtr->num_bus)) {
|
||||
fxBus = &gSynDriverPtr->fxBus[pvoice->busID];
|
||||
if (fxBus->tail != NULL) {
|
||||
fxBus->tail->next = pvoice;
|
||||
} else {
|
||||
fxBus->head = pvoice;
|
||||
}
|
||||
fxBus->tail = pvoice;
|
||||
}
|
||||
}
|
||||
|
||||
// render each effects bus
|
||||
firstBus = TRUE;
|
||||
for (busID = 0; busID < gSynDriverPtr->num_bus; busID++) {
|
||||
fxBus = &gSynDriverPtr->fxBus[busID];
|
||||
if (fxBus->head != NULL) {
|
||||
// clear all main and aux outputs (each is 2 * AUDIO_SAMPLES long, starting at N_AL_MAIN_L_OUT)
|
||||
aClearBuffer(cmdListPos++, N_AL_MAIN_L_OUT, 8 * AUDIO_SAMPLES);
|
||||
|
||||
// render all voices for this bus
|
||||
// these will implicitly accumulate dry to N_AL_MAIN_*_OUT and wet to N_AL_AUX_*_OUT
|
||||
if (fxBus->head != NULL) {
|
||||
AuPVoice* next;
|
||||
do {
|
||||
cmdListPos = au_pull_voice(fxBus->head, cmdListPos);
|
||||
next = fxBus->head->next;
|
||||
fxBus->head->next = NULL;
|
||||
fxBus->head = next;
|
||||
} while (next != NULL);
|
||||
fxBus->tail = NULL;
|
||||
}
|
||||
|
||||
// process fx for this bus
|
||||
if (fxBus->curEffectType != AU_FX_NONE) {
|
||||
cmdListPos = au_pull_fx(fxBus->fxL, cmdListPos, N_AL_AUX_L_OUT, N_AL_TEMP_0);
|
||||
cmdListPos = au_pull_fx(fxBus->fxR, cmdListPos, N_AL_AUX_R_OUT, N_AL_TEMP_0);
|
||||
}
|
||||
|
||||
// apply channel delay
|
||||
if (busID == AuDelayedBusID) {
|
||||
mainOut = -1;
|
||||
switch (AuDelayedChannel) {
|
||||
case AU_DELAY_CHANNEL_LEFT:
|
||||
mainOut = N_AL_MAIN_L_OUT;
|
||||
auxOut = N_AL_AUX_L_OUT;
|
||||
break;
|
||||
case AU_DELAY_CHANNEL_RIGHT:
|
||||
mainOut = N_AL_MAIN_R_OUT;
|
||||
auxOut = N_AL_AUX_R_OUT;
|
||||
break;
|
||||
}
|
||||
if (mainOut != -1) {
|
||||
n_aSaveBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, mainOut, osVirtualToPhysical(AuDelayBufferMain + (AuDelayCounter % AuDelayCount) * AUDIO_SAMPLES));
|
||||
n_aLoadBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, mainOut, osVirtualToPhysical(AuDelayBufferMain + ((AuDelayCounter + 1) % AuDelayCount) * AUDIO_SAMPLES));
|
||||
n_aSaveBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, auxOut, osVirtualToPhysical(AuDelayBufferAux + (AuDelayCounter % AuDelayCount) * AUDIO_SAMPLES));
|
||||
n_aLoadBuffer(cmdListPos++, 2 * AUDIO_SAMPLES, auxOut, osVirtualToPhysical(AuDelayBufferAux + ((AuDelayCounter + 1) % AuDelayCount) * AUDIO_SAMPLES));
|
||||
}
|
||||
}
|
||||
|
||||
// wet mix down for this bus
|
||||
if (firstBus) {
|
||||
// clear accumulation buffer if first bus with output
|
||||
aClearBuffer(cmdListPos++, N_AL_TEMP_0, 4 * AUDIO_SAMPLES);
|
||||
} else {
|
||||
// load accumulation buffer from DRAM
|
||||
n_aLoadBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, N_AL_TEMP_0, osVirtualToPhysical(gSynDriverPtr->wetAccumBuffer));
|
||||
}
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_AUX_L_OUT, N_AL_TEMP_0);
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_AUX_R_OUT, N_AL_TEMP_1);
|
||||
// save accumulation buffer to DRAM
|
||||
n_aSaveBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, N_AL_TEMP_0, osVirtualToPhysical(gSynDriverPtr->wetAccumBuffer));
|
||||
|
||||
// dry mix down for this bus
|
||||
if (firstBus) {
|
||||
// clear accumulation buffer if first bus with output
|
||||
aClearBuffer(cmdListPos++, N_AL_TEMP_0, 4 * AUDIO_SAMPLES);
|
||||
firstBus = FALSE;
|
||||
} else {
|
||||
// load accumulation buffer from DRAM
|
||||
n_aLoadBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, N_AL_TEMP_0, osVirtualToPhysical(gSynDriverPtr->dryAccumBuffer));
|
||||
}
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_MAIN_L_OUT, N_AL_TEMP_0);
|
||||
aMix(cmdListPos++, 0, fxBus->gain, N_AL_MAIN_R_OUT, N_AL_TEMP_1);
|
||||
// save accumulation buffer to DRAM
|
||||
n_aSaveBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, N_AL_TEMP_0, osVirtualToPhysical(gSynDriverPtr->dryAccumBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
// final output mix stage
|
||||
aDMEMMove(cmdListPos++, 0, N_AL_MAIN_L_OUT, 4 * AUDIO_SAMPLES);
|
||||
n_aLoadBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, N_AL_AUX_L_OUT, osVirtualToPhysical(gSynDriverPtr->wetAccumBuffer));
|
||||
aMix(cmdListPos++, 0, 0x7FFF, N_AL_AUX_L_OUT, N_AL_MAIN_L_OUT);
|
||||
aMix(cmdListPos++, 0, 0x7FFF, N_AL_AUX_R_OUT, N_AL_MAIN_R_OUT);
|
||||
|
||||
// global volume control (used to fade out during console reset)
|
||||
if (AuUseGlobalVolume) {
|
||||
u16 vol;
|
||||
aDMEMMove(cmdListPos++, N_AL_MAIN_L_OUT, 0, 4 * AUDIO_SAMPLES);
|
||||
aClearBuffer(cmdListPos++, N_AL_MAIN_L_OUT, 4 * AUDIO_SAMPLES);
|
||||
vol = AuGlobalVolume;
|
||||
aMix(cmdListPos++, 0, vol, 0, N_AL_MAIN_L_OUT);
|
||||
aMix(cmdListPos++, 0, vol, 2 * AUDIO_SAMPLES, N_AL_MAIN_R_OUT);
|
||||
}
|
||||
|
||||
outLen -= AUDIO_SAMPLES;
|
||||
n_aInterleave(cmdListPos++);
|
||||
n_aSaveBuffer(cmdListPos++, 4 * AUDIO_SAMPLES, 0, bufPos);
|
||||
bufPos += 2 * AUDIO_SAMPLES;
|
||||
AuDelayCounter++;
|
||||
gSynDriverPtr->curSamples += AUDIO_SAMPLES;
|
||||
}
|
||||
*cmdLen = (cmdListPos - cmdList);
|
||||
|
||||
return cmdListPos;
|
||||
}
|
||||
|
||||
|
@ -251,50 +273,50 @@ void au_use_global_volume(void) {
|
|||
AuUseGlobalVolume = TRUE;
|
||||
}
|
||||
|
||||
void au_set_global_volume(s16 arg0) {
|
||||
AuGlobalVolume = arg0;
|
||||
void au_set_global_volume(s16 volume) {
|
||||
AuGlobalVolume = volume;
|
||||
}
|
||||
|
||||
s16 au_get_global_volume(void) {
|
||||
return AuGlobalVolume;
|
||||
}
|
||||
|
||||
void func_80056D5C(u8 bStereoSound) {
|
||||
AuSynUseStereo = bStereoSound;
|
||||
void au_set_stereo_enabled(b8 enabled) {
|
||||
AuSynUseStereo = enabled;
|
||||
AuSynStereoDirty = TRUE;
|
||||
}
|
||||
|
||||
void au_bus_set_volume(u8 index, u16 arg1) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[index];
|
||||
void au_bus_set_volume(u8 busID, u16 value) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[busID];
|
||||
|
||||
fxBus->gain = arg1 & 0x7FFF;
|
||||
fxBus->gain = value & 0x7FFF;
|
||||
}
|
||||
|
||||
u16 au_bus_get_volume(u8 index, u16 arg1) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[index];
|
||||
u16 au_bus_get_volume(u8 busID) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[busID];
|
||||
|
||||
return fxBus->gain;
|
||||
}
|
||||
|
||||
void au_bus_set_effect(u8 index, u8 effectType) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[index];
|
||||
void au_bus_set_effect(u8 busID, u8 effectType) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[busID];
|
||||
|
||||
fxBus->curEffectType = effectType;
|
||||
func_8005904C(fxBus->fxL, effectType);
|
||||
func_8005904C(fxBus->fxR, effectType);
|
||||
au_fx_load_preset(fxBus->fxL, effectType);
|
||||
au_fx_load_preset(fxBus->fxR, effectType);
|
||||
}
|
||||
|
||||
void au_bus_set_fx_params(u8 index, s16 delayIndex, s16 paramID, s32 value) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[index];
|
||||
void au_bus_set_fx_params(u8 busID, s16 delayIndex, s16 paramID, s32 value) {
|
||||
AuFxBus* fxBus = &gSynDriverPtr->fxBus[busID];
|
||||
|
||||
au_fx_param_hdl(fxBus->fxL, delayIndex, paramID, value);
|
||||
au_fx_param_hdl(fxBus->fxR, delayIndex, paramID, value);
|
||||
}
|
||||
|
||||
void au_pvoice_set_bus(u8 index, s8 busId) {
|
||||
AuPVoice* pvoice = &gSynDriverPtr->pvoices[index];
|
||||
void au_pvoice_set_bus(u8 voiceIdx, s8 busID) {
|
||||
AuPVoice* pvoice = &gSynDriverPtr->pvoices[voiceIdx];
|
||||
|
||||
pvoice->busId = busId;
|
||||
pvoice->busID = busID;
|
||||
}
|
||||
|
||||
// based on n_alSynStopVoice
|
||||
|
@ -303,15 +325,15 @@ void au_syn_stop_voice(u8 voiceIdx) {
|
|||
AuLoadFilter* decoder = &pvoice->decoder;
|
||||
|
||||
pvoice->envMixer.motion = AL_STOPPED;
|
||||
pvoice->envMixer.first = 1;
|
||||
pvoice->envMixer.dirty = TRUE;
|
||||
pvoice->envMixer.volume = 1;
|
||||
pvoice->resampler.delta = 0;
|
||||
pvoice->resampler.first = 1;
|
||||
decoder->lastsam = 0;
|
||||
decoder->first = 1;
|
||||
decoder->first = TRUE;
|
||||
decoder->sample = 0;
|
||||
if (decoder->instrument != NULL) {
|
||||
decoder->memin = (s32)decoder->instrument->base;
|
||||
decoder->memin = (s32)decoder->instrument->wavData;
|
||||
if (decoder->instrument->type == AL_ADPCM_WAVE) {
|
||||
if (decoder->instrument->loopEnd != 0){
|
||||
decoder->loop.count = decoder->instrument->loopCount;
|
||||
|
@ -332,31 +354,31 @@ void au_syn_start_voice(u8 voiceIdx) {
|
|||
}
|
||||
|
||||
// based on n_alSynStartVoiceParams
|
||||
void au_syn_start_voice_params(u8 voiceIdx, u8 busId, Instrument* instrument, f32 pitch, s16 vol, u8 pan, u8 fxMix, s32 delta) {
|
||||
void au_syn_start_voice_params(u8 voiceIdx, u8 busID, Instrument* instrument, f32 pitchRatio, s16 vol, u8 pan, u8 fxMix, s32 delta) {
|
||||
AuPVoice* pvoice = &gSynDriverPtr->pvoices[voiceIdx];
|
||||
AuLoadFilter* decoder = &pvoice->decoder;
|
||||
AuEnvMixer* envMixer = &pvoice->envMixer;
|
||||
AuResampler* resampler = &pvoice->resampler;
|
||||
|
||||
pvoice->busId = busId;
|
||||
pvoice->busID = busID;
|
||||
decoder->instrument = instrument;
|
||||
|
||||
pvoice->decoder.memin = (s32)decoder->instrument->base;
|
||||
pvoice->decoder.memin = (s32)decoder->instrument->wavData;
|
||||
pvoice->decoder.sample = 0;
|
||||
|
||||
switch (decoder->instrument->type) {
|
||||
case AL_ADPCM_WAVE:
|
||||
decoder->instrument->wavDataLength = (decoder->instrument->wavDataLength / ADPCMFBYTES) * ADPCMFBYTES;
|
||||
pvoice->decoder.bookSize = decoder->instrument->dc_bookSize;
|
||||
if (decoder->instrument->loopEnd == 0) {
|
||||
decoder->loop.count = 0;
|
||||
decoder->loop.end = 0;
|
||||
decoder->loop.start = 0;
|
||||
} else {
|
||||
pvoice->decoder.bookSize = decoder->instrument->codebookSize;
|
||||
if (decoder->instrument->loopEnd != 0) {
|
||||
decoder->loop.start = decoder->instrument->loopStart;
|
||||
decoder->loop.end = decoder->instrument->loopEnd;
|
||||
decoder->loop.count = decoder->instrument->loopCount;
|
||||
alCopy(decoder->instrument->loopPredictor, decoder->lstate, sizeof(ADPCM_STATE));
|
||||
alCopy(decoder->instrument->loopState, decoder->lstate, sizeof(ADPCM_STATE));
|
||||
} else {
|
||||
decoder->loop.count = 0;
|
||||
decoder->loop.end = 0;
|
||||
decoder->loop.start = 0;
|
||||
}
|
||||
break;
|
||||
case AL_RAW16_WAVE:
|
||||
|
@ -373,7 +395,7 @@ void au_syn_start_voice_params(u8 voiceIdx, u8 busId, Instrument* instrument, f3
|
|||
}
|
||||
|
||||
envMixer->motion = AL_PLAYING;
|
||||
envMixer->first = 1;
|
||||
envMixer->dirty = TRUE;
|
||||
envMixer->delta = 0;
|
||||
envMixer->segEnd = delta;
|
||||
envMixer->pan = pan;
|
||||
|
@ -392,7 +414,7 @@ void au_syn_start_voice_params(u8 voiceIdx, u8 busId, Instrument* instrument, f3
|
|||
envMixer->cvolR = (envMixer->volume * AuEqPower[AU_EQPOW_MAX_IDX - envMixer->pan]) >> 0xF;
|
||||
}
|
||||
}
|
||||
resampler->ratio = pitch;
|
||||
resampler->ratio = pitchRatio;
|
||||
}
|
||||
|
||||
void au_syn_set_wavetable(u8 voiceIdx, Instrument* instrument) {
|
||||
|
@ -400,22 +422,22 @@ void au_syn_set_wavetable(u8 voiceIdx, Instrument* instrument) {
|
|||
AuLoadFilter* decoder = &pvoice->decoder;
|
||||
|
||||
pvoice->decoder.instrument = instrument;
|
||||
pvoice->decoder.memin = (s32)decoder->instrument->base;
|
||||
pvoice->decoder.memin = (s32)decoder->instrument->wavData;
|
||||
pvoice->decoder.sample = 0;
|
||||
|
||||
switch (decoder->instrument->type) {
|
||||
case AL_ADPCM_WAVE:
|
||||
decoder->instrument->wavDataLength = (decoder->instrument->wavDataLength / ADPCMFBYTES) * ADPCMFBYTES;
|
||||
pvoice->decoder.bookSize = decoder->instrument->dc_bookSize;
|
||||
if (decoder->instrument->loopEnd == 0) {
|
||||
pvoice->decoder.loop.count = 0;
|
||||
pvoice->decoder.loop.end = 0;
|
||||
pvoice->decoder.loop.start = 0;
|
||||
} else {
|
||||
pvoice->decoder.bookSize = decoder->instrument->codebookSize;
|
||||
if (decoder->instrument->loopEnd != 0) {
|
||||
pvoice->decoder.loop.start = decoder->instrument->loopStart;
|
||||
pvoice->decoder.loop.end = decoder->instrument->loopEnd;
|
||||
pvoice->decoder.loop.count = decoder->instrument->loopCount;
|
||||
alCopy(decoder->instrument->loopPredictor, pvoice->decoder.lstate, sizeof(ADPCM_STATE));
|
||||
alCopy(decoder->instrument->loopState, pvoice->decoder.lstate, sizeof(ADPCM_STATE));
|
||||
} else {
|
||||
pvoice->decoder.loop.count = 0;
|
||||
pvoice->decoder.loop.end = 0;
|
||||
pvoice->decoder.loop.start = 0;
|
||||
}
|
||||
break;
|
||||
case AL_RAW16_WAVE:
|
||||
|
@ -469,7 +491,7 @@ void au_syn_set_mixer_params(u8 voiceIdx, s16 volume, s32 delta, u8 pan, u8 fxMi
|
|||
envMixer->volume = SQ(volume) >> 0xF;
|
||||
envMixer->dryamt = AuEqPower[fxMix];
|
||||
envMixer->wetamt = AuEqPower[AU_EQPOW_MAX_IDX - fxMix];
|
||||
envMixer->first = 1;
|
||||
envMixer->dirty = TRUE;
|
||||
}
|
||||
|
||||
void au_syn_set_pan_fxmix(u8 voiceIdx, u8 pan, u8 fxMix) {
|
||||
|
@ -499,7 +521,7 @@ void au_syn_set_pan_fxmix(u8 voiceIdx, u8 pan, u8 fxMix) {
|
|||
envMixer->pan = pan;
|
||||
envMixer->dryamt = AuEqPower[fxMix];
|
||||
envMixer->wetamt = AuEqPower[AU_EQPOW_MAX_IDX - fxMix];
|
||||
envMixer->first = 1;
|
||||
envMixer->dirty = TRUE;
|
||||
}
|
||||
|
||||
void au_syn_set_volume_delta(u8 voiceIdx, s16 vol, s32 delta) {
|
||||
|
@ -529,7 +551,7 @@ void au_syn_set_volume_delta(u8 voiceIdx, s16 vol, s32 delta) {
|
|||
envMixer->volume = SQ(vol) >> 0xF;
|
||||
envMixer->delta = 0;
|
||||
envMixer->segEnd = delta;
|
||||
envMixer->first = 1;
|
||||
envMixer->dirty = TRUE;
|
||||
}
|
||||
|
||||
void au_syn_set_pan(u8 voiceIdx, u8 pan) {
|
||||
|
@ -557,7 +579,7 @@ void au_syn_set_pan(u8 voiceIdx, u8 pan) {
|
|||
}
|
||||
|
||||
envMixer->pan = pan;
|
||||
envMixer->first = 1;
|
||||
envMixer->dirty = TRUE;
|
||||
}
|
||||
|
||||
void au_syn_set_fxmix(u8 voiceIdx, u8 fxMix) {
|
||||
|
@ -586,7 +608,7 @@ void au_syn_set_fxmix(u8 voiceIdx, u8 fxMix) {
|
|||
|
||||
envMixer->dryamt = AuEqPower[fxMix];
|
||||
envMixer->wetamt = AuEqPower[AU_EQPOW_MAX_IDX - fxMix];
|
||||
envMixer->first = 1;
|
||||
envMixer->dirty = TRUE;
|
||||
}
|
||||
|
||||
s32 au_syn_get_playing(u8 voiceIdx) {
|
||||
|
@ -598,7 +620,7 @@ s32 au_syn_get_playing(u8 voiceIdx) {
|
|||
s32 au_syn_get_bus(u8 voiceIdx) {
|
||||
AuPVoice* pvoice = &gSynDriverPtr->pvoices[voiceIdx];
|
||||
|
||||
return pvoice->busId;
|
||||
return pvoice->busID;
|
||||
}
|
||||
|
||||
f32 au_syn_get_pitch(u8 voiceIdx) {
|
||||
|
@ -659,66 +681,66 @@ s32 au_syn_get_volume_right(u8 voiceIdx) {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
void au_set_delay_time(s32 arg0) {
|
||||
if (arg0 < 2) {
|
||||
void au_set_delay_time(s32 numFrames) {
|
||||
if (numFrames < 2) {
|
||||
AuDelayCount = 0;
|
||||
AuDelayedChannel = 0;
|
||||
AuDelayedChannel = AU_DELAY_CHANNEL_NONE;
|
||||
}
|
||||
|
||||
AuDelayCount = arg0;
|
||||
if (arg0 > 4) {
|
||||
AuDelayCount = numFrames;
|
||||
if (numFrames > 4) {
|
||||
AuDelayCount = 4;
|
||||
}
|
||||
}
|
||||
|
||||
void au_delay_left_channel(u8 groupIdx) {
|
||||
s32* phi_a1 = (s32*)AuDelayBufferMain;
|
||||
s32* phi_v1 = (s32*)AuDelayBufferAux;
|
||||
void au_delay_left_channel(u8 busID) {
|
||||
s32* mainBuf = (s32*)AuDelayBufferMain;
|
||||
s32* auxBuf = (s32*)AuDelayBufferAux;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 2 * AUDIO_SAMPLES; i++) {
|
||||
*phi_a1++ = 0;
|
||||
*phi_v1++ = 0;
|
||||
*mainBuf++ = 0;
|
||||
*auxBuf++ = 0;
|
||||
}
|
||||
|
||||
AuDelayedVoiceGroup = groupIdx;
|
||||
AuDelayedChannel = 1;
|
||||
AuDelayedBusID = busID;
|
||||
AuDelayedChannel = AU_DELAY_CHANNEL_LEFT;
|
||||
AuDelayCounter = 0;
|
||||
}
|
||||
|
||||
void au_delay_right_channel(u8 groupIdx) {
|
||||
s32* phi_a1 = (s32*)AuDelayBufferMain;
|
||||
s32* phi_v1 = (s32*)AuDelayBufferAux;
|
||||
void au_delay_right_channel(u8 busID) {
|
||||
s32* mainBuf = (s32*)AuDelayBufferMain;
|
||||
s32* auxBuf = (s32*)AuDelayBufferAux;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 2 * AUDIO_SAMPLES; i++) {
|
||||
*phi_a1++ = 0;
|
||||
*phi_v1++ = 0;
|
||||
*mainBuf++ = 0;
|
||||
*auxBuf++ = 0;
|
||||
}
|
||||
|
||||
AuDelayedVoiceGroup = groupIdx;
|
||||
AuDelayedChannel = 2;
|
||||
AuDelayedBusID = busID;
|
||||
AuDelayedChannel = AU_DELAY_CHANNEL_RIGHT;
|
||||
AuDelayCounter = 0;
|
||||
}
|
||||
|
||||
void au_disable_channel_delay(void) {
|
||||
AuDelayedVoiceGroup = 0;
|
||||
AuDelayedChannel = 0;
|
||||
AuDelayedBusID = 0;
|
||||
AuDelayedChannel = AU_DELAY_CHANNEL_NONE;
|
||||
AuDelayCounter = 0;
|
||||
}
|
||||
|
||||
void au_delay_channel(s16 arg0) {
|
||||
s32* phi_a1 = (s32*)AuDelayBufferMain;
|
||||
s32* phi_v1 = (s32*)AuDelayBufferAux;
|
||||
void au_init_delay_channel(s16 channel) {
|
||||
s32* mainBuf = (s32*)AuDelayBufferMain;
|
||||
s32* auxBuf = (s32*)AuDelayBufferAux;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 2 * AUDIO_SAMPLES; i++) {
|
||||
*phi_a1++ = 0;
|
||||
*phi_v1++ = 0;
|
||||
*mainBuf++ = 0;
|
||||
*auxBuf++ = 0;
|
||||
}
|
||||
|
||||
AuDelayedVoiceGroup = 0;
|
||||
AuDelayedChannel = arg0;
|
||||
AuDelayedBusID = 0;
|
||||
AuDelayedChannel = channel;
|
||||
AuDelayCounter = 0;
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
#include "common.h"
|
||||
#include "nu/nusys.h"
|
||||
#include "nu/nualsgi.h"
|
||||
#include "audio.h"
|
||||
#include "audio/core.h"
|
||||
|
||||
NOP_FIX
|
||||
|
||||
|
@ -50,10 +48,10 @@ void create_audio_system(void) {
|
|||
alHeapInit(&nuAuHeap, AuHeapBase, AUDIO_HEAP_SIZE);
|
||||
config.num_pvoice = 24;
|
||||
config.num_bus = 4;
|
||||
outputRate = osAiSetFrequency(32000);
|
||||
frameSize = (nusched.retraceCount * outputRate + (AUDIO_FRAMES_PER_SECOND - 1)) / AUDIO_FRAMES_PER_SECOND;
|
||||
outputRate = osAiSetFrequency(HARDWARE_OUTPUT_RATE);
|
||||
frameSize = (nusched.retraceCount * outputRate + (VIDEO_FRAMES_PER_SECOND - 1)) / VIDEO_FRAMES_PER_SECOND;
|
||||
config.outputRate = outputRate;
|
||||
config.unk_0C = 0;
|
||||
config.unused_0C = 0;
|
||||
config.heap = &nuAuHeap;
|
||||
config.dmaNew = nuAuDmaNew;
|
||||
AlFrameSize = ((frameSize / AUDIO_SAMPLES) + 1) * AUDIO_SAMPLES;
|
||||
|
@ -100,7 +98,7 @@ void create_audio_system(void) {
|
|||
nuAuPreNMIFunc = nuAuPreNMIProc;
|
||||
au_driver_init(&auSynDriver, &config);
|
||||
au_engine_init(config.outputRate);
|
||||
osCreateThread(&nuAuMgrThread, NU_MAIN_THREAD_ID, nuAuMgr, NULL, &AuStack[NU_AU_STACK_SIZE / sizeof(u64)], NU_AU_MGR_THREAD_PRI); //why main thread?
|
||||
osCreateThread(&nuAuMgrThread, THREAD_ID_AUDIO, nuAuMgr, NULL, &AuStack[NU_AU_STACK_SIZE / sizeof(u64)], NU_AU_MGR_THREAD_PRI);
|
||||
osStartThread(&nuAuMgrThread);
|
||||
}
|
||||
|
||||
|
@ -190,7 +188,8 @@ void nuAuMgr(void* arg) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 arg3) {
|
||||
/// DMA callback for audio sample streaming; manages a DMA buffer cache.
|
||||
s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 useDma) {
|
||||
NUDMABuffer* dmaPtr;
|
||||
NUDMABuffer* freeBuffer;
|
||||
OSIoMesg* mesg;
|
||||
|
@ -199,7 +198,7 @@ s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 arg3) {
|
|||
s32 addrEnd, buffEnd;
|
||||
NUDMABuffer* lastDmaPtr;
|
||||
|
||||
if (arg3 == 0) {
|
||||
if (!useDma) {
|
||||
return osVirtualToPhysical((void*)addr);
|
||||
}
|
||||
|
||||
|
@ -259,6 +258,8 @@ s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 arg3) {
|
|||
return osVirtualToPhysical(freeBuffer) + delta;
|
||||
}
|
||||
|
||||
/// Initializes the audio DMA state and returns the DMA callback.
|
||||
/// Called once per AuPVoice initialization in au_driver_init to assign callbacks to them.
|
||||
ALDMAproc nuAuDmaNew(NUDMAState** state) {
|
||||
if (!nuAuDmaState.initialized) {
|
||||
nuAuDmaState.firstFree = &nuAuDmaBufList[0];
|
||||
|
@ -271,6 +272,7 @@ ALDMAproc nuAuDmaNew(NUDMAState** state) {
|
|||
return (ALDMAproc)nuAuDmaCallBack;
|
||||
}
|
||||
|
||||
/// Recycles DMA buffers which are no longer in use (based on frame count).
|
||||
void nuAuCleanDMABuffers(void) {
|
||||
NUDMAState* state = &nuAuDmaState;
|
||||
NUDMABuffer* dmaPtr = state->firstUsed;
|
||||
|
@ -291,12 +293,12 @@ void nuAuCleanDMABuffers(void) {
|
|||
|
||||
alUnlink(&dmaPtr->node);
|
||||
|
||||
if (state->firstFree != 0) {
|
||||
if (state->firstFree != NULL) {
|
||||
alLink(&dmaPtr->node, &state->firstFree->node);
|
||||
} else {
|
||||
state->firstFree = dmaPtr;
|
||||
dmaPtr->node.next = 0;
|
||||
dmaPtr->node.prev = 0;
|
||||
dmaPtr->node.next = NULL;
|
||||
dmaPtr->node.prev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,6 +311,7 @@ void nuAuCleanDMABuffers(void) {
|
|||
} while (0);
|
||||
}
|
||||
|
||||
/// Handles global audio fade-out during system resets (NMI).
|
||||
void nuAuPreNMIProc(NUScMsg mesg_type, u32 frameCounter) {
|
||||
s16 maxVol;
|
||||
s32 vol;
|
||||
|
@ -336,6 +339,7 @@ void nuAuPreNMIProc(NUScMsg mesg_type, u32 frameCounter) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Links a new element into a doubly-linked list.
|
||||
void alLink(ALLink* element, ALLink* after) {
|
||||
element->next = after->next;
|
||||
element->prev = after;
|
||||
|
@ -346,6 +350,7 @@ void alLink(ALLink* element, ALLink* after) {
|
|||
after->next = element;
|
||||
}
|
||||
|
||||
/// Unlinks a list element from a doubly-linked list.
|
||||
void alUnlink(ALLink* element) {
|
||||
if (element->next != NULL) {
|
||||
element->next->prev = element->prev;
|
|
@ -1,5 +1,7 @@
|
|||
#include "common.h"
|
||||
|
||||
// none of these are used
|
||||
|
||||
f32 D_80078F60[] = {
|
||||
-1.0, 0.0, 3.850119e-06, 6.102301e-06, 7.700253e-06, 8.939723e-06, 9.952444e-06, 1.080869e-05,
|
||||
1.155040e-05, 1.220464e-05, 1.278988e-05, 1.331929e-05, 1.380260e-05, 1.424721e-05, 1.465885e-05, 1.504208e-05,
|
|
@ -0,0 +1,260 @@
|
|||
#include "audio.h"
|
||||
#include "audio/core.h"
|
||||
|
||||
void au_flush_finished_voices(AuGlobals* globals) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globals->voices); i++) {
|
||||
AuVoice* voice = &globals->voices[i];
|
||||
|
||||
if (voice->donePending) {
|
||||
au_syn_stop_voice(i);
|
||||
voice->donePending = FALSE;
|
||||
voice->cmdPtr = NULL;
|
||||
voice->priority = AU_PRIORITY_FREE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void au_init_voices(AuGlobals* globals) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globals->voices); i++) {
|
||||
AuVoice* voice = &globals->voices[i];
|
||||
|
||||
voice->cmdPtr = NULL;
|
||||
voice->unused_20 = 0;
|
||||
voice->envDuration = 0;
|
||||
voice->envTimeLeft = 0;
|
||||
voice->envIntervalIndex = 0;
|
||||
voice->unused_3C = 0;
|
||||
voice->envelopeFlags = 0;
|
||||
voice->isRelativeRelease = FALSE;
|
||||
voice->envRelativeStart = ENV_VOL_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
void au_update_voices(AuGlobals* globals) {
|
||||
AuVoice* voice;
|
||||
s16 current;
|
||||
s8 temp;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globals->voices); i++) {
|
||||
voice = &globals->voices[i];
|
||||
|
||||
// skip inactive voices
|
||||
if (voice->cmdPtr == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE) {
|
||||
// client volume changed on previous frame
|
||||
au_voice_after_volume_change(voice);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_KEY_RELEASED) {
|
||||
// client released the key
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_KEY_RELEASED;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_RELEASING;
|
||||
voice->cmdPtr = (u8*)voice->envelope.cmdListRelease;
|
||||
|
||||
// the key can be released before the press envelope is complete
|
||||
if (voice->envTimeLeft > AU_FRAME_USEC) {
|
||||
// get interpolated "current" value
|
||||
voice->envInitial += (s32) (voice->envDelta * (f32) (voice->envDuration - voice->envTimeLeft));
|
||||
} else {
|
||||
voice->envInitial = voice->envTarget;
|
||||
}
|
||||
|
||||
// read the first interval of the release envelope
|
||||
voice->envIntervalIndex = *voice->cmdPtr++;
|
||||
temp = *voice->cmdPtr;
|
||||
if (*(s8*)voice->cmdPtr++ < 0) {
|
||||
// in this case release volumes are relative to last press volume
|
||||
temp &= 0x7F;
|
||||
voice->isRelativeRelease = TRUE;
|
||||
voice->envRelativeStart = voice->envInitial;
|
||||
}
|
||||
voice->envTarget = temp;
|
||||
voice->envTimeLeft = AuEnvelopeIntervals[voice->envIntervalIndex];
|
||||
voice->envDuration = voice->envTimeLeft;
|
||||
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
if (voice->envTimeLeft > AU_FRAME_USEC) {
|
||||
voice->envTimeLeft -= AU_FRAME_USEC;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
current = voice->envInitial + (s32) (voice->envDelta * (voice->envDuration - voice->envTimeLeft));
|
||||
} else {
|
||||
current = voice->envTarget;
|
||||
}
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
} else {
|
||||
voice->delta = au_voice_get_delta(voice->envDuration);
|
||||
current = voice->envTarget;
|
||||
}
|
||||
voice->volume = VOL_MULT_4(current, voice->clientVolume, voice->envRelativeStart, voice->envScale);
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
} else {
|
||||
if (voice->envTimeLeft == -1) {
|
||||
// keep current volume, this is 'sustain' phase
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
voice->volume = VOL_MULT_4(voice->envInitial, voice->clientVolume, voice->envRelativeStart, voice->envScale);
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
} else {
|
||||
voice->envTimeLeft -= AU_FRAME_USEC;
|
||||
if (voice->envTimeLeft <= 0) {
|
||||
if (*voice->cmdPtr == ENV_CMD_END) {
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_RELEASING) {
|
||||
// if we reached the end after key release, stop the voice completely
|
||||
voice->envelopeFlags = 0;
|
||||
voice->cmdPtr = NULL;
|
||||
voice->donePending = TRUE;
|
||||
} else {
|
||||
// we reached the end of press cmdlist, keep the last volume until the key is released
|
||||
voice->envTimeLeft = -1;
|
||||
voice->envDuration = -1;
|
||||
voice->envIntervalIndex = ENV_TIME_300MS; // doesn't seem to affect anything
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
voice->envDelta = 0.0f;
|
||||
voice->envInitial = voice->envTarget;
|
||||
}
|
||||
} else {
|
||||
// get next envelope point
|
||||
voice->envIntervalIndex = au_voice_step(voice);
|
||||
voice->envInitial = voice->envTarget;
|
||||
voice->envTarget = (*voice->cmdPtr++) & 0x7F;
|
||||
voice->envTimeLeft = AuEnvelopeIntervals[voice->envIntervalIndex];
|
||||
voice->envDuration = voice->envTimeLeft;
|
||||
if (voice->envDuration != 0) {
|
||||
voice->envDelta = ((f32) voice->envTarget - (f32) voice->envInitial) / (f32) voice->envDuration;
|
||||
} else {
|
||||
voice->envDelta = 0.0f;
|
||||
}
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
if (voice->envTimeLeft > AU_FRAME_USEC) {
|
||||
voice->envTimeLeft -= AU_FRAME_USEC;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
current = voice->envInitial + (s32) (voice->envDelta * (voice->envDuration - voice->envTimeLeft));
|
||||
} else {
|
||||
current = voice->envTarget;
|
||||
}
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
} else {
|
||||
voice->delta = au_voice_get_delta(voice->envDuration);
|
||||
current = voice->envTarget;
|
||||
}
|
||||
voice->volume = VOL_MULT_4(current, voice->clientVolume, voice->envRelativeStart, voice->envScale);
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
} else {
|
||||
// we are between two envelope points, do nothing, just handle client volume change
|
||||
if (voice->envelopeFlags & AU_VOICE_ENV_FLAG_VOL_CHANGED) {
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
if (voice->envTimeLeft > AU_FRAME_USEC) {
|
||||
voice->envTimeLeft -= AU_FRAME_USEC;
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
current = voice->envInitial + (s32) (voice->envDelta * (voice->envDuration - voice->envTimeLeft));
|
||||
} else {
|
||||
current = voice->envTarget;
|
||||
}
|
||||
voice->delta = AUDIO_SAMPLES;
|
||||
voice->volume = VOL_MULT_4(current, voice->clientVolume, voice->envRelativeStart, voice->envScale);
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void au_voice_after_volume_change(AuVoice* voice) {
|
||||
voice->volume = VOL_MULT_4(voice->envTarget, voice->clientVolume, voice->envRelativeStart, voice->envScale);
|
||||
voice->delta = au_voice_get_delta(voice->envTimeLeft);
|
||||
voice->envelopeFlags &= ~AU_VOICE_ENV_FLAG_HANDLED_VOL_CHANGE;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PARAMS;
|
||||
}
|
||||
|
||||
s32 au_voice_get_delta(s32 usecs) {
|
||||
return (usecs / AU_FRAME_USEC) * AUDIO_SAMPLES;
|
||||
}
|
||||
|
||||
void au_voice_start(AuVoice* voice, EnvelopeData* envData) {
|
||||
s32 intervalIndex;
|
||||
|
||||
voice->envelope.cmdListPress = envData->cmdListPress;
|
||||
voice->cmdPtr = voice->envelope.cmdListPress;
|
||||
voice->envelope.cmdListRelease = envData->cmdListRelease;
|
||||
voice->envScale = ENV_VOL_MAX;
|
||||
voice->loopStart = NULL;
|
||||
|
||||
intervalIndex = au_voice_step(voice);
|
||||
voice->envelopeFlags = 0;
|
||||
voice->envInitial = 0;
|
||||
voice->envTarget = *voice->cmdPtr++;
|
||||
voice->envIntervalIndex = intervalIndex;
|
||||
voice->envDuration = AuEnvelopeIntervals[intervalIndex];
|
||||
voice->envTimeLeft = voice->envDuration;
|
||||
|
||||
voice->volume = VOL_MULT_3(voice->envTarget, voice->clientVolume, voice->envScale);
|
||||
voice->delta = au_voice_get_delta(voice->envDuration);
|
||||
if (voice->envDuration != 0) {
|
||||
voice->envDelta = ((f32) voice->envTarget - (f32) voice->envInitial) / voice->envDuration;
|
||||
} else {
|
||||
voice->envDelta = 0.0f;
|
||||
}
|
||||
voice->isRelativeRelease = FALSE;
|
||||
voice->envRelativeStart = ENV_VOL_MAX;
|
||||
}
|
||||
|
||||
u8 au_voice_step(AuVoice* voice) {
|
||||
u32 op;
|
||||
u8 arg;
|
||||
|
||||
while (TRUE) {
|
||||
if ((s8)(op = *voice->cmdPtr++) >= 0) {
|
||||
break;
|
||||
}
|
||||
switch ((u8)op) {
|
||||
case ENV_CMD_SET_SCALE:
|
||||
arg = *voice->cmdPtr++;
|
||||
if (arg > ENV_VOL_MAX) {
|
||||
arg = ENV_VOL_MAX;
|
||||
}
|
||||
voice->envScale = arg;
|
||||
break;
|
||||
case ENV_CMD_ADD_SCALE:
|
||||
voice->envScale += (s8) *voice->cmdPtr++;
|
||||
if (voice->envScale > ENV_VOL_MAX) {
|
||||
voice->envScale = ENV_VOL_MAX;
|
||||
} else if (voice->envScale < 0) {
|
||||
voice->envScale = 0;
|
||||
}
|
||||
break;
|
||||
case ENV_CMD_START_LOOP:
|
||||
voice->loopCounter = *voice->cmdPtr++; // 0 = infinite loop
|
||||
voice->loopStart = voice->cmdPtr;
|
||||
break;
|
||||
case ENV_CMD_END_LOOP:
|
||||
voice->cmdPtr++;
|
||||
if (voice->loopCounter == 0 || --voice->loopCounter != 0) {
|
||||
voice->cmdPtr = voice->loopStart;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// unknown command, skip argument
|
||||
voice->cmdPtr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return op;
|
||||
}
|
||||
|
||||
void au_voice_set_vol_changed(AuVoice* voice) {
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
}
|
|
@ -1,433 +0,0 @@
|
|||
#include "common.h"
|
||||
#include "npc.h"
|
||||
|
||||
void bgm_update_volume(void);
|
||||
void bgm_set_target_volume(s16 volume);
|
||||
|
||||
BSS s16 MusicDefaultVolume;
|
||||
BSS s16 MusicTargetVolume;
|
||||
BSS s16 MusicMaxVolume;
|
||||
BSS s16 MusicCurrentVolume;
|
||||
|
||||
MusicSettings gMusicSettings[2];
|
||||
|
||||
MusicSettings BlankMusicSettings = {
|
||||
.flags = 0,
|
||||
.state = 0,
|
||||
.fadeOutTime = -1,
|
||||
.fadeInTime = 0,
|
||||
.fadeStartVolume = 0,
|
||||
.fadeEndVolume = 0,
|
||||
.songID = -1,
|
||||
.variation = -1,
|
||||
.songName = -1,
|
||||
.battleSongID = 0,
|
||||
.battleVariation = 0,
|
||||
.savedSongID = 0,
|
||||
.savedVariation = 0,
|
||||
.savedSongName = 0
|
||||
};
|
||||
|
||||
/// Lists the songs that are forced to use the variation determined by `map.songVariation & 1`.
|
||||
/// @see bgm_get_map_default_variation
|
||||
s32 SongsUsingVariationFlag[] = {
|
||||
SONG_SPECIAL_BATTLE,
|
||||
SONG_TUBBA_BLUBBA_BATTLE,
|
||||
SONG_JR_TROOPA_BATTLE,
|
||||
SONG_YOSHI_KIDS_FOUND,
|
||||
SONG_ITEM_UPGRADE,
|
||||
SONG_NEW_PARTNER,
|
||||
};
|
||||
|
||||
s16 NextVolumeUpdateTimer = 0;
|
||||
|
||||
/// If the given song ID is present in SongsUsingVariationFlag, returns the current
|
||||
/// map's `songVariation & 1` value. Otherwise, returns -1.
|
||||
///
|
||||
/// @see SongsUsingVariationFlag
|
||||
/// @returns -1: no override; 0: override to variation 0; 1 override to variation 1
|
||||
s32 bgm_get_map_default_variation(s32 songID) {
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(SongsUsingVariationFlag); i++) {
|
||||
if (SongsUsingVariationFlag[i] == songID) {
|
||||
MapConfig* map = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID];
|
||||
|
||||
return map->songVariation & 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void bgm_reset_sequence_players(void) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gMusicSettings); i++) {
|
||||
gMusicSettings[i] = BlankMusicSettings;
|
||||
}
|
||||
|
||||
MusicTargetVolume = 8;
|
||||
MusicMaxVolume = 8;
|
||||
MusicCurrentVolume = 8;
|
||||
func_800561A4(8);
|
||||
}
|
||||
|
||||
void bgm_reset_volume(void) {
|
||||
MusicTargetVolume = 8;
|
||||
MusicMaxVolume = 8;
|
||||
}
|
||||
|
||||
//TODO refactor out constants
|
||||
void bgm_update_music_settings(void) {
|
||||
MusicSettings* music = gMusicSettings;
|
||||
s32 i = 0;
|
||||
s16 state2 = 2;
|
||||
s16 flag4 = MUSIC_SETTINGS_FLAG_4;
|
||||
s32 flags;
|
||||
|
||||
for (i; i < ARRAY_COUNT(gMusicSettings); i++, music++) {
|
||||
switch (music->state) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
if (music->flags & MUSIC_SETTINGS_FLAG_1) {
|
||||
if (music->fadeOutTime < 250) {
|
||||
if (!(music->flags & MUSIC_SETTINGS_FLAG_4)) {
|
||||
if (au_song_stop(music->songName) == AU_RESULT_OK) {
|
||||
music->state = state2;
|
||||
}
|
||||
} else {
|
||||
if (func_80055AF0(music->songName) == AU_RESULT_OK) {
|
||||
music->state = state2;
|
||||
}
|
||||
}
|
||||
} else if (!(music->flags & MUSIC_SETTINGS_FLAG_4)) {
|
||||
if (snd_set_song_variation_fade_time(music->songName, music->fadeOutTime, 0) == 0) {
|
||||
music->state = state2;
|
||||
}
|
||||
} else {
|
||||
if (func_80055BB8(music->songName, 250) == AU_RESULT_OK) {
|
||||
music->state = state2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (music->flags & MUSIC_SETTINGS_FLAG_4) {
|
||||
music->flags |= MUSIC_SETTINGS_FLAG_10;
|
||||
}
|
||||
music->flags &= ~flag4;
|
||||
music->state = 5;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
flags = music->flags;
|
||||
music->flags &= ~flag4;
|
||||
if (flags & MUSIC_SETTINGS_FLAG_1) {
|
||||
if (au_song_is_playing(music->songName) == AU_RESULT_OK) {
|
||||
music->flags &= ~MUSIC_SETTINGS_FLAG_1;
|
||||
music->state = 3;
|
||||
}
|
||||
} else {
|
||||
music->state = 5;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
music->state = 4;
|
||||
break;
|
||||
case 4:
|
||||
music->state = 5;
|
||||
break;
|
||||
case 5:
|
||||
if (!(music->flags & MUSIC_SETTINGS_FLAG_8)) {
|
||||
if (music->songID < 0) {
|
||||
music->state = 0;
|
||||
} else {
|
||||
music->songName = au_song_load(music->songID, i);
|
||||
if (music->songName > 0xFFFFU) {
|
||||
if ((music->flags & MUSIC_SETTINGS_FLAG_20)) {
|
||||
snd_set_song_variation_fade(music->songName, music->variation,
|
||||
music->fadeInTime, music->fadeStartVolume, music->fadeEndVolume);
|
||||
music->flags &= ~MUSIC_SETTINGS_FLAG_20;
|
||||
} else {
|
||||
bgm_set_target_volume(MusicDefaultVolume);
|
||||
}
|
||||
if (au_song_start_variation(music->songName, music->variation) == 0) {
|
||||
music->flags |= MUSIC_SETTINGS_FLAG_1;
|
||||
music->state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (music->flags & MUSIC_SETTINGS_FLAG_10) {
|
||||
music->state = 0;
|
||||
music->flags &= ~(MUSIC_SETTINGS_FLAG_10 | MUSIC_SETTINGS_FLAG_8);
|
||||
} else if (func_80055B28(music->savedSongName) == 0) {
|
||||
music->songID = music->savedSongID;
|
||||
music->variation = music->savedVariation;
|
||||
music->songName = music->savedSongName;
|
||||
music->state = 0;
|
||||
music->flags |= MUSIC_SETTINGS_FLAG_1;
|
||||
music->flags &= ~MUSIC_SETTINGS_FLAG_8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
bgm_update_volume();
|
||||
}
|
||||
|
||||
s32 _bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume) {
|
||||
MusicSettings* musicSetting;
|
||||
s32 mapSongVariation;
|
||||
|
||||
if (gGameStatusPtr->demoState != DEMO_STATE_NONE) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
musicSetting = &gMusicSettings[playerIndex];
|
||||
|
||||
if (!gGameStatusPtr->musicEnabled) {
|
||||
au_song_stop(musicSetting->songName);
|
||||
musicSetting->flags &= ~MUSIC_SETTINGS_FLAG_1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
mapSongVariation = bgm_get_map_default_variation(songID);
|
||||
if (mapSongVariation >= 0) {
|
||||
variation = mapSongVariation;
|
||||
}
|
||||
|
||||
if (musicSetting->songID == songID && musicSetting->variation == variation) {
|
||||
bgm_set_target_volume(volume);
|
||||
|
||||
if (musicSetting->flags & MUSIC_SETTINGS_FLAG_4) {
|
||||
func_80055B80(musicSetting->songName);
|
||||
musicSetting->flags &= ~MUSIC_SETTINGS_FLAG_4;
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
MusicDefaultVolume = volume;
|
||||
musicSetting->songID = songID;
|
||||
musicSetting->variation = variation;
|
||||
musicSetting->fadeOutTime = fadeOutTime;
|
||||
musicSetting->state = 1;
|
||||
musicSetting->flags &= ~MUSIC_SETTINGS_FLAG_ENABLE_PROXIMITY_MIX;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume) {
|
||||
gMusicSettings[playerIndex].flags &= ~MUSIC_SETTINGS_FLAG_8;
|
||||
|
||||
return _bgm_set_song(playerIndex, songID, variation, fadeOutTime, volume);
|
||||
}
|
||||
|
||||
s32 func_8014A964(s32 playerIndex, s32 songID, s32 variation, s32 fadeInTime, s16 fadeStartVolume, s16 fadeEndVolume) {
|
||||
MusicSettings* musicSetting;
|
||||
s32 mapSongVariation;
|
||||
|
||||
if (gGameStatusPtr->demoState) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
musicSetting = &gMusicSettings[playerIndex];
|
||||
|
||||
if (!gGameStatusPtr->musicEnabled) {
|
||||
au_song_stop(musicSetting->songName);
|
||||
musicSetting->flags &= ~MUSIC_SETTINGS_FLAG_1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
mapSongVariation = bgm_get_map_default_variation(songID);
|
||||
if (mapSongVariation >= 0) {
|
||||
variation = mapSongVariation;
|
||||
}
|
||||
|
||||
musicSetting->fadeInTime = fadeInTime;
|
||||
musicSetting->fadeStartVolume = fadeStartVolume;
|
||||
musicSetting->fadeEndVolume = fadeEndVolume;
|
||||
musicSetting->songID = songID;
|
||||
musicSetting->variation = variation;
|
||||
musicSetting->flags |= MUSIC_SETTINGS_FLAG_20;
|
||||
musicSetting->state = 1;
|
||||
musicSetting->flags &= ~MUSIC_SETTINGS_FLAG_ENABLE_PROXIMITY_MIX;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 bgm_adjust_proximity(s32 playerIndex, s32 mix, s16 state) {
|
||||
MusicSettings* musicSetting = &gMusicSettings[playerIndex];
|
||||
|
||||
if (!(musicSetting->flags & MUSIC_SETTINGS_FLAG_1)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(musicSetting->flags & MUSIC_SETTINGS_FLAG_ENABLE_PROXIMITY_MIX)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case MUSIC_PROXIMITY_FAR:
|
||||
bgm_set_proximity_mix_far(musicSetting->songName, mix);
|
||||
break;
|
||||
case MUSIC_PROXIMITY_NEAR:
|
||||
bgm_set_proximity_mix_near(musicSetting->songName, mix);
|
||||
break;
|
||||
case MUSIC_PROXIMITY_FULL:
|
||||
bgm_set_proximity_mix_full(musicSetting->songName, mix);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
AuResult bgm_set_track_volumes(s32 playerIndex, s16 trackVolSet) {
|
||||
MusicSettings* musicSetting = &gMusicSettings[playerIndex];
|
||||
|
||||
if (!(musicSetting->flags & MUSIC_SETTINGS_FLAG_1)) {
|
||||
return AU_RESULT_OK;
|
||||
}
|
||||
|
||||
return snd_song_set_track_volumes(musicSetting->songName, trackVolSet);
|
||||
}
|
||||
|
||||
AuResult bgm_clear_track_volumes(s32 playerIndex, s16 trackVolSet) {
|
||||
MusicSettings* musicSetting = &gMusicSettings[playerIndex];
|
||||
|
||||
if (!(musicSetting->flags & MUSIC_SETTINGS_FLAG_1)) {
|
||||
return AU_RESULT_OK;
|
||||
}
|
||||
|
||||
return snd_song_clear_track_volumes(musicSetting->songName, trackVolSet);
|
||||
}
|
||||
|
||||
AuResult bgm_set_variation(s32 playerIndex, s16 arg1) {
|
||||
MusicSettings* musicSetting = &gMusicSettings[playerIndex];
|
||||
|
||||
if (!(musicSetting->flags & MUSIC_SETTINGS_FLAG_1)) {
|
||||
return AU_RESULT_OK;
|
||||
}
|
||||
|
||||
return snd_set_song_variation(musicSetting->songName, arg1);
|
||||
}
|
||||
|
||||
s32 bgm_init_music_players(void) {
|
||||
bgm_set_song(0, -1, 0, 250, 8);
|
||||
bgm_set_song(1, -1, 0, 250, 8);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void bgm_quiet_max_volume(void) {
|
||||
MusicMaxVolume = 4;
|
||||
}
|
||||
|
||||
void bgm_reset_max_volume(void) {
|
||||
MusicMaxVolume = 8;
|
||||
}
|
||||
|
||||
void bgm_set_target_volume(s16 volume) {
|
||||
MusicTargetVolume = volume;
|
||||
}
|
||||
|
||||
void bgm_update_volume(void) {
|
||||
s16 toVolume;
|
||||
|
||||
if (NextVolumeUpdateTimer != 0) {
|
||||
NextVolumeUpdateTimer--;
|
||||
return;
|
||||
}
|
||||
|
||||
toVolume = MusicTargetVolume;
|
||||
if (toVolume > MusicMaxVolume) {
|
||||
toVolume = MusicMaxVolume;
|
||||
}
|
||||
|
||||
if (MusicCurrentVolume != toVolume) {
|
||||
if (MusicCurrentVolume >= toVolume) {
|
||||
MusicCurrentVolume--;
|
||||
} else {
|
||||
MusicCurrentVolume++;
|
||||
}
|
||||
func_800561A4(MusicCurrentVolume);
|
||||
NextVolumeUpdateTimer = 3;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_8014AD40(void) {
|
||||
MusicSettings* settings = gMusicSettings;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gMusicSettings); i++, settings++) {
|
||||
if (!(settings->flags & MUSIC_SETTINGS_FLAG_1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (au_song_is_playing(settings->songName)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void bgm_pop_song(void) {
|
||||
MusicSettings* musicSetting = gMusicSettings;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
musicSetting->flags |= MUSIC_SETTINGS_FLAG_8;
|
||||
_bgm_set_song(0, musicSetting->savedSongID, musicSetting->savedVariation, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_push_song(s32 songID, s32 variation) {
|
||||
MusicSettings* musicSetting = gMusicSettings;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
musicSetting->savedSongID = musicSetting->songID;
|
||||
musicSetting->savedVariation = musicSetting->variation;
|
||||
musicSetting->savedSongName = musicSetting->songName;
|
||||
musicSetting->flags |= MUSIC_SETTINGS_FLAG_4;
|
||||
bgm_set_song(0, songID, variation, 500, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_pop_battle_song(void) {
|
||||
MusicSettings* musicSetting = gMusicSettings;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
if (gOverrideFlags & GLOBAL_OVERRIDES_DONT_RESUME_SONG_AFTER_BATTLE) {
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_DONT_RESUME_SONG_AFTER_BATTLE;
|
||||
} else {
|
||||
musicSetting->flags |= MUSIC_SETTINGS_FLAG_8;
|
||||
_bgm_set_song(0, musicSetting->savedSongID, musicSetting->savedVariation, 0, 8);
|
||||
snd_ambient_resume(0, 250);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_push_battle_song(void) {
|
||||
MusicSettings* musicSetting = gMusicSettings;
|
||||
|
||||
if (gGameStatusPtr->demoState == DEMO_STATE_NONE) {
|
||||
if (!(gOverrideFlags & GLOBAL_OVERRIDES_DONT_RESUME_SONG_AFTER_BATTLE)) {
|
||||
snd_ambient_pause(0, 250);
|
||||
musicSetting->savedSongID = musicSetting->songID;
|
||||
musicSetting->savedVariation = musicSetting->variation;
|
||||
musicSetting->savedSongName = musicSetting->songName;
|
||||
musicSetting->flags |= MUSIC_SETTINGS_FLAG_4;
|
||||
bgm_set_song(0, musicSetting->battleSongID, musicSetting->battleVariation, 500, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_set_battle_song(s32 songID, s32 variation) {
|
||||
MusicSettings* musicSetting = gMusicSettings;
|
||||
|
||||
musicSetting->battleSongID = songID;
|
||||
musicSetting->battleVariation = variation;
|
||||
}
|
||||
|
||||
void func_8014AFA0(void) {
|
||||
}
|
|
@ -1,15 +1,9 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
|
||||
typedef struct BufferEntry {
|
||||
/* 0x0 */ u16 fileIndex;
|
||||
/* 0x2 */ u8 bankIndex;
|
||||
/* 0x3 */ u8 bankGroup;
|
||||
} BufferEntry; // size = 4
|
||||
#include "audio/core.h"
|
||||
|
||||
void au_load_BK_headers(AuGlobals* globals, ALHeap* heap) {
|
||||
SBNFileEntry fileEntry;
|
||||
BufferEntry buffer[80];
|
||||
InitBankEntry buffer[INIT_BANK_BUFFER_SIZE];
|
||||
s32 i;
|
||||
|
||||
au_read_rom(globals->bkFileListOffset, &buffer, globals->bkListLength);
|
||||
|
@ -20,6 +14,6 @@ void au_load_BK_headers(AuGlobals* globals, ALHeap* heap) {
|
|||
}
|
||||
|
||||
au_fetch_SBN_file(buffer[i].fileIndex, AU_FMT_BK, &fileEntry);
|
||||
au_load_BK_to_bank(fileEntry.offset, NULL, buffer[i].bankIndex, buffer[i].bankGroup);
|
||||
au_load_BK_to_bank(fileEntry.offset, NULL, buffer[i].bankIndex, buffer[i].bankSet);
|
||||
}
|
||||
}
|
|
@ -1,29 +1,34 @@
|
|||
#include "audio.h"
|
||||
#include "audio/core.h"
|
||||
|
||||
extern u8 BlankMseqData[];
|
||||
|
||||
#define TRACK_ID_DRUM 9
|
||||
|
||||
enum AmbientMode {
|
||||
AMB_MODE_NORMAL = 0,
|
||||
AMB_MODE_RESUMING = 1,
|
||||
AMB_MODE_STOPPED = 2,
|
||||
AMB_MODE_PAUSING = 3
|
||||
enum MseqMode {
|
||||
MSEQ_MODE_PLAYING = 0,
|
||||
MSEQ_MODE_RESUMING = 1,
|
||||
MSEQ_MODE_STOPPED = 2,
|
||||
MSEQ_MODE_PAUSING = 3,
|
||||
};
|
||||
|
||||
enum AmbientFadeState {
|
||||
AMB_FADE_IN = 0,
|
||||
AMB_FADE_OUT = 1,
|
||||
AMB_FADE_OUT_PAUSING = 2,
|
||||
enum MseqFadeState {
|
||||
MSEQ_FADE_IN = 0,
|
||||
MSEQ_FADE_OUT = 1,
|
||||
MSEQ_FADE_OUT_PAUSING = 2,
|
||||
};
|
||||
|
||||
enum AmbientPlayState {
|
||||
AMB_PLAYER_PLAYING = 0,
|
||||
AMB_PLAYER_STOPPED = 1,
|
||||
AMB_PLAYER_STOPPING = 2
|
||||
enum MseqPlayState {
|
||||
MSEQ_PLAYER_PLAYING = 0,
|
||||
MSEQ_PLAYER_STOPPED = 1,
|
||||
MSEQ_PLAYER_STOPPING = 2,
|
||||
};
|
||||
|
||||
enum MSEQCommand {
|
||||
enum MseqTrackFlags {
|
||||
MSEQ_TRACK_RESUMABLE = 1,
|
||||
};
|
||||
|
||||
enum MseqCommand {
|
||||
MSEQ_CMD_80_STOP_SOUND = 0x80,
|
||||
MSEQ_CMD_90_PLAY_SOUND = 0x90,
|
||||
MSEQ_CMD_A0_SET_VOLUME_PAN = 0xA0,
|
||||
|
@ -36,7 +41,7 @@ enum MSEQCommand {
|
|||
MSEQ_CMD_SUB_69_SET_RESUMABLE = 0x69,
|
||||
};
|
||||
|
||||
void au_amb_manager_init(AmbienceManager* manager, s8 priority, s8 busId, AuGlobals* globals) {
|
||||
void au_mseq_manager_init(AmbienceManager* manager, s8 priority, s8 busID, AuGlobals* globals) {
|
||||
AmbiencePlayer* player;
|
||||
s32 i;
|
||||
|
||||
|
@ -46,7 +51,7 @@ void au_amb_manager_init(AmbienceManager* manager, s8 priority, s8 busId, AuGlob
|
|||
player = &manager->players[i];
|
||||
player->id.playerIndex = i;
|
||||
player->delay = 1;
|
||||
player->fadeVolume = 0x7F000000;
|
||||
player->fadeVolume = AU_MAX_VOLUME_8 << 24;
|
||||
}
|
||||
|
||||
manager->globals = globals;
|
||||
|
@ -54,10 +59,10 @@ void au_amb_manager_init(AmbienceManager* manager, s8 priority, s8 busId, AuGlob
|
|||
manager->nextUpdateCounter = 2;
|
||||
manager->nextUpdateInterval = 2;
|
||||
manager->priority = priority;
|
||||
manager->busId = busId;
|
||||
manager->busID = busID;
|
||||
}
|
||||
|
||||
AuResult au_amb_check_player_index(u32 index) {
|
||||
AuResult au_mseq_check_player_index(u32 index) {
|
||||
if (gAuAmbienceManager->numActivePlayers <= index) {
|
||||
return AU_AMBIENCE_ERROR_3;
|
||||
} else {
|
||||
|
@ -65,57 +70,63 @@ AuResult au_amb_check_player_index(u32 index) {
|
|||
}
|
||||
}
|
||||
|
||||
void au_amb_load_tracks_fade(s32 arg0, s32 arg1) {
|
||||
void au_mseq_load_tracks_fade(s32 arg0, s32 arg1) {
|
||||
gAuAmbienceManager->loadTracksFadeInfo = arg1;
|
||||
}
|
||||
|
||||
void au_amb_set_disabled(s32 index, s32 disable) {
|
||||
void au_mseq_set_disabled(s32 index, s32 disable) {
|
||||
AmbienceManager* manager = gAuAmbienceManager;
|
||||
AmbiencePlayer* ambPlayer = &manager->players[index];
|
||||
AmbiencePlayer* player = &manager->players[index];
|
||||
|
||||
if (!disable) {
|
||||
ambPlayer->playState = AMB_PLAYER_PLAYING;
|
||||
player->playState = MSEQ_PLAYER_PLAYING;
|
||||
} else {
|
||||
ambPlayer->playState = AMB_PLAYER_STOPPING;
|
||||
player->playState = MSEQ_PLAYER_STOPPING;
|
||||
}
|
||||
}
|
||||
|
||||
AuResult au_amb_start(s32 index, s32 time) {
|
||||
AuResult au_mseq_start(s32 index, s32 time) {
|
||||
AmbiencePlayer* player = &gAuAmbienceManager->players[index];
|
||||
MSEQHeader* mseq = gAuAmbienceManager->mseqFiles[index];
|
||||
AuResult status = AU_RESULT_OK;
|
||||
|
||||
if (mseq != NULL) {
|
||||
if (player->mseqName == 0) {
|
||||
au_amb_play_sequence(gAuAmbienceManager, mseq, index);
|
||||
au_mseq_play_sequence(gAuAmbienceManager, mseq, index);
|
||||
if (time != 0) {
|
||||
player->fadeSettingsTime = time;
|
||||
player->fadeSettingsInitial = 0;
|
||||
player->fadeSettingsGoal = 127;
|
||||
player->fadeSettingsType = AMB_FADE_IN;
|
||||
au_amb_fade_setup(player);
|
||||
player->fadeSettingsGoal = AU_MAX_VOLUME_8;
|
||||
player->fadeSettingsType = MSEQ_FADE_IN;
|
||||
au_mseq_fade_setup(player);
|
||||
}
|
||||
} else {
|
||||
status = AU_AMBIENCE_ERROR_1;
|
||||
status = AU_AMBIENCE_ERROR_PLAYER_BUSY;
|
||||
}
|
||||
} else {
|
||||
status = AU_AMBIENCE_ERROR_2;
|
||||
status = AU_AMBIENCE_ERROR_MSEQ_NOT_FOUND;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void au_amb_fade_setup(AmbiencePlayer* player) {
|
||||
void au_mseq_fade_setup(AmbiencePlayer* player) {
|
||||
u16 time = player->fadeSettingsTime;
|
||||
|
||||
if (player->fadeSettingsInitial == 255) {
|
||||
player->fadeSettingsInitial = player->fadeVolume >> 0x18;
|
||||
player->fadeSettingsInitial = player->fadeVolume >> 24;
|
||||
}
|
||||
|
||||
if (time >= SND_MIN_DURATION && time <= SND_MAX_DURATION) {
|
||||
player->fadeVolume = player->fadeSettingsInitial << 0x18;
|
||||
player->fadeVolume = player->fadeSettingsInitial << 24;
|
||||
player->fadeGoal = player->fadeSettingsGoal;
|
||||
player->fadeTime = (u32)(time * 10) / 115; // TODO figure out why is the ratio like this
|
||||
player->fadeStep = ((player->fadeSettingsGoal - player->fadeSettingsInitial) << 0x18) / ((s16)player->fadeTime & 0xFFFF);
|
||||
|
||||
// converts a fade time in milliseconds to the number of player update ticks needed to complete the fade
|
||||
// the ambience manager updates every other audio frame, so given outputRate = 32000 and frameSize = 184,
|
||||
// update ticks needed = (32000 / 184) / 2, and then we divide by 1000 (since fade time has units of ms).
|
||||
// this reduces to 16/184, which is exactly 1.6 times 10/115
|
||||
// why this odd reduction was chosen unstead of 16/184 is unknown
|
||||
player->fadeTime = (u32)(time * 10) / 115;
|
||||
player->fadeStep = ((player->fadeSettingsGoal - player->fadeSettingsInitial) << 24) / ((s16)player->fadeTime & 0xFFFF);
|
||||
}
|
||||
|
||||
player->fadeSettingsTime = 0;
|
||||
|
@ -123,7 +134,7 @@ void au_amb_fade_setup(AmbiencePlayer* player) {
|
|||
player->fadeSettingsGoal = 0;
|
||||
}
|
||||
|
||||
void au_amb_pause(s32 index, s32 time) {
|
||||
void au_mseq_pause(s32 index, s32 time) {
|
||||
AmbiencePlayer* player = &gAuAmbienceManager->players[index];
|
||||
|
||||
if (player->mseqReadStart != NULL && player->mseqReadPos != NULL) {
|
||||
|
@ -131,37 +142,37 @@ void au_amb_pause(s32 index, s32 time) {
|
|||
player->fadeSettingsInitial = 255;
|
||||
player->fadeSettingsTime = time;
|
||||
player->fadeSettingsGoal = 0;
|
||||
player->fadeSettingsType = AMB_FADE_OUT_PAUSING;
|
||||
player->fadeSettingsType = MSEQ_FADE_OUT_PAUSING;
|
||||
return;
|
||||
}
|
||||
player->mode = AMB_MODE_PAUSING;
|
||||
player->mode = MSEQ_MODE_PAUSING;
|
||||
}
|
||||
}
|
||||
|
||||
void au_amb_resume(s32 index, s32 time) {
|
||||
void au_mseq_resume(s32 index, s32 time) {
|
||||
AmbiencePlayer* player = &gAuAmbienceManager->players[index];
|
||||
|
||||
if (player->mseqReadStart != NULL && player->mseqReadPos != NULL) {
|
||||
player->mode = AMB_MODE_RESUMING;
|
||||
player->mode = MSEQ_MODE_RESUMING;
|
||||
if (time != 0) {
|
||||
player->fadeSettingsTime = time;
|
||||
} else {
|
||||
player->fadeSettingsTime = SND_MIN_DURATION;
|
||||
}
|
||||
player->fadeSettingsInitial = 0;
|
||||
player->fadeSettingsGoal = SND_MAX_VOLUME_8;
|
||||
player->fadeSettingsType = AMB_FADE_IN;
|
||||
player->fadeSettingsGoal = AU_MAX_VOLUME_8;
|
||||
player->fadeSettingsType = MSEQ_FADE_IN;
|
||||
}
|
||||
}
|
||||
|
||||
void au_amb_stop_quick(s32 index) {
|
||||
void au_mseq_stop_quick(s32 index) {
|
||||
AmbiencePlayer* player = &gAuAmbienceManager->players[index];
|
||||
|
||||
if (player->mseqReadStart != NULL && player->mseqReadPos != NULL) {
|
||||
if (player->mode != AMB_MODE_NORMAL) {
|
||||
if (player->mode != MSEQ_MODE_PLAYING) {
|
||||
player->mseqReadPos = NULL;
|
||||
player->mseqName = 0;
|
||||
player->mode = AMB_MODE_NORMAL;
|
||||
player->mode = MSEQ_MODE_PLAYING;
|
||||
return;
|
||||
}
|
||||
player->mseqReadPos = BlankMseqData;
|
||||
|
@ -169,7 +180,7 @@ void au_amb_stop_quick(s32 index) {
|
|||
}
|
||||
}
|
||||
|
||||
void au_amb_stop_slow(s32 index, s32 time) {
|
||||
void au_mseq_stop_slow(s32 index, s32 time) {
|
||||
AmbiencePlayer* player = &gAuAmbienceManager->players[index];
|
||||
|
||||
if (player->mseqReadStart != NULL && player->mseqReadPos != NULL) {
|
||||
|
@ -180,17 +191,17 @@ void au_amb_stop_slow(s32 index, s32 time) {
|
|||
}
|
||||
player->fadeSettingsInitial = 255;
|
||||
player->fadeSettingsGoal = 0;
|
||||
player->fadeSettingsType = AMB_FADE_OUT;
|
||||
player->fadeSettingsType = MSEQ_FADE_OUT;
|
||||
}
|
||||
}
|
||||
|
||||
void au_amb_set_volume(s32 index, s32 time, s32 volume) {
|
||||
void au_mseq_set_volume(s32 index, s32 time, s32 volume) {
|
||||
AmbiencePlayer* player = &gAuAmbienceManager->players[index];
|
||||
if ((player->mseqReadStart != 0) && (player->mseqReadPos != 0)) {
|
||||
if (volume <= 0) {
|
||||
volume = 1;
|
||||
} else if (volume > SND_MAX_VOLUME_8) {
|
||||
volume = SND_MAX_VOLUME_8;
|
||||
} else if (volume > AU_MAX_VOLUME_8) {
|
||||
volume = AU_MAX_VOLUME_8;
|
||||
}
|
||||
if (time != 0) {
|
||||
player->fadeSettingsTime = time;
|
||||
|
@ -199,24 +210,24 @@ void au_amb_set_volume(s32 index, s32 time, s32 volume) {
|
|||
}
|
||||
player->fadeSettingsInitial = 255;
|
||||
player->fadeSettingsGoal = volume;
|
||||
player->fadeSettingsType = AMB_FADE_IN;
|
||||
player->fadeSettingsType = MSEQ_FADE_IN;
|
||||
}
|
||||
}
|
||||
|
||||
AuResult au_amb_is_stopped(s32 index) {
|
||||
AuResult au_mseq_check_stopped(s32 index) {
|
||||
AmbiencePlayer* player = &gAuAmbienceManager->players[index];
|
||||
AuResult status = AU_RESULT_OK;
|
||||
|
||||
if (player->mseqReadStart != NULL && player->mseqReadPos != NULL) {
|
||||
status = AU_AMBIENCE_ERROR_1;
|
||||
if (player->mode != AMB_MODE_NORMAL) {
|
||||
status = AU_AMBIENCE_ERROR_2;
|
||||
status = AU_AMBIENCE_STOP_ERROR_1;
|
||||
if (player->mode != MSEQ_MODE_PLAYING) {
|
||||
status = AU_AMBIENCE_STOP_ERROR_2;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void au_amb_play_sequence(AmbienceManager* manager, MSEQHeader* mseqFile, s32 index) {
|
||||
void au_mseq_play_sequence(AmbienceManager* manager, MSEQHeader* mseqFile, s32 index) {
|
||||
AmbiencePlayer* player;
|
||||
AmbienceTrack* track;
|
||||
AuFilePos readPos;
|
||||
|
@ -234,8 +245,8 @@ void au_amb_play_sequence(AmbienceManager* manager, MSEQHeader* mseqFile, s32 in
|
|||
player->mseqReadStart = readPos;
|
||||
|
||||
player->delay = 1;
|
||||
player->fadeVolume = 0x7F000000;
|
||||
player->fadeGoal = 0x7F;
|
||||
player->fadeVolume = AU_MAX_VOLUME_8 << 24;
|
||||
player->fadeGoal = AU_MAX_VOLUME_8;
|
||||
|
||||
player->mseqName = player->mseqFile->name;
|
||||
player->firstVoiceIdx = player->mseqFile->firstVoiceIdx;
|
||||
|
@ -246,19 +257,23 @@ void au_amb_play_sequence(AmbienceManager* manager, MSEQHeader* mseqFile, s32 in
|
|||
for (i = 0; i < ARRAY_COUNT(player->tracks); i++) {
|
||||
track = &player->tracks[i];
|
||||
track->instrument = manager->globals->defaultInstrument;
|
||||
track->volumeLerp.current = 0x7FFFFFFF;
|
||||
track->volumeLerp.current = AU_MAX_VOLUME_32;
|
||||
track->pan = 64;
|
||||
}
|
||||
player->resetRequired = TRUE;
|
||||
}
|
||||
|
||||
void au_amb_manager_update(AmbienceManager* manager) {
|
||||
void au_mseq_manager_audio_frame_update(AmbienceManager* manager) {
|
||||
u32 i;
|
||||
s32 j;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(manager->voiceStates); i++) {
|
||||
AmbienceVoiceState* voiceState = &manager->voiceStates[i];
|
||||
|
||||
// potential @bug, any voice which is not properly released via MSEQ_CMD_80_STOP_SOUND will eventaully
|
||||
// end and set its priority to AU_PRIORITY_FREE, where another client can steal it and begin using it
|
||||
// without it being considered 'free' by this AmbienceManager. this can be fixed by removing the check
|
||||
// for released == TRUE from the conditional
|
||||
if (voiceState->info.released == TRUE && manager->globals->voices[i].priority != manager->priority) {
|
||||
voiceState->info.all = 0;
|
||||
}
|
||||
|
@ -270,32 +285,32 @@ void au_amb_manager_update(AmbienceManager* manager) {
|
|||
|
||||
if (player->mseqReadPos != NULL) {
|
||||
if (manager->loadTracksFadeInfo) {
|
||||
au_amb_load_track_fade_info(manager, player);
|
||||
au_mseq_load_track_fade_info(manager, player);
|
||||
}
|
||||
|
||||
mode = player->mode;
|
||||
if (mode != AMB_MODE_NORMAL) {
|
||||
if (mode == AMB_MODE_PAUSING) {
|
||||
player->mode = AMB_MODE_STOPPED;
|
||||
au_amb_save_voices(manager, player);
|
||||
au_amb_player_stop(manager, player);
|
||||
} else if (player->mode == AMB_MODE_RESUMING) {
|
||||
player->mode = AMB_MODE_NORMAL;
|
||||
if (mode != MSEQ_MODE_PLAYING) {
|
||||
if (mode == MSEQ_MODE_PAUSING) {
|
||||
player->mode = MSEQ_MODE_STOPPED;
|
||||
au_mseq_save_voices(manager, player);
|
||||
au_mseq_player_stop(manager, player);
|
||||
} else if (player->mode == MSEQ_MODE_RESUMING) {
|
||||
player->mode = MSEQ_MODE_PLAYING;
|
||||
if (player->fadeSettingsTime != 0) {
|
||||
au_amb_fade_setup(player);
|
||||
au_mseq_fade_setup(player);
|
||||
}
|
||||
au_amb_restore_voices(manager, player);
|
||||
au_mseq_restore_voices(manager, player);
|
||||
}
|
||||
} else {
|
||||
// case AMB_MODE_NORMAL
|
||||
// case MSEQ_MODE_PLAYING
|
||||
if (player->fadeSettingsTime != 0) {
|
||||
au_amb_fade_setup(player);
|
||||
au_mseq_fade_setup(player);
|
||||
}
|
||||
if (player->playState == AMB_PLAYER_STOPPING) {
|
||||
au_amb_player_stop(manager, player);
|
||||
player->playState = AMB_PLAYER_STOPPED;
|
||||
if (player->playState == MSEQ_PLAYER_STOPPING) {
|
||||
au_mseq_player_stop(manager, player);
|
||||
player->playState = MSEQ_PLAYER_STOPPED;
|
||||
}
|
||||
au_amb_player_update(manager, player);
|
||||
au_mseq_player_update(manager, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +318,7 @@ void au_amb_manager_update(AmbienceManager* manager) {
|
|||
manager->loadTracksFadeInfo = FALSE;
|
||||
}
|
||||
|
||||
void au_amb_load_track_fade_info(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
void au_mseq_load_track_fade_info(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
MSEQHeader* mseqFile;
|
||||
MSEQTrackData* trackData;
|
||||
AmbienceTrack* track;
|
||||
|
@ -318,11 +333,11 @@ void au_amb_load_track_fade_info(AmbienceManager* manager, AmbiencePlayer* playe
|
|||
track = &player->tracks[trackData->trackIndex];
|
||||
if (trackData->type == 0) {
|
||||
track->tuneLerp.time = trackData->time;
|
||||
track->tuneLerp.step = (trackData->delta << 0x10) / trackData->time;
|
||||
track->tuneLerp.step = (trackData->delta << 16) / trackData->time;
|
||||
track->tuneLerp.goal = trackData->goal;
|
||||
} else if (trackData->type == 1) {
|
||||
track->volumeLerp.time = trackData->time;
|
||||
track->volumeLerp.step = (trackData->delta << 0x10) / trackData->time;
|
||||
track->volumeLerp.step = (trackData->delta << 16) / trackData->time;
|
||||
track->volumeLerp.goal = trackData->goal;
|
||||
}
|
||||
trackData++;
|
||||
|
@ -330,7 +345,7 @@ void au_amb_load_track_fade_info(AmbienceManager* manager, AmbiencePlayer* playe
|
|||
}
|
||||
}
|
||||
|
||||
void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
void au_mseq_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
u8 isVolumeChanged[16];
|
||||
u8 isPitchChanged[16];
|
||||
AuGlobals* globals;
|
||||
|
@ -339,11 +354,11 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
AuVoice* voice;
|
||||
BGMDrumInfo* drum;
|
||||
u32 trackIdx;
|
||||
s32 temp;
|
||||
s32 voiceSelector;
|
||||
s32 i;
|
||||
u16 bankPatch;
|
||||
u32 count;
|
||||
s32 loopId;
|
||||
s32 loopID;
|
||||
u8 op, arg1, arg2;
|
||||
AmbienceTrack* track;
|
||||
|
||||
|
@ -355,7 +370,7 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
}
|
||||
|
||||
if (player->resetRequired == TRUE) {
|
||||
au_amb_player_stop(manager, player);
|
||||
au_mseq_player_stop(manager, player);
|
||||
player->resetRequired = FALSE;
|
||||
}
|
||||
|
||||
|
@ -363,14 +378,14 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
player->fadeVolume += player->fadeStep;
|
||||
player->fadeTime--;
|
||||
if (player->fadeTime == 0) {
|
||||
player->fadeVolume = player->fadeGoal << 0x18;
|
||||
if (player->fadeSettingsType == AMB_FADE_IN) {
|
||||
player->fadeVolume = player->fadeGoal << 24;
|
||||
if (player->fadeSettingsType == MSEQ_FADE_IN) {
|
||||
// do nothing
|
||||
} else if (player->fadeSettingsType == AMB_FADE_OUT) {
|
||||
} else if (player->fadeSettingsType == MSEQ_FADE_OUT) {
|
||||
player->mseqReadPos = BlankMseqData;
|
||||
player->delay = 1;
|
||||
} else if (player->fadeSettingsType == AMB_FADE_OUT_PAUSING) {
|
||||
player->mode = AMB_MODE_PAUSING;
|
||||
} else if (player->fadeSettingsType == MSEQ_FADE_OUT_PAUSING) {
|
||||
player->mode = MSEQ_MODE_PAUSING;
|
||||
}
|
||||
}
|
||||
fadeVolChanged = TRUE;
|
||||
|
@ -384,17 +399,17 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
if (track->tuneLerp.time != 0) {
|
||||
track->tuneLerp.current += track->tuneLerp.step;
|
||||
} else {
|
||||
track->tuneLerp.current = track->tuneLerp.goal << 0x10;
|
||||
track->tuneLerp.current = track->tuneLerp.goal << 16;
|
||||
}
|
||||
|
||||
temp = player->id.all + (trackIdx << 0x10);
|
||||
voiceSelector = player->id.all + (trackIdx << 16);
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
|
||||
// update all voices belonging to current track
|
||||
if ((voiceState->info.all & 0xFFFF0000) == temp) {
|
||||
if ((voiceState->info.all & 0xFFFF0000) == voiceSelector) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority && trackIdx != TRACK_ID_DRUM) {
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 16)) * track->instrument->pitchRatio;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PITCH;
|
||||
isPitchChanged[i - player->firstVoiceIdx] = TRUE;
|
||||
}
|
||||
|
@ -411,18 +426,18 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
if (track->volumeLerp.time != 0) {
|
||||
track->volumeLerp.current += track->volumeLerp.step;
|
||||
} else {
|
||||
track->volumeLerp.current = track->volumeLerp.goal << 0x10;
|
||||
track->volumeLerp.current = track->volumeLerp.goal << 16;
|
||||
}
|
||||
|
||||
temp = player->id.all + (trackIdx << 0x10);
|
||||
voiceSelector = player->id.all + (trackIdx << 16);
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
|
||||
// update all voices belonging to current track
|
||||
if ((voiceState->info.all & 0xFFFF0000) == temp) {
|
||||
if ((voiceState->info.all & 0xFFFF0000) == voiceSelector) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority) {
|
||||
track = &player->tracks[voiceState->info.trackIndex];
|
||||
voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
|
||||
voice->clientVolume = VOL_MULT_3(player->fadeVolume >> 24, track->volumeLerp.current >> 16, voiceState->volume);
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
}
|
||||
}
|
||||
|
@ -433,18 +448,18 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
player->delay--;
|
||||
if (player->delay <= 0) {
|
||||
while (player->delay == 0) {
|
||||
op = au_amb_read_next(player);
|
||||
op = au_mseq_read_next(player);
|
||||
if ((s8)op >= 0) {
|
||||
if (op == 0) {
|
||||
// stop
|
||||
player->mseqReadPos = NULL;
|
||||
player->mseqName = 0;
|
||||
au_amb_player_stop(manager, player);
|
||||
au_mseq_player_stop(manager, player);
|
||||
break;
|
||||
}
|
||||
if (op >= 0x78) {
|
||||
// long delay
|
||||
player->delay = ((op & 7) << 8) + au_amb_read_next(player) + 0x78;
|
||||
player->delay = ((op & 7) << 8) + au_mseq_read_next(player) + 0x78;
|
||||
} else {
|
||||
//short delay
|
||||
player->delay = op;
|
||||
|
@ -456,18 +471,18 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
// op & 0xF0 : command
|
||||
// op & 0xF : track index
|
||||
|
||||
arg1 = au_amb_read_next(player);
|
||||
arg1 = au_mseq_read_next(player);
|
||||
trackIdx = op & 0xF;
|
||||
track = &player->tracks[trackIdx];
|
||||
|
||||
switch (op & 0xF0) {
|
||||
case MSEQ_CMD_80_STOP_SOUND:
|
||||
// arg1: sound index
|
||||
if (player->playState == AMB_PLAYER_PLAYING) {
|
||||
temp = player->id.all + (trackIdx << 0x10) + (arg1 << 8);
|
||||
if (player->playState == MSEQ_PLAYER_PLAYING) {
|
||||
voiceSelector = player->id.all + (trackIdx << 16) + (arg1 << 8);
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
if (manager->voiceStates[i - player->firstVoiceIdx].info.all == temp) {
|
||||
manager->voiceStates[i - player->firstVoiceIdx].info.released = 1;
|
||||
if (manager->voiceStates[i - player->firstVoiceIdx].info.all == voiceSelector) {
|
||||
manager->voiceStates[i - player->firstVoiceIdx].info.released = TRUE;
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority) {
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_KEY_RELEASED;
|
||||
|
@ -479,8 +494,8 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
case MSEQ_CMD_90_PLAY_SOUND:
|
||||
// arg1: pitch or drum sound id
|
||||
// arg2: volume
|
||||
arg2 = au_amb_read_next(player);
|
||||
if (player->playState == AMB_PLAYER_PLAYING) {
|
||||
arg2 = au_mseq_read_next(player);
|
||||
if (player->playState == MSEQ_PLAYER_PLAYING) {
|
||||
// find free voice
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voice = &globals->voices[i];
|
||||
|
@ -489,7 +504,7 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
}
|
||||
}
|
||||
if (i >= player->lastVoiceIdx) {
|
||||
// use another ambience voice
|
||||
// try stealing a voice from the current player (or one with the same priority)
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority) {
|
||||
|
@ -499,7 +514,7 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
}
|
||||
}
|
||||
if (i >= player->lastVoiceIdx) {
|
||||
// try stealing voice with lower priority
|
||||
// try stealing a voice from a different player with a lower priority
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority < manager->priority) {
|
||||
|
@ -513,14 +528,14 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
isPitchChanged[i - player->firstVoiceIdx] = TRUE;
|
||||
voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
|
||||
// set playerIndex, trackIndex and tune
|
||||
voiceState->info.all = player->id.all + (trackIdx << 0x10) + (arg1 << 8);
|
||||
if (track->flags & 1) {
|
||||
voiceState->info.all = player->id.all + (trackIdx << 16) + (arg1 << 8);
|
||||
if (track->flags & MSEQ_TRACK_RESUMABLE) {
|
||||
voiceState->isResumable = TRUE;
|
||||
} else {
|
||||
voiceState->isResumable = FALSE;
|
||||
}
|
||||
if (trackIdx != TRACK_ID_DRUM) {
|
||||
if (track->flags & 1) {
|
||||
if (track->flags & MSEQ_TRACK_RESUMABLE) {
|
||||
voiceState->isResumable = TRUE;
|
||||
} else {
|
||||
voiceState->isResumable = FALSE;
|
||||
|
@ -528,12 +543,12 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
|
||||
voiceState->pitch = (arg1 & 0x7F) * 100 - track->instrument->keyBase;
|
||||
voiceState->volume = arg2 & 0x7F;
|
||||
voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
|
||||
voice->clientVolume = VOL_MULT_3(player->fadeVolume >> 24, track->volumeLerp.current >> 16, voiceState->volume);
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 16)) * track->instrument->pitchRatio;
|
||||
voice->pan = track->pan;
|
||||
voice->reverb = track->reverb;
|
||||
voice->instrument = track->instrument;
|
||||
voice->busId = manager->busId;
|
||||
voice->busID = manager->busID;
|
||||
voice->envelope.cmdListPress = track->envelope.cmdListPress;
|
||||
voice->envelope.cmdListRelease = track->envelope.cmdListRelease;
|
||||
} else {
|
||||
|
@ -542,12 +557,12 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
bankPatch = drum->bankPatch;
|
||||
voice->instrument = au_get_instrument(manager->globals, bankPatch >> 8, bankPatch & 0xFF, &voice->envelope);
|
||||
voiceState->pitch = drum->keyBase - voice->instrument->keyBase;
|
||||
voiceState->volume = ((arg2 & 0x7F) * drum->volume) >> 7;
|
||||
voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
|
||||
voiceState->volume = VOL_MULT_2(arg2 & 0x7F, drum->volume);
|
||||
voice->clientVolume = VOL_MULT_3(player->fadeVolume >> 24, track->volumeLerp.current >> 16, voiceState->volume);
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch) * voice->instrument->pitchRatio;
|
||||
voice->pan = drum->pan;
|
||||
voice->reverb = drum->reverb;
|
||||
voice->busId = manager->busId;
|
||||
voice->busID = manager->busID;
|
||||
}
|
||||
voice->syncFlags = AU_VOICE_SYNC_FLAG_ALL;
|
||||
voice->priority = manager->priority;
|
||||
|
@ -560,10 +575,10 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
// lower 7 bits: value
|
||||
if (arg1 & 0x80) {
|
||||
track->pan = arg1 & 0x7F;
|
||||
temp = player->id.all + (trackIdx << 0x10);
|
||||
voiceSelector = player->id.all + (trackIdx << 16);
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
|
||||
if ((voiceState->info.all & 0xFFFF0000) == temp) {
|
||||
if ((voiceState->info.all & 0xFFFF0000) == voiceSelector) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority && trackIdx != TRACK_ID_DRUM) {
|
||||
voice->pan = track->pan;
|
||||
|
@ -572,17 +587,17 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
track->volumeLerp.current = arg1 << 0x18;
|
||||
track->volumeLerp.current = arg1 << 24;
|
||||
if (track->volumeLerp.current != 0) {
|
||||
track->volumeLerp.current |= 0xFFFFFF;
|
||||
}
|
||||
temp = player->id.all + (trackIdx << 0x10);
|
||||
voiceSelector = player->id.all + (trackIdx << 16);
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
|
||||
if ((voiceState->info.all & 0xFFFF0000) == temp) {
|
||||
if ((voiceState->info.all & 0xFFFF0000) == voiceSelector) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority) {
|
||||
voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
|
||||
voice->clientVolume = VOL_MULT_3(player->fadeVolume >> 24, track->volumeLerp.current >> 16, voiceState->volume);
|
||||
if (!isVolumeChanged[i - player->firstVoiceIdx]) {
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
isVolumeChanged[i - player->firstVoiceIdx] = TRUE;
|
||||
|
@ -595,7 +610,7 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
case MSEQ_CMD_B0_MULTI:
|
||||
// arg1: sub command
|
||||
// arg2: depends on sub command
|
||||
arg2 = au_amb_read_next(player);
|
||||
arg2 = au_mseq_read_next(player);
|
||||
switch (arg1) {
|
||||
case MSEQ_CMD_SUB_66_START_LOOP:
|
||||
// arg2: loop id
|
||||
|
@ -604,24 +619,24 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
case MSEQ_CMD_SUB_67_END_LOOP:
|
||||
// arg2 lower bit: loop id
|
||||
// (arg2 & 0x7C) >> 2: loop count
|
||||
loopId = arg2 & 1;
|
||||
loopID = arg2 & 1;
|
||||
count = (arg2 & 0x7C) >> 2;
|
||||
if (count != 0) {
|
||||
if (player->loopCount[loopId] != 0) {
|
||||
player->loopCount[loopId]--;
|
||||
if (player->loopCount[loopID] != 0) {
|
||||
player->loopCount[loopID]--;
|
||||
// if it's the last iteration then don't jump to the loop start
|
||||
if (player->loopCount[loopId] != 0) {
|
||||
player->mseqReadPos = player->loopStartPos[loopId];
|
||||
if (player->loopCount[loopID] != 0) {
|
||||
player->mseqReadPos = player->loopStartPos[loopID];
|
||||
}
|
||||
} else {
|
||||
// first iteration, set loop counter
|
||||
player->mseqReadPos = player->loopStartPos[loopId];
|
||||
player->loopCount[loopId] = count;
|
||||
player->mseqReadPos = player->loopStartPos[loopID];
|
||||
player->loopCount[loopID] = count;
|
||||
}
|
||||
} else {
|
||||
// infinite loop
|
||||
player->mseqReadPos = player->loopStartPos[loopId];
|
||||
player->loopCount[loopId] = 0;
|
||||
player->mseqReadPos = player->loopStartPos[loopID];
|
||||
player->loopCount[loopID] = 0;
|
||||
}
|
||||
break;
|
||||
case MSEQ_CMD_SUB_68_SET_REVERB:
|
||||
|
@ -629,7 +644,7 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
break;
|
||||
case MSEQ_CMD_SUB_69_SET_RESUMABLE:
|
||||
if (arg2 == 1) {
|
||||
track->flags |= 1;
|
||||
track->flags |= MSEQ_TRACK_RESUMABLE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -637,7 +652,7 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
case MSEQ_CMD_C0_SET_INSTRUMENT:
|
||||
// arg1: bank
|
||||
// arg2: patch
|
||||
arg2 = au_amb_read_next(player);
|
||||
arg2 = au_mseq_read_next(player);
|
||||
if (trackIdx != TRACK_ID_DRUM) {
|
||||
track->instrument = au_get_instrument(manager->globals, arg1, arg2, &track->envelope);
|
||||
}
|
||||
|
@ -645,14 +660,14 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
case MSEQ_CMD_E0_TUNING:
|
||||
// arg1: coarse tune
|
||||
// arg2: fine tune
|
||||
track->tuneLerp.current = (arg1 << 0x18) + (au_amb_read_next(player) << 0x10);
|
||||
temp = player->id.all + (trackIdx << 0x10);
|
||||
track->tuneLerp.current = (arg1 << 24) + (au_mseq_read_next(player) << 16);
|
||||
voiceSelector = player->id.all + (trackIdx << 16);
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
|
||||
if ((voiceState->info.all & 0xFFFF0000) == temp) {
|
||||
if ((voiceState->info.all & 0xFFFF0000) == voiceSelector) {
|
||||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority && trackIdx != TRACK_ID_DRUM) {
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 16)) * track->instrument->pitchRatio;
|
||||
voice->syncFlags |= AU_VOICE_SYNC_FLAG_PITCH;
|
||||
isPitchChanged[i - player->firstVoiceIdx] = 1;
|
||||
}
|
||||
|
@ -672,7 +687,7 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
voice = &globals->voices[i];
|
||||
if (voice->priority == manager->priority && !isVolumeChanged[i - player->firstVoiceIdx]) {
|
||||
track = &player->tracks[voiceState->info.trackIndex];
|
||||
voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
|
||||
voice->clientVolume = VOL_MULT_3(player->fadeVolume >> 24, track->volumeLerp.current >> 16, voiceState->volume);
|
||||
voice->envelopeFlags |= AU_VOICE_ENV_FLAG_VOL_CHANGED;
|
||||
}
|
||||
}
|
||||
|
@ -680,12 +695,12 @@ void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
}
|
||||
}
|
||||
|
||||
u8 au_amb_read_next(AmbiencePlayer* state) {
|
||||
u8 au_mseq_read_next(AmbiencePlayer* state) {
|
||||
u8 value = *state->mseqReadPos++;
|
||||
return value;
|
||||
}
|
||||
|
||||
void au_amb_player_stop(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
void au_mseq_player_stop(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
AuVoice* voice;
|
||||
AmbienceVoiceState* voiceState;
|
||||
s32 i;
|
||||
|
@ -702,13 +717,13 @@ void au_amb_player_stop(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
}
|
||||
}
|
||||
|
||||
void au_amb_save_voices(AmbienceManager* arg0, AmbiencePlayer* player) {
|
||||
void au_mseq_save_voices(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
AmbienceSavedVoice* savedVoice = player->savedVoices;
|
||||
u32 numSaved = 0;
|
||||
s32 i;
|
||||
|
||||
for (i = player->firstVoiceIdx; i < player->lastVoiceIdx; i++) {
|
||||
AmbienceVoiceState* voiceState = &arg0->voiceStates[i - player->firstVoiceIdx];
|
||||
AmbienceVoiceState* voiceState = &manager->voiceStates[i - player->firstVoiceIdx];
|
||||
|
||||
if (!voiceState->isResumable) {
|
||||
continue;
|
||||
|
@ -726,7 +741,7 @@ void au_amb_save_voices(AmbienceManager* arg0, AmbiencePlayer* player) {
|
|||
}
|
||||
}
|
||||
|
||||
void au_amb_restore_voices(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
void au_mseq_restore_voices(AmbienceManager* manager, AmbiencePlayer* player) {
|
||||
AuGlobals* globals;
|
||||
AuVoice* voice;
|
||||
AmbienceSavedVoice* savedVoice;
|
||||
|
@ -735,7 +750,7 @@ void au_amb_restore_voices(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
u32 i, j;
|
||||
|
||||
globals = manager->globals;
|
||||
if (player->playState == AMB_PLAYER_PLAYING) {
|
||||
if (player->playState == MSEQ_PLAYER_PLAYING) {
|
||||
for (i = 0; i < ARRAY_COUNT(player->savedVoices); i++) {
|
||||
savedVoice = &player->savedVoices[i];
|
||||
if (savedVoice->tune != 0) {
|
||||
|
@ -762,15 +777,15 @@ void au_amb_restore_voices(AmbienceManager* manager, AmbiencePlayer* player) {
|
|||
|
||||
if (j < player->lastVoiceIdx) {
|
||||
voiceState = &manager->voiceStates[j - player->firstVoiceIdx];
|
||||
voiceState->info.all = player->id.all + (savedVoice->trackIndex << 0x10) + (savedVoice->tune << 8);
|
||||
voiceState->info.all = player->id.all + (savedVoice->trackIndex << 16) + (savedVoice->tune << 8);
|
||||
voiceState->pitch = (savedVoice->tune & 0x7F) * 100 - track->instrument->keyBase;
|
||||
voiceState->volume = savedVoice->volume & 0x7F;
|
||||
voice->clientVolume = ((player->fadeVolume >> 0x18) * (track->volumeLerp.current >> 0x10) * voiceState->volume) >> 0xE;
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 0x10)) * track->instrument->pitchRatio;
|
||||
voice->clientVolume = VOL_MULT_3(player->fadeVolume >> 24, track->volumeLerp.current >> 16, voiceState->volume);
|
||||
voice->pitchRatio = au_compute_pitch_ratio(voiceState->pitch + (track->tuneLerp.current >> 16)) * track->instrument->pitchRatio;
|
||||
voice->pan = track->pan;
|
||||
voice->reverb = track->reverb;
|
||||
voice->instrument = track->instrument;
|
||||
voice->busId = manager->busId;
|
||||
voice->busID = manager->busID;
|
||||
voice->envelope.cmdListPress = track->envelope.cmdListPress;
|
||||
voice->envelope.cmdListRelease = track->envelope.cmdListRelease;
|
||||
voice->syncFlags = AU_VOICE_SYNC_FLAG_ALL;
|
|
@ -1,178 +1,123 @@
|
|||
// 2BF90.c
|
||||
void au_amb_manager_init(AmbienceManager* arg0, s8 arg1, s8 reverbType, AuGlobals* arg3);
|
||||
AuResult au_amb_check_player_index(u32 arg0);
|
||||
void au_amb_load_tracks_fade(s32 arg0, s32 arg1);
|
||||
void au_amb_set_disabled(s32 arg0, s32 arg1);
|
||||
AuResult au_amb_start(s32 arg0, s32 arg1);
|
||||
void au_amb_fade_setup(AmbiencePlayer* arg0);
|
||||
void au_amb_pause(s32 arg0, s32 arg1);
|
||||
void au_amb_resume(s32 arg0, s32 arg1);
|
||||
void au_amb_stop_quick(s32 arg0);
|
||||
void au_amb_stop_slow(s32 arg0, s32 arg1);
|
||||
void au_amb_set_volume(s32 arg0, s32 arg1, s32 arg2);
|
||||
AuResult au_amb_is_stopped(s32 arg0);
|
||||
void au_amb_play_sequence(AmbienceManager* arg0, MSEQHeader* mseq, s32 index);
|
||||
void au_amb_manager_update(AmbienceManager* arg0);
|
||||
void au_amb_load_track_fade_info(AmbienceManager* manager, AmbiencePlayer* lambda);
|
||||
void au_amb_player_update(AmbienceManager* manager, AmbiencePlayer* lambda);
|
||||
u8 au_amb_read_next(AmbiencePlayer* arg0);
|
||||
void au_amb_player_stop(AmbienceManager* arg0, AmbiencePlayer* arg1);
|
||||
void au_amb_save_voices(AmbienceManager* arg0, AmbiencePlayer* lambda);
|
||||
void au_amb_restore_voices(AmbienceManager* manager, AmbiencePlayer* lambda);
|
||||
#ifndef _AUDIO_PRIVATE_H_
|
||||
#define _AUDIO_PRIVATE_H_
|
||||
|
||||
// 2d9a0_len_890.c
|
||||
void au_update_stopped_voices(AuGlobals* globals);
|
||||
void au_init_voices(AuGlobals* globals);
|
||||
void au_update_voices(AuGlobals* globals);
|
||||
void au_voice_after_volume_change(AuVoice* arg0);
|
||||
s32 au_voice_get_delta(s32 arg0);
|
||||
void au_voice_start(AuVoice* voice, EnvelopeData* arg1);
|
||||
u8 au_voice_step(AuVoice* voice);
|
||||
void au_voice_set_vol_changed(AuVoice* arg0);
|
||||
|
||||
//2e230_len_2190.c
|
||||
void func_80052E30(u8 index);
|
||||
void au_engine_init(s32 outputRate);
|
||||
static void au_reset_instrument(Instrument* instrument);
|
||||
static void au_reset_drum_entry(BGMDrumInfo* arg0);
|
||||
static void au_reset_instrument_entry(BGMInstrumentInfo* arg0);
|
||||
void au_update_clients_2(void);
|
||||
void au_update_players_main(void);
|
||||
void au_syn_update(AuGlobals* globals);
|
||||
void au_reset_nonfree_voice(AuVoice* arg0, u8 arg1);
|
||||
void au_reset_voice(AuVoice* arg0, u8 arg1);
|
||||
f32 au_compute_pitch_ratio(s32 arg0);
|
||||
void au_fade_init(Fade* fade, s32 time, s32 startValue, s32 endValue);
|
||||
void au_fade_clear(Fade* fade);
|
||||
void au_fade_update(Fade* fade);
|
||||
void au_fade_set_volume(u8 arg0, u16 arg1, s32 arg2);
|
||||
void func_80053AC8(Fade* fade);
|
||||
void au_fade_set_vol_scale(Fade* fade, s16 value);
|
||||
void func_80053B04(Fade* fade, u32 arg1, s32 target);
|
||||
void func_80053BA8(Fade* fade);
|
||||
Instrument* au_get_instrument(AuGlobals* globals, u32 bank, u32 patch, EnvelopeData* arg3);
|
||||
void au_get_bgm_player_and_file(u32 playerIndex, BGMHeader** outCurrentTrackData, BGMPlayer** outPlayer);
|
||||
void au_get_bgm_player(u32 playerIndex, BGMPlayer** outPlayer);
|
||||
AuResult au_load_song_files(u32 arg0, BGMHeader* arg1, BGMPlayer* arg2);
|
||||
AuResult func_80053E58(s32 songID, BGMHeader* arg1);
|
||||
BGMPlayer* func_80053F64(s32 arg0);
|
||||
AuResult au_ambient_load(u32 arg0);
|
||||
BGMPlayer* func_80054248(u8 arg0);
|
||||
void au_load_INIT(AuGlobals* arg0, s32 romAddr, ALHeap* heap);
|
||||
AuResult au_fetch_SBN_file(u32 fileIdx, AuFileFormat format, SBNFileEntry* arg2);
|
||||
void au_load_PER(AuGlobals* globals, s32 romAddr);
|
||||
void au_load_PRG(AuGlobals* arg0, s32 romAddr);
|
||||
InstrumentGroup* au_get_BK_instruments(s32 bankGroup, u32 bankIndex);
|
||||
SoundBank* au_load_BK_to_bank(s32 bkFileOffset, SoundBank* bank, s32 bankIndex, s32 bankGroup);
|
||||
void au_swizzle_BK_instruments(s32 bkFileOffset, SoundBank* bank, InstrumentGroup instruments, u32 instrumentCount, u8 arg4);
|
||||
s32* func_80054AA0(s32* bkFileOffset, void* vaddr, s32 bankIndex, s32 bankGroup);
|
||||
s32 snd_load_BK(s32 bkFileOffset, s32 bankIndex);
|
||||
void func_80054C84(s32 bankIndex, s32 bankGroup);
|
||||
void func_80054CE0(s32 arg0, u32 idx);
|
||||
s32 func_80054D74(s32 arg0, s32 arg1);
|
||||
void func_80054DA8(u32 arg0);
|
||||
void au_read_rom(s32 romAddr, void* buffer, u32 size);
|
||||
void au_memset(void* dst, s32 size, u8 value);
|
||||
void au_copy_bytes(s8* src, s8* dest, s32 size);
|
||||
void au_copy_words(void* src, void* dst, s32 size);
|
||||
|
||||
// 25f00_len_940.c
|
||||
void create_audio_system(void);
|
||||
//void nuAuPreNMIFuncSet(NUAuPreNMIFunc func);
|
||||
void nuAuMgr(void* arg);
|
||||
s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 arg3);
|
||||
//ALDMAproc nuAuDmaNew(NUDMAState** state);
|
||||
//void nuAuCleanDMABuffers(void);
|
||||
//void nuAuPreNMIProc(NUScMsg mesg_type, u32 frameCounter);
|
||||
//void alLink(ALLink* element, ALLink* after);
|
||||
//void alUnlink(ALLink* element);
|
||||
|
||||
// 303c0_len_3e10.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
// load_banks.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void au_load_BK_headers(AuGlobals* arg0, ALHeap*);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// mseq_player.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void au_mseq_manager_init(AmbienceManager* arg0, s8 arg1, s8 reverbType, AuGlobals* arg3);
|
||||
AuResult au_mseq_check_player_index(u32 arg0);
|
||||
void au_mseq_load_tracks_fade(s32 arg0, s32 arg1);
|
||||
void au_mseq_set_disabled(s32 arg0, s32 arg1);
|
||||
AuResult au_mseq_start(s32 arg0, s32 arg1);
|
||||
void au_mseq_fade_setup(AmbiencePlayer* arg0);
|
||||
void au_mseq_pause(s32 arg0, s32 arg1);
|
||||
void au_mseq_resume(s32 arg0, s32 arg1);
|
||||
void au_mseq_stop_quick(s32 arg0);
|
||||
void au_mseq_stop_slow(s32 arg0, s32 arg1);
|
||||
void au_mseq_set_volume(s32 arg0, s32 arg1, s32 arg2);
|
||||
AuResult au_mseq_check_stopped(s32 arg0);
|
||||
void au_mseq_play_sequence(AmbienceManager* arg0, MSEQHeader* mseq, s32 index);
|
||||
void au_mseq_manager_audio_frame_update(AmbienceManager* arg0);
|
||||
void au_mseq_load_track_fade_info(AmbienceManager* manager, AmbiencePlayer* lambda);
|
||||
void au_mseq_player_update(AmbienceManager* manager, AmbiencePlayer* lambda);
|
||||
u8 au_mseq_read_next(AmbiencePlayer* arg0);
|
||||
void au_mseq_player_stop(AmbienceManager* arg0, AmbiencePlayer* arg1);
|
||||
void au_mseq_save_voices(AmbienceManager* arg0, AmbiencePlayer* lambda);
|
||||
void au_mseq_restore_voices(AmbienceManager* manager, AmbiencePlayer* lambda);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// sfx_player.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void au_sfx_init(SoundManager* manager, u8 arg1, u8 arg2, AuGlobals* arg3, u8 arg4);
|
||||
void au_sfx_load_groups_from_SEF(SoundManager* sndMgr);
|
||||
void au_sfx_clear_queue(SoundManager* manager);
|
||||
void au_sfx_enqueue_event(SoundManager* manager, u32 soundID, s16 volume, s16 pitchShift, u8 pan);
|
||||
void au_sfx_update_main(SoundManager* manager);
|
||||
void au_sfx_begin_video_frame(SoundManager* manager);
|
||||
s32 au_sfx_set_reverb_type(SoundManager* manager, s32 arg1);
|
||||
void au_sfx_set_state(SoundManager* manager, s32 arg1);
|
||||
void au_sfx_load_sound(SoundManager* manager, SoundSFXEntry* entry, SoundManagerCustomCmdList*);
|
||||
s16 au_sfx_manager_update(SoundManager* manager);
|
||||
void au_sfx_try_sound(SoundManager* manager, SoundRequest* request, SoundManagerCustomCmdList*);
|
||||
s16 au_sfx_manager_audio_frame_update(SoundManager* manager);
|
||||
|
||||
// 28910_len_5090.c
|
||||
void au_bgm_update_main(BGMPlayer* player);
|
||||
// ----------------------------------------------------------------------------------
|
||||
// bgm_player.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void au_bgm_begin_video_frame(BGMPlayer* player);
|
||||
BGMPlayer* au_bgm_get_player_with_song_name(s32 songString);
|
||||
AuResult au_bgm_dispatch_player_event(SongUpdateEvent* event);
|
||||
AuResult au_bgm_process_init_song(SongStartRequest* event);
|
||||
AuResult au_bgm_stop_song(s32 songName);
|
||||
void au_bgm_stop_all(void);
|
||||
AuResult au_bgm_is_song_playing(s32 songName);
|
||||
s32 func_8004DB28(BGMPlayer* player);
|
||||
AuResult func_8004DB4C(SongUpdateEvent* s);
|
||||
AuResult func_8004DC80(s32 songName);
|
||||
AuResult func_8004DCB8(SongUpdateEvent* update, s32 clearChanged);
|
||||
AuResult func_8004DE2C(SongUpdateEvent* update);
|
||||
void func_8004DFD4(AuGlobals* globals);
|
||||
AuResult func_8004E0F4(SongUpdateEvent* update);
|
||||
b32 au_bgm_player_is_active(BGMPlayer* player);
|
||||
AuResult au_bgm_process_fade_out(SongFadeOutRequest* s);
|
||||
AuResult au_bgm_complete_push(s32 songName);
|
||||
AuResult au_bgm_process_suspend(SongSuspendRequest* update, b32 skipStop);
|
||||
AuResult au_bgm_process_resume(SongResumeRequest* update);
|
||||
void au_bgm_restore_copied_player(AuGlobals* globals);
|
||||
AuResult au_bgm_adjust_volume(SongStartRequest* update);
|
||||
void au_bgm_player_init(BGMPlayer* player, s32 arg1, s32 arg2, AuGlobals* arg3);
|
||||
void au_bgm_set_effect_indices(BGMPlayer* player, u8* list);
|
||||
void au_bgm_update_fade(BGMPlayer* player);
|
||||
void func_8004E444(BGMPlayer* arg0);
|
||||
s32 au_bgm_player_update_main(BGMPlayer* player);
|
||||
void au_bgm_update_bus_volumes(BGMPlayer* arg0);
|
||||
s32 au_bgm_player_audio_frame_update(BGMPlayer* player);
|
||||
void au_bgm_player_initialize(BGMPlayer* player);
|
||||
void func_8004E844(BGMPlayer* player, s32 arg1);
|
||||
void func_8004E880(BGMPlayer* player, s32 sampleRate, s32 divisor);
|
||||
void au_bgm_player_read_segment(BGMPlayer* player);
|
||||
void au_bgm_end_segment_loop(BGMPlayer* player, u32 cmd);
|
||||
void au_bgm_load_subsegment(BGMPlayer* player, u32 cmd);
|
||||
void au_bgm_clear_custom_note_press(BGMPlayer* player, s32 arg1);
|
||||
void au_bgm_set_tick_resolution(BGMPlayer* player, s32 sampleRate, u32 resolution);
|
||||
void au_bgm_player_read_composition(BGMPlayer* player);
|
||||
void au_bgm_end_composition_loop(BGMPlayer* player, u32 cmd);
|
||||
void au_bgm_load_phrase(BGMPlayer* player, u32 cmd);
|
||||
void au_bgm_player_update_stop(BGMPlayer* player);
|
||||
void au_bgm_player_update_playing(BGMPlayer *player);
|
||||
void au_BGMCmd_E0_MasterTempo(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E1_MasterVolume(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E2_MasterPitchShift(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E2_MasterDetune(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E3(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E6_MasterEffect(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E4_MasterTempoFade(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E5_MasterVolumeFade(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E8_TrackOverridePatch(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E9_SubTrackVolume(BGMPlayer* arg0, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F6_TrackVolumeFade(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EA_SubTrackPan(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EB_SubTrackReverb(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EC_SegTrackVolume(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_ED_SubTrackCoarseTune(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EE_SubTrackFineTune(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EF_SegTrackTune(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_E9_InstrumentVolume(BGMPlayer* arg0, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F6_InstrumentVolumeLerp(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EA_InstrumentPan(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EB_InstrumentReverb(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EC_TrackVolume(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_ED_InstrumentCoarseTune(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EE_InstrumentFineTune(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_EC_TrackDetune(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F0_TrackTremolo(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F1_TrackTremoloSpeed(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F2_TrackTremoloTime(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F1_TrackTremoloRate(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F2_TrackTremoloDepth(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F3_TrackTremoloStop(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F4(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F5_TrackVoice(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F7_SubTrackReverbType(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F4_SubTrackRandomPan(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F5_UseInstrument(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_F7_ReverbType(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_FD_EventTrigger(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_FE_Detour(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_FC_Jump(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_FF(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_FC_Branch(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_FF_Special(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_BGMCmd_NOP(BGMPlayer* player, BGMPlayerTrack* track);
|
||||
void au_bgm_set_proximity_mix(s32 songName, u32 mix);
|
||||
void au_bgm_set_playback_rate(BGMPlayer* player, f32 arg1);
|
||||
void au_bgm_player_set_detune(BGMPlayer* player, s32 arg1);
|
||||
void au_bgm_change_track_volume(BGMPlayer* player, s32 trackIdx, s16 arg2, u8 arg3);
|
||||
void au_bgm_set_track_volumes(BGMPlayer* player, u8* arg1, s32 arg2);
|
||||
void func_80050888(BGMPlayer* player, BGMPlayerTrack* track, s32 target, s32 duration);
|
||||
void func_80050900(BGMPlayer* player);
|
||||
AuResult func_80050970(SongUpdateEvent* arg0);
|
||||
void au_bgm_set_prox_mix_fade(BGMPlayer* player, BGMPlayerTrack* track, s32 target, s32 duration);
|
||||
void au_bgm_reset_all_voices(BGMPlayer* player);
|
||||
AuResult au_bgm_set_linked_tracks(SongSwapLinkedRequest* arg0);
|
||||
|
||||
// 30450.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
// snd_interface.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void snd_bgm_clear_legacy_commands(BGMPlayer* player);
|
||||
/*
|
||||
void func_80055050(ALHeap* heap);
|
||||
void func_80055068(u32 arg0);
|
||||
*/
|
||||
void func_80055110(BGMPlayer* player);
|
||||
/*
|
||||
void func_8005513C(u32 arg0);
|
||||
void snd_notify_engine_ready(ALHeap* heap);
|
||||
void snd_legacy_sound_dispatch(u32 arg0);
|
||||
void snd_bgm_clear_legacy_commands(BGMPlayer* player);
|
||||
void snd_bgm_enqueue_legacy_command(u32 arg0);
|
||||
void snd_start_sound(s32 soundID, u8 volume, u8 pan);
|
||||
void snd_start_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void snd_adjust_sound(s32 soundID, u8 volume, u8 pan);
|
||||
|
@ -187,115 +132,63 @@ AuResult snd_ambient_stop_slow(s32 arg0, s32 arg1);
|
|||
AuResult snd_ambient_pause(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_resume(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_is_stopped(s32 arg0);
|
||||
AuResult snd_ambient_mute(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_fade_out(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_set_volume(s32 arg0, s32 arg1, s32 arg2);
|
||||
AuResult snd_ambient_disable(s32 arg0);
|
||||
AuResult snd_ambient_enable(s32 arg0);
|
||||
void snd_ambient_80055760(s32 arg0);
|
||||
AuResult snd_ambient_stop_all(s32 arg0);
|
||||
AuResult snd_ambient_play_only(s32 arg0);
|
||||
AuResult au_song_load(s32 songID, s32 playerIndex);
|
||||
AuResult au_song_start(s32 songName);
|
||||
AuResult au_song_start_variation(s32 songName, s32 variation);
|
||||
AuResult au_song_stop(s32 songName);
|
||||
void au_stop_songs(void);
|
||||
AuResult au_song_is_playing(s32 songName);
|
||||
AuResult snd_set_song_variation_fade(s32 songName, s32 variation, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_set_song_fade(s32 songName, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_set_song_variation_fade_time(s32 songName, s32 fadeTime, s32 variation);
|
||||
AuResult func_80055AF0(s32 songName);
|
||||
AuResult func_80055B28(s32 songName);
|
||||
AuResult func_80055B80(s32 songName);
|
||||
AuResult func_80055BB8(s32 songName, s32 fadeTime);
|
||||
AuResult func_80055BF0(s32 songName);
|
||||
AuResult func_80055C2C(s32 songName);
|
||||
AuResult func_80055C64(s32 songName);
|
||||
AuResult func_80055C94(s32 songName);
|
||||
AuResult snd_set_song_variation(s32 songName, s32 variation);
|
||||
void snd_ambient_radio_setup(s32 arg0);
|
||||
AuResult snd_ambient_radio_stop(s32 arg0);
|
||||
AuResult snd_ambient_radio_select(s32 arg0);
|
||||
AuResult snd_song_load(s32 songID, s32 playerIndex);
|
||||
AuResult snd_song_request_play_default(s32 songName);
|
||||
AuResult snd_song_request_play(s32 songName, s32 variation);
|
||||
AuResult snd_song_stop(s32 songName);
|
||||
void snd_song_stop_all(void);
|
||||
AuResult snd_song_is_playing(s32 songName);
|
||||
AuResult snd_song_request_fade_in(s32 songName, s32 variation, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_song_request_fade_in_default(s32 songName, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_song_request_fade_out(s32 songName, s32 fadeTime, AuCallback callback);
|
||||
AuResult snd_song_push_stop(s32 songName);
|
||||
AuResult snd_song_request_pop(s32 songName);
|
||||
AuResult snd_song_request_snapshot(s32 songName);
|
||||
AuResult snd_song_request_push_fade_out(s32 songName, s32 fadeTime);
|
||||
AuResult snd_song_request_pause(s32 songName);
|
||||
AuResult snd_song_request_unpause(s32 songName);
|
||||
AuResult snd_song_set_volume_quiet(s32 songName);
|
||||
AuResult snd_song_set_volume_full(s32 songName);
|
||||
AuResult snd_song_set_linked_mode(s32 songName, b32 mode);
|
||||
*/
|
||||
AuResult snd_song_get_playing_info(s32 songName, BGMHeader** outTrackData, BGMPlayer** outPlayer);
|
||||
/*
|
||||
AuResult snd_song_set_playback_rate(s32 songName, f32 arg1);
|
||||
*/
|
||||
AuResult snd_song_set_detune(s32 songName, s32 arg1);
|
||||
AuResult func_80055DDC(s32 songName, s32 arg1);
|
||||
AuResult snd_song_set_track_volumes(s32 songName, MusicTrackVols arg1);
|
||||
AuResult snd_song_clear_track_volumes(s32 songName, MusicTrackVols arg1);
|
||||
u8* func_80055EB4(MusicTrackVols arg0);
|
||||
static AuResult snd_song_change_track_volume(s32 arg0, u32 arg1, u32 arg2);
|
||||
AuResult snd_song_set_track_vol_mute(s32 arg0, s32 arg1);
|
||||
AuResult snd_song_set_track_vol_quiet(s32 arg0, s32 arg1);
|
||||
AuResult snd_song_set_track_vol_full(s32 arg0, s32 arg1);
|
||||
void bgm_set_proximity_mix_far(s32 songName, s32 mix);
|
||||
void bgm_set_proximity_mix_near(s32 songName, s32 mix);
|
||||
void bgm_set_proximity_mix_full(s32 songName, s32 mix);
|
||||
void bgm_poll_music_events(u32** arg0, s32* arg1);
|
||||
void bgm_flush_music_events(void);
|
||||
void music_event_trigger(s32 arg0, s32 arg1, s32 arg2);
|
||||
void func_8005610C(void);
|
||||
*/
|
||||
void au_register_callback(AuCallback arg0, s32 arg1);
|
||||
void snd_song_set_proximity_mix_far(s32 songName, s32 mix);
|
||||
void snd_song_set_proximity_mix_near(s32 songName, s32 mix);
|
||||
void snd_song_set_proximity_mix_full(s32 songName, s32 mix);
|
||||
/*
|
||||
void audio_set_stereo(void);
|
||||
void audio_set_mono(void);
|
||||
void func_800561A4(s32 arg0);
|
||||
void func_800561C4(s32 arg0);
|
||||
void func_800561E4(s32 arg0);
|
||||
void enable_sounds(void);
|
||||
void disable_sounds(void);
|
||||
void snd_song_poll_music_events(u32** arg0, s32* arg1);
|
||||
void snd_song_flush_music_events(void);
|
||||
void snd_song_trigger_music_event(s32 playerID, s32 trackIndex, s32 eventInfo);
|
||||
void snd_song_clear_music_events(void);
|
||||
void snd_register_callback(AuCallback func, s32 index);
|
||||
void snd_set_stereo(void);
|
||||
void snd_set_mono(void);
|
||||
void snd_set_bgm_volume(s32 arg0);
|
||||
void snd_set_sfx_volume(s32 arg0);
|
||||
void snd_set_sfx_reverb_type(s32 arg0);
|
||||
void snd_enable_sfx(void);
|
||||
void snd_disable_sfx(void);
|
||||
*/
|
||||
|
||||
// 31650.c
|
||||
void au_driver_init(AuSynDriver* driver, ALConfig* config);
|
||||
void au_driver_release(void);
|
||||
//Acmd* alAudioFrame(Acmd* cmdList, s32* cmdLen, s16* outBuf, s32 outLen);
|
||||
void au_use_global_volume(void);
|
||||
void au_set_global_volume(s16 arg0);
|
||||
s16 au_get_global_volume(void);
|
||||
void func_80056D5C(u8 arg0);
|
||||
void au_bus_set_volume(u8 arg0, u16 arg1);
|
||||
u16 au_bus_get_volume(u8 arg0, u16 arg1);
|
||||
void au_bus_set_effect(u8 arg0, u8 effectID);
|
||||
void au_bus_set_fx_params(u8 arg0, s16 arg1, s16 arg2, s32 arg3);
|
||||
void au_pvoice_set_bus(u8 arg0, s8 arg1);
|
||||
void au_syn_stop_voice(u8 voiceIdx);
|
||||
void au_syn_start_voice(u8 index);
|
||||
void au_syn_start_voice_params(u8 index, u8 reverbType, Instrument* table, f32 pitch, s16 vol, u8 pan, u8 fxMix, s32 delta);
|
||||
void au_syn_set_wavetable(u8 voiceIdx, Instrument* table);
|
||||
void au_syn_set_pitch(u8 voiceIdx, f32 pitchRatio);
|
||||
void au_syn_set_mixer_params(u8 voiceIdx, s16 volume, s32 arg2, u8 arg3, u8 arg4);
|
||||
void au_syn_set_pan_fxmix(u8 voiceIdx, u8 arg1, u8 arg2);
|
||||
void au_syn_set_volume_delta(u8 voiceIdx, s16 arg1, s32 arg2);
|
||||
void au_syn_set_pan(u8 voiceIdx, u8 pan);
|
||||
void au_syn_set_fxmix(u8 voiceIdx, u8 dryAmt);
|
||||
s32 au_syn_get_playing(u8 voiceIdx);
|
||||
s32 au_syn_get_bus(u8 voiceIdx);
|
||||
f32 au_syn_get_pitch(u8 voiceIdx);
|
||||
u8 au_syn_get_pan(u8 voiceIdx);
|
||||
s16 au_syn_get_dryamt(u8 voiceIdx);
|
||||
s16 au_syn_get_wetamt(u8 voiceIdx);
|
||||
s32 au_syn_get_volume_left(u8 voiceIdx);
|
||||
s32 au_syn_get_volume_right(u8 voiceIdx);
|
||||
void au_set_delay_time(s32 arg0);
|
||||
void au_delay_left_channel(u8 arg0);
|
||||
void au_delay_right_channel(u8 arg0);
|
||||
void au_disable_channel_delay(void);
|
||||
void au_delay_channel(s16 arg0);
|
||||
//void alHeapInit(ALHeap* hp, u8* base, s32 len);
|
||||
//void alCopy(void* src, void* dst, s32 size);
|
||||
#undef alHeapAlloc
|
||||
void* alHeapAlloc(ALHeap* heap, s32 arg1, s32 size);
|
||||
|
||||
// 33450.c
|
||||
Acmd* au_pull_voice(AuPVoice* pvoice, Acmd* cmdBufPos);
|
||||
|
||||
// reverb.c
|
||||
void func_80058E84(AuFX* fx, u8 mode, ALHeap* heap);
|
||||
void func_80058F88(AlUnkKappa* kappa, ALHeap* heap);
|
||||
void func_80059008(AlUnkKappa* kappa, s16 arg1, s16 arg2, s16 fc);
|
||||
void func_8005904C(AuFX* fx, u8 effectType);
|
||||
Acmd* au_pull_fx(AuFX* fx, Acmd* cmdBusPos, s16, s16);
|
||||
s32 au_fx_param_hdl(AuFX* fx, s16 index, s16 paramID, s32 value);
|
||||
|
||||
// sfx.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
// sfx_control.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
/*
|
||||
void sfx_reset_door_sounds(void);
|
||||
void sfx_clear_sounds(void);
|
||||
|
@ -307,10 +200,10 @@ void sfx_stop_env_sounds(void);
|
|||
*/
|
||||
SoundInstance* sfx_get_env_sound_instance(s32 soundID);
|
||||
/*
|
||||
void sfx_play_sound_looping(s32 soundId, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_play_sound_looping(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_register_looping_sound_at_position(s32 soundID, s32 flags, f32 x, f32 y, f32 z);
|
||||
s32 sfx_adjust_env_sound_pos(s32 soundID, s32 sourceFlags, f32 x, f32 y, f32 z);
|
||||
void snd_stop_tracking_env_sound_pos(s32 soundID, s32 keepPlaying);
|
||||
void sfx_stop_tracking_env_sound_pos(s32 soundID, s32 keepPlaying);
|
||||
void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_adjust_env_sound_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_stop_sound(s32 soundID);
|
||||
|
@ -323,3 +216,5 @@ void sfx_compute_spatialized_sound_params_ignore_depth(f32 x, f32 y, f32 z, s16*
|
|||
void sfx_compute_spatialized_sound_params_with_depth(f32 x, f32 y, f32 z, s16* volume, s16* pan);
|
||||
void sfx_compute_spatialized_sound_params_full(f32 x, f32 y, f32 z, s16* volume, s16* pan, s32 flags);
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
#ifndef _AUDIO_PUBLIC_H_
|
||||
#define _AUDIO_PUBLIC_H_
|
||||
|
||||
// 30450.c
|
||||
void func_80055050(ALHeap* heap);
|
||||
void func_80055068(u32 arg0);
|
||||
//void func_80055110(BGMPlayer* player);
|
||||
void func_8005513C(u32 arg0);
|
||||
#include "audio.h"
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// snd_interface.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void snd_notify_engine_ready(ALHeap* heap);
|
||||
void snd_legacy_sound_dispatch(u32 id);
|
||||
//void snd_bgm_clear_legacy_commands(BGMPlayer* player);
|
||||
void snd_bgm_enqueue_legacy_command(u32 cmd);
|
||||
void snd_start_sound(s32 soundID, u8 volume, u8 pan);
|
||||
void snd_start_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void snd_adjust_sound(s32 soundID, u8 volume, u8 pan);
|
||||
|
@ -20,56 +24,84 @@ AuResult snd_ambient_stop_slow(s32 arg0, s32 arg1);
|
|||
AuResult snd_ambient_pause(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_resume(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_is_stopped(s32 arg0);
|
||||
AuResult snd_ambient_mute(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_fade_out(s32 arg0, s32 arg1);
|
||||
AuResult snd_ambient_set_volume(s32 arg0, s32 arg1, s32 arg2);
|
||||
AuResult snd_ambient_disable(s32 arg0);
|
||||
AuResult snd_ambient_enable(s32 arg0);
|
||||
void snd_ambient_80055760(s32 arg0);
|
||||
AuResult snd_ambient_stop_all(s32 arg0);
|
||||
AuResult snd_ambient_play_only(s32 arg0);
|
||||
AuResult au_song_load(s32 songID, s32 playerIndex);
|
||||
AuResult au_song_start(s32 songName);
|
||||
AuResult au_song_start_variation(s32 songName, s32 variation);
|
||||
AuResult au_song_stop(s32 songName);
|
||||
void au_stop_songs(void);
|
||||
AuResult au_song_is_playing(s32 songName);
|
||||
AuResult snd_set_song_variation_fade(s32 songName, s32 variation, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_set_song_fade(s32 songName, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_set_song_variation_fade_time(s32 songName, s32 fadeTime, s32 variation);
|
||||
AuResult func_80055AF0(s32 songName);
|
||||
AuResult func_80055B28(s32 songName);
|
||||
AuResult func_80055B80(s32 songName);
|
||||
AuResult func_80055BB8(s32 songName, s32 fadeTime);
|
||||
AuResult func_80055BF0(s32 songName);
|
||||
AuResult func_80055C2C(s32 songName);
|
||||
AuResult func_80055C64(s32 songName);
|
||||
AuResult func_80055C94(s32 songName);
|
||||
AuResult snd_set_song_variation(s32 songName, s32 variation);
|
||||
void snd_ambient_radio_setup(s32 arg0);
|
||||
AuResult snd_ambient_radio_stop(s32 arg0);
|
||||
AuResult snd_ambient_radio_select(s32 arg0);
|
||||
/// return value may be either an AuResult error code OR a valid songName
|
||||
AuResult snd_song_load(s32 songID, s32 playerIndex);
|
||||
AuResult snd_song_request_play_default(s32 songName);
|
||||
AuResult snd_song_request_play(s32 songName, s32 variation);
|
||||
AuResult snd_song_stop(s32 songName);
|
||||
void snd_song_stop_all(void);
|
||||
AuResult snd_song_is_playing(s32 songName);
|
||||
AuResult snd_song_request_fade_in(s32 songName, s32 variation, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_song_request_fade_in_default(s32 songName, s32 fadeInTime, s32 startVolume, s32 endVolume);
|
||||
AuResult snd_song_request_fade_out(s32 songName, s32 fadeTime, AuCallback callback);
|
||||
AuResult snd_song_push_stop(s32 songName);
|
||||
AuResult snd_song_request_pop(s32 songName);
|
||||
AuResult snd_song_request_snapshot(s32 songName);
|
||||
AuResult snd_song_request_push_fade_out(s32 songName, s32 fadeTime);
|
||||
AuResult snd_song_request_pause(s32 songName);
|
||||
AuResult snd_song_request_unpause(s32 songName);
|
||||
AuResult snd_song_set_volume_quiet(s32 songName);
|
||||
AuResult snd_song_set_volume_full(s32 songName);
|
||||
AuResult snd_song_set_linked_mode(s32 songName, b32 mode);
|
||||
//AuResult snd_song_get_playing_info(s32 songName, BGMHeader** outTrackData, BGMPlayer** outPlayer);
|
||||
AuResult snd_song_set_playback_rate(s32 songName, f32 arg1);
|
||||
/*
|
||||
AuResult snd_song_set_detune(s32 songName, s32 arg1);
|
||||
AuResult snd_song_set_track_volumes(s32 songName, MusicTrackVols arg1);
|
||||
AuResult snd_song_clear_track_volumes(s32 songName, MusicTrackVols arg1);
|
||||
AuResult snd_song_set_track_vol_mute(s32 arg0, s32 arg1);
|
||||
AuResult snd_song_set_track_vol_quiet(s32 arg0, s32 arg1);
|
||||
AuResult snd_song_set_track_vol_full(s32 arg0, s32 arg1);
|
||||
void bgm_set_proximity_mix_far(s32 songName, s32 mix);
|
||||
void bgm_set_proximity_mix_near(s32 songName, s32 mix);
|
||||
void bgm_set_proximity_mix_full(s32 songName, s32 mix);
|
||||
void bgm_poll_music_events(u32** arg0, s32* arg1);
|
||||
void bgm_flush_music_events(void);
|
||||
void bgm_trigger_music_event(s32 arg0, s32 arg1, s32 arg2);
|
||||
void bgm_clear_music_events(void);
|
||||
//void func_80056144(AuCallback arg0, s32 arg1);
|
||||
void audio_set_stereo(void);
|
||||
void audio_set_mono(void);
|
||||
void func_800561A4(s32 arg0);
|
||||
void func_800561C4(s32 arg0);
|
||||
void func_800561E4(s32 arg0);
|
||||
void enable_sounds(void);
|
||||
void disable_sounds(void);
|
||||
void snd_song_set_proximity_mix_far(s32 songName, s32 mix);
|
||||
void snd_song_set_proximity_mix_near(s32 songName, s32 mix);
|
||||
void snd_song_set_proximity_mix_full(s32 songName, s32 mix);
|
||||
*/
|
||||
void snd_song_poll_music_events(u32** arg0, s32* arg1);
|
||||
void snd_song_flush_music_events(void);
|
||||
void snd_song_trigger_music_event(s32 playerID, s32 trackIndex, s32 eventInfo);
|
||||
void snd_song_clear_music_events(void);
|
||||
//void snd_register_callback(AuCallback func, s32 index);
|
||||
void snd_set_stereo(void);
|
||||
void snd_set_mono(void);
|
||||
void snd_set_bgm_volume(VolumeLevels volume);
|
||||
void snd_set_sfx_volume(VolumeLevels volume);
|
||||
void snd_set_sfx_reverb_type(s32 arg0);
|
||||
void snd_enable_sfx(void);
|
||||
void snd_disable_sfx(void);
|
||||
|
||||
// sfx.h
|
||||
// ----------------------------------------------------------------------------------
|
||||
// bgm_control.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
AuResult bgm_set_track_volumes(s32 playerIndex, s16 trackVolSet);
|
||||
AuResult bgm_clear_track_volumes(s32 playerIndex, s16 trackVolSet);
|
||||
AuResult bgm_set_linked_mode(s32 playerIndex, b16 mode);
|
||||
void bgm_quiet_max_volume(void);
|
||||
void bgm_reset_max_volume(void);
|
||||
void bgm_reset_volume(void);
|
||||
s32 bgm_init_music_players(void);
|
||||
s32 bgm_set_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume);
|
||||
void bgm_set_battle_song(s32, s32);
|
||||
void bgm_push_battle_song(void);
|
||||
s32 bgm_adjust_proximity(s32 playerIndex, s32 arg1, s16 arg2);
|
||||
b32 bgm_fade_in_song(s32 playerIndex, s32 songID, s32 variation, s32 fadeInTime, s16 arg4, s16 arg5);
|
||||
|
||||
void bgm_update_music_control(void);
|
||||
b32 bgm_is_any_song_playing(void);
|
||||
void bgm_reset_sequence_players(void);
|
||||
void bgm_pop_song(void);
|
||||
void bgm_push_song(s32 songID, s32 variation);
|
||||
void bgm_pop_battle_song(void);
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// sfx_control.c
|
||||
// ----------------------------------------------------------------------------------
|
||||
void sfx_reset_door_sounds(void);
|
||||
void sfx_clear_sounds(void);
|
||||
void sfx_clear_env_sounds(s16 playSounds);
|
||||
|
@ -78,10 +110,10 @@ void sfx_set_reverb_mode(s32 arg0);
|
|||
s32 sfx_get_reverb_mode(void);
|
||||
void sfx_stop_env_sounds(void);
|
||||
//SoundInstance* sfx_get_env_sound_instance(s32 soundID);
|
||||
void sfx_play_sound_looping(s32 soundId, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_play_sound_looping(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_register_looping_sound_at_position(s32 soundID, s32 flags, f32 x, f32 y, f32 z);
|
||||
s32 sfx_adjust_env_sound_pos(s32 soundID, s32 sourceFlags, f32 x, f32 y, f32 z);
|
||||
void snd_stop_tracking_env_sound_pos(s32 soundID, s32 keepPlaying);
|
||||
void sfx_stop_tracking_env_sound_pos(s32 soundID, s32 keepPlaying);
|
||||
void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_adjust_env_sound_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift);
|
||||
void sfx_stop_sound(s32 soundID);
|
||||
|
|
|
@ -350,7 +350,7 @@ void sfx_update_env_sound_params(void) {
|
|||
}
|
||||
|
||||
void sfx_set_reverb_mode(s32 mode) {
|
||||
func_800561E4(mode);
|
||||
snd_set_sfx_reverb_type(mode);
|
||||
SfxReverbMode = mode;
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ s32 sfx_adjust_env_sound_pos(s32 soundID, s32 sourceFlags, f32 x, f32 y, f32 z)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void snd_stop_tracking_env_sound_pos(s32 soundID, s32 keepPlaying) {
|
||||
void sfx_stop_tracking_env_sound_pos(s32 soundID, s32 keepPlaying) {
|
||||
SoundInstance* sound = sfx_get_env_sound_instance(soundID);
|
||||
|
||||
if (sound != NULL) {
|
||||
|
@ -462,12 +462,11 @@ void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
|
|||
return;
|
||||
}
|
||||
|
||||
if (soundID & SOUND_TYPE_SPECIAL) {
|
||||
if (soundID & SOUND_ID_TYPE_FLAG) {
|
||||
s32 soundIndex = soundID & 0xFF;
|
||||
s32 soundType = (soundID & 0x70000000) >> 0x1C;
|
||||
s32 soundType = (soundID & SOUND_ID_TYPE_MASK) >> 0x1C;
|
||||
switch (soundType) {
|
||||
case SOUND_TYPE_LOOPING:
|
||||
// 0x8xxxxxxx
|
||||
sfx_play_sound_looping(LoopingSounds[soundIndex], volume, pan, pitchShift);
|
||||
return;
|
||||
case SOUND_TYPE_EXIT_DOOR:
|
||||
|
@ -477,7 +476,6 @@ void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
|
|||
soundID = OpenCloseSounds[gCurrentRoomDoorSounds][soundIndex];
|
||||
break;
|
||||
case SOUND_TYPE_ALTERNATING:
|
||||
// 0xBxxxxxxx
|
||||
alternatingSet = &AlternatingSounds[soundIndex];
|
||||
if (alternatingSet->curIndex >= alternatingSet->soundCount) {
|
||||
alternatingSet->curIndex = 0;
|
||||
|
@ -492,7 +490,7 @@ void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
|
|||
void sfx_adjust_env_sound_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift) {
|
||||
SoundInstance* sound;
|
||||
|
||||
if (soundID & SOUND_TYPE_SPECIAL) {
|
||||
if (soundID & SOUND_ID_TYPE_FLAG) {
|
||||
sound = sfx_get_env_sound_instance(LoopingSounds[soundID & 0xFFFF]);
|
||||
if (sound != NULL) {
|
||||
sound->volume = volume;
|
||||
|
@ -507,8 +505,8 @@ void sfx_adjust_env_sound_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
|
|||
void sfx_stop_sound(s32 soundID) {
|
||||
s32 sound = soundID;
|
||||
|
||||
if (sound & SOUND_TYPE_SPECIAL) {
|
||||
snd_stop_tracking_env_sound_pos(LoopingSounds[sound & 0xFFFF], FALSE);
|
||||
if (sound & SOUND_ID_TYPE_FLAG) {
|
||||
sfx_stop_tracking_env_sound_pos(LoopingSounds[sound & 0xFFFF], FALSE);
|
||||
} else {
|
||||
snd_stop_sound(sound);
|
||||
}
|
||||
|
@ -533,7 +531,7 @@ void sfx_play_sound_at_npc(s32 soundID, s32 flags, s32 npcID) {
|
|||
}
|
||||
|
||||
void sfx_play_sound_at_position(s32 soundID, s32 flags, f32 posX, f32 posY, f32 posZ) {
|
||||
if ((soundID & 0xF0000000) == SOUND_TYPE_SPECIAL) {
|
||||
if ((soundID & (SOUND_ID_TYPE_FLAG | SOUND_ID_TYPE_MASK)) == (SOUND_ID_TYPE_FLAG | SOUND_TYPE_LOOPING)) {
|
||||
s32 id = LoopingSounds[soundID & 0xFFFF];
|
||||
|
||||
sfx_register_looping_sound_at_position(id, flags, posX, posY, posZ);
|
||||
|
@ -589,8 +587,8 @@ void sfx_get_spatialized_sound_params(f32 x, f32 y, f32 z, s16* volume, s16* pan
|
|||
if (*pan < 1) {
|
||||
*pan = 1;
|
||||
}
|
||||
if (*pan > 127) {
|
||||
*pan = 127;
|
||||
if (*pan > AU_PAN_MAX) {
|
||||
*pan = AU_PAN_MAX;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,34 +1,39 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "audio/core.h"
|
||||
|
||||
static u8* snd_song_get_track_volumes_set(MusicTrackVols arg0);
|
||||
|
||||
/// While TRUE, the audio thread skips BGM player updates.
|
||||
/// Used by the game thread to lock out BGM updates while modifying player state,
|
||||
/// to prevent race conditions.
|
||||
s32 PreventBGMPlayerUpdate = FALSE;
|
||||
u16 D_80078DB4 = 0;
|
||||
u16 AuAmbiencePlayOnlyIndex = 0;
|
||||
|
||||
u16 SoundEngineReady = 0;
|
||||
u16 AmbienceRadioChannel = 0;
|
||||
|
||||
// lists of data:
|
||||
// u8 trackIdx
|
||||
// u8 volume?
|
||||
// u8 volume
|
||||
// repeated until idx = 0
|
||||
u8 D_80078DB8[] = {
|
||||
u8 TrackVols_JAN_Full[] = {
|
||||
2, 94,
|
||||
3, 80,
|
||||
4, 100,
|
||||
5, 84,
|
||||
0
|
||||
};
|
||||
u8 D_80078DC4[] = {
|
||||
u8 TrackVols_Unused1[] = {
|
||||
2, 100,
|
||||
3, 110,
|
||||
4, 90,
|
||||
0
|
||||
};
|
||||
u8 D_80078DCC[] = {
|
||||
u8 TrackVols_TIK_Shiver[] = {
|
||||
2, 95,
|
||||
0
|
||||
};
|
||||
u8 D_80078DD0[] = {
|
||||
u8 TrackVols_Unused3[] = {
|
||||
5, 70,
|
||||
6, 90,
|
||||
7, 90,
|
||||
|
@ -100,29 +105,32 @@ u8 TrackVols_KPA_3[] = {
|
|||
0
|
||||
};
|
||||
|
||||
void func_80055050(ALHeap* heap) {
|
||||
D_80078DB4 = 1;
|
||||
void snd_notify_engine_ready(ALHeap* heap) {
|
||||
SoundEngineReady = 1;
|
||||
PreventBGMPlayerUpdate = FALSE;
|
||||
}
|
||||
|
||||
void func_80055068(u32 arg0) {
|
||||
u16 temp_a0 = D_80078DB4;
|
||||
u32 temp_v1 = arg0 & 0xF;
|
||||
/// Unused
|
||||
/// Seems to be an early function that accepts a command to play any kind of audio asset,
|
||||
// but only BGM and SFX are supported.
|
||||
void snd_legacy_sound_dispatch(u32 id) {
|
||||
u16 ready = SoundEngineReady;
|
||||
u32 type = id & 0xF;
|
||||
|
||||
if (temp_a0 == 1) {
|
||||
switch (temp_v1) {
|
||||
if (ready == 1) {
|
||||
switch (type) {
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
snd_start_sound_with_shift(arg0 >> 4, 0, 0, 0);
|
||||
snd_start_sound_with_shift(id >> 4, 0, 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
if (temp_v1 == 1) {
|
||||
s32 filename = au_song_load((arg0 >> 4) & 0xFF, 0);
|
||||
if (type == 1) {
|
||||
s32 filename = snd_song_load((id >> 4) & 0xFF, 0);
|
||||
|
||||
if (filename > ASCII_TO_U32('0', ' ', ' ', '\0')) {
|
||||
au_song_start_variation(filename, (arg0 >> 0xC) & 3);
|
||||
snd_song_request_play(filename, (id >> 0xC) & 3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -130,53 +138,58 @@ void func_80055068(u32 arg0) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_80055110(BGMPlayer* player) {
|
||||
/// Part of an unused system for inter-thread communication with a BGM player using commands.
|
||||
/// Use functions in bgm_control to manipualte gMusicControlData instead.
|
||||
void snd_bgm_clear_legacy_commands(BGMPlayer* player) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(player->unk_238); i++) {
|
||||
player->unk_238[i] = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(player->cmdBufData); i++) {
|
||||
player->cmdBufData[i] = 0;
|
||||
}
|
||||
|
||||
player->unk_25B = 0;
|
||||
player->unk_25A = 0;
|
||||
player->unk_259 = 0;
|
||||
player->unk_258 = 0;
|
||||
player->cmdBufOverflows = 0;
|
||||
player->cmdBufWritePos = 0;
|
||||
player->cmdBufReadPos = 0;
|
||||
player->cmdBufPending = 0;
|
||||
}
|
||||
|
||||
void func_8005513C(u32 arg0) {
|
||||
/// Unused
|
||||
/// Part of an unused system for inter-thread communication with a BGM player using commands.
|
||||
/// Use functions in bgm_control to manipualte gMusicControlData instead.
|
||||
void snd_bgm_enqueue_legacy_command(u32 cmd) {
|
||||
BGMPlayer* player = NULL;
|
||||
u32 playerSwitch = arg0 & 0xF;
|
||||
u32 playerID = cmd & 0xF;
|
||||
|
||||
if (playerSwitch != 0) {
|
||||
if (playerSwitch == 1) {
|
||||
player = gBGMPlayerA;
|
||||
} else if (playerSwitch == 2) {
|
||||
player = gBGMPlayerB;
|
||||
}
|
||||
if (playerID == 0) {
|
||||
return;
|
||||
} else if (playerID == 1) {
|
||||
player = gBGMPlayerA;
|
||||
} else if (playerID == 2) {
|
||||
player = gBGMPlayerB;
|
||||
}
|
||||
|
||||
if (player != NULL) {
|
||||
u32 temp;
|
||||
if (player != NULL) {
|
||||
u32 pos;
|
||||
|
||||
if (player->unk_258 < 8) {
|
||||
temp = player->unk_25A;
|
||||
if (player->cmdBufPending < ARRAY_COUNT(player->cmdBufData)) {
|
||||
pos = player->cmdBufWritePos;
|
||||
|
||||
player->unk_238[temp] = arg0 >> 4;
|
||||
player->cmdBufData[pos] = cmd >> 4;
|
||||
|
||||
temp++;
|
||||
if (temp >= 8) {
|
||||
temp = 0;
|
||||
}
|
||||
player->unk_25A = temp;
|
||||
|
||||
player->unk_258++;
|
||||
} else {
|
||||
temp = player->unk_25B + 1;
|
||||
|
||||
if (temp > 99) {
|
||||
temp = 99;
|
||||
}
|
||||
player->unk_25B = temp;
|
||||
pos++;
|
||||
if (pos >= 8) {
|
||||
pos = 0;
|
||||
}
|
||||
player->cmdBufWritePos = pos;
|
||||
|
||||
player->cmdBufPending++;
|
||||
} else {
|
||||
pos = player->cmdBufOverflows + 1;
|
||||
|
||||
if (pos > 99) {
|
||||
pos = 99;
|
||||
}
|
||||
player->cmdBufOverflows = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,8 +202,8 @@ void snd_start_sound(s32 soundID, u8 volume, u8 pan) {
|
|||
vol |= 0xFF;
|
||||
}
|
||||
|
||||
if (pan > 0x7F) {
|
||||
pan = 0x7F;
|
||||
if (pan > AU_PAN_MAX) {
|
||||
pan = AU_PAN_MAX;
|
||||
}
|
||||
|
||||
au_sfx_enqueue_event(soundManager, soundID, vol, 0, pan);
|
||||
|
@ -204,14 +217,14 @@ void snd_start_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
|
|||
vol |= 0xFF;
|
||||
}
|
||||
|
||||
if (pan > 0x7F) {
|
||||
pan = 0x7F;
|
||||
if (pan > AU_PAN_MAX) {
|
||||
pan = AU_PAN_MAX;
|
||||
}
|
||||
|
||||
if (pitchShift > 2400) {
|
||||
pitchShift = 2400;
|
||||
} else if (pitchShift < -2400) {
|
||||
pitchShift = -2400;
|
||||
if (pitchShift > 2 * AU_OCTAVE_CENTS) {
|
||||
pitchShift = 2 * AU_OCTAVE_CENTS;
|
||||
} else if (pitchShift < -2 * AU_OCTAVE_CENTS) {
|
||||
pitchShift = -2 * AU_OCTAVE_CENTS;
|
||||
}
|
||||
|
||||
au_sfx_enqueue_event(soundManager, soundID, vol, pitchShift, pan);
|
||||
|
@ -225,8 +238,8 @@ void snd_adjust_sound(s32 soundID, u8 volume, u8 pan) {
|
|||
vol |= 0xFF;
|
||||
}
|
||||
|
||||
if (pan > 0x7F) {
|
||||
pan = 0x7F;
|
||||
if (pan > AU_PAN_MAX) {
|
||||
pan = AU_PAN_MAX;
|
||||
}
|
||||
|
||||
au_sfx_enqueue_event(soundManager, soundID | SOUND_ID_ADJUST, vol, 0, pan);
|
||||
|
@ -240,14 +253,14 @@ void snd_adjust_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
|
|||
vol |= 0xFF;
|
||||
}
|
||||
|
||||
if (pan > 0x7F) {
|
||||
pan = 0x7F;
|
||||
if (pan > AU_PAN_MAX) {
|
||||
pan = AU_PAN_MAX;
|
||||
}
|
||||
|
||||
if (pitchShift > 2400) {
|
||||
pitchShift = 2400;
|
||||
} else if (pitchShift < -2400) {
|
||||
pitchShift = -2400;
|
||||
if (pitchShift > 2 * AU_OCTAVE_CENTS) {
|
||||
pitchShift = 2 * AU_OCTAVE_CENTS;
|
||||
} else if (pitchShift < -2 * AU_OCTAVE_CENTS) {
|
||||
pitchShift = -2 * AU_OCTAVE_CENTS;
|
||||
}
|
||||
|
||||
au_sfx_enqueue_event(soundManager, soundID | SOUND_ID_ADJUST, vol, pitchShift, pan);
|
||||
|
@ -274,127 +287,125 @@ AuResult snd_load_ambient(s32 ambSoundID) {
|
|||
}
|
||||
|
||||
AuResult snd_ambient_play(s32 index, s32 fadeInTime) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status != AU_RESULT_OK) {
|
||||
return status;
|
||||
}
|
||||
return au_amb_start(index, fadeInTime);
|
||||
return au_mseq_start(index, fadeInTime);
|
||||
}
|
||||
|
||||
AuResult snd_ambient_stop_quick(s32 index) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_stop_quick(index);
|
||||
au_mseq_stop_quick(index);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_stop_slow(s32 index, s32 fadeOutTime) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_stop_slow(index, fadeOutTime);
|
||||
au_mseq_stop_slow(index, fadeOutTime);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_pause(s32 index, s32 fadeOutTime) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_pause(index, fadeOutTime);
|
||||
au_mseq_pause(index, fadeOutTime);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_resume(s32 index, s32 fadeInTime) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_resume(index, fadeInTime);
|
||||
au_mseq_resume(index, fadeInTime);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_is_stopped(s32 index) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status != AU_RESULT_OK) {
|
||||
return status;
|
||||
}
|
||||
return au_amb_is_stopped(index);
|
||||
return au_mseq_check_stopped(index);
|
||||
}
|
||||
|
||||
// TODO perhaps inaccurate name
|
||||
AuResult snd_ambient_mute(s32 index, s32 arg1) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult snd_ambient_fade_out(s32 index, s32 arg1) {
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_load_tracks_fade(index, arg1);
|
||||
au_mseq_load_tracks_fade(index, arg1);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_set_volume(s32 index, s32 time, s32 volume) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_set_volume(index, time, volume);
|
||||
au_mseq_set_volume(index, time, volume);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_disable(s32 index) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_set_disabled(index, TRUE);
|
||||
au_mseq_set_disabled(index, TRUE);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_enable(s32 index) {
|
||||
AuResult status = au_amb_check_player_index(index);
|
||||
AuResult status = au_mseq_check_player_index(index);
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
au_amb_set_disabled(index, FALSE);
|
||||
au_mseq_set_disabled(index, FALSE);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
// snd_ambient_init_tracks ?
|
||||
void snd_ambient_80055760(s32 index) {
|
||||
void snd_ambient_radio_setup(s32 index) {
|
||||
s32 radioChannels = 4;
|
||||
u32 i;
|
||||
s32 lim = 4;
|
||||
|
||||
AuAmbiencePlayOnlyIndex = 0xFF;
|
||||
AmbienceRadioChannel = 0xFF;
|
||||
|
||||
for (i = 0; i < lim; i++) {
|
||||
for (i = 0; i < radioChannels; i++) {
|
||||
if (snd_ambient_play(i, 0) != AU_RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
snd_ambient_play_only(index);
|
||||
snd_ambient_radio_select(index);
|
||||
}
|
||||
|
||||
AuResult snd_ambient_stop_all(s32 time) {
|
||||
AuResult snd_ambient_radio_stop(s32 time) {
|
||||
AuResult status = AU_RESULT_OK;
|
||||
s32 lim = 4;
|
||||
s32 radioChannels = 4;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < lim; i++) {
|
||||
if (i == AuAmbiencePlayOnlyIndex) {
|
||||
for (i = 0; i < radioChannels; i++) {
|
||||
if (i == AmbienceRadioChannel) {
|
||||
status = snd_ambient_stop_slow(i, time);
|
||||
} else {
|
||||
status = snd_ambient_stop_quick(i);
|
||||
|
@ -406,14 +417,14 @@ AuResult snd_ambient_stop_all(s32 time) {
|
|||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_ambient_play_only(s32 index) {
|
||||
AuResult snd_ambient_radio_select(s32 index) {
|
||||
AuResult status = AU_RESULT_OK;
|
||||
s32 lim = 4;
|
||||
s32 radioChannels = 4;
|
||||
|
||||
if (index != AuAmbiencePlayOnlyIndex) {
|
||||
if (index != AmbienceRadioChannel) {
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < lim; i++) {
|
||||
for (i = 0; i < radioChannels; i++) {
|
||||
if (i == index) {
|
||||
status = snd_ambient_enable(i);
|
||||
} else {
|
||||
|
@ -426,14 +437,14 @@ AuResult snd_ambient_play_only(s32 index) {
|
|||
}
|
||||
|
||||
if (status == AU_RESULT_OK) {
|
||||
AuAmbiencePlayOnlyIndex = index;
|
||||
AmbienceRadioChannel = index;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult au_song_load(s32 songID, s32 playerIndex) {
|
||||
AuResult snd_song_load(s32 songID, s32 playerIndex) {
|
||||
BGMHeader* bgmFile;
|
||||
BGMPlayer* player;
|
||||
|
||||
|
@ -446,55 +457,58 @@ AuResult au_song_load(s32 songID, s32 playerIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
AuResult au_song_start(s32 songName) {
|
||||
/// Unused -- snd_song_request_play but always uses BGM_VARIATION_0
|
||||
AuResult snd_song_request_play_default(s32 songName) {
|
||||
AuResult status;
|
||||
SongUpdateEvent s;
|
||||
SongStartRequest s;
|
||||
|
||||
PreventBGMPlayerUpdate = TRUE;
|
||||
s.songName = songName;
|
||||
s.duration = 0;
|
||||
s.startVolume = 127;
|
||||
s.finalVolume = 127;
|
||||
s.variation = 0;
|
||||
s.unk14 = 0;
|
||||
status = au_bgm_dispatch_player_event(&s);
|
||||
s.startVolume = AU_MAX_VOLUME_8;
|
||||
s.finalVolume = AU_MAX_VOLUME_8;
|
||||
s.variation = BGM_VARIATION_0;
|
||||
s.unused_14 = 0;
|
||||
status = au_bgm_process_init_song(&s);
|
||||
PreventBGMPlayerUpdate = FALSE;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult au_song_start_variation(s32 songName, s32 variation) {
|
||||
/// Called from bgm_control to start playing a particular song + variation
|
||||
AuResult snd_song_request_play(s32 songName, s32 variation) {
|
||||
AuResult status;
|
||||
SongUpdateEvent s;
|
||||
SongStartRequest s;
|
||||
|
||||
PreventBGMPlayerUpdate = TRUE;
|
||||
s.songName = songName;
|
||||
s.duration = 0;
|
||||
s.startVolume = 127;
|
||||
s.finalVolume = 127;
|
||||
s.startVolume = AU_MAX_VOLUME_8;
|
||||
s.finalVolume = AU_MAX_VOLUME_8;
|
||||
s.variation = variation;
|
||||
s.unk14 = 0;
|
||||
status = au_bgm_dispatch_player_event(&s);
|
||||
s.unused_14 = 0;
|
||||
status = au_bgm_process_init_song(&s);
|
||||
PreventBGMPlayerUpdate = FALSE;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult au_song_stop(s32 songName) {
|
||||
AuResult snd_song_stop(s32 songName) {
|
||||
return au_bgm_stop_song(songName);
|
||||
}
|
||||
|
||||
void au_stop_songs(void) {
|
||||
void snd_song_stop_all(void) {
|
||||
au_bgm_stop_all();
|
||||
}
|
||||
|
||||
AuResult au_song_is_playing(s32 songName) {
|
||||
AuResult snd_song_is_playing(s32 songName) {
|
||||
return au_bgm_is_song_playing(songName);
|
||||
}
|
||||
|
||||
AuResult snd_set_song_variation_fade(s32 songName, s32 variation, s32 fadeInTime, s32 startVolume, s32 endVolume) {
|
||||
/// Called from bgm_control to fade in a particular song + variation
|
||||
AuResult snd_song_request_fade_in(s32 songName, s32 variation, s32 fadeInTime, s32 startVolume, s32 endVolume) {
|
||||
AuResult status;
|
||||
SongUpdateEvent s;
|
||||
SongStartRequest s;
|
||||
|
||||
PreventBGMPlayerUpdate = TRUE;
|
||||
s.songName = songName;
|
||||
|
@ -502,16 +516,17 @@ AuResult snd_set_song_variation_fade(s32 songName, s32 variation, s32 fadeInTime
|
|||
s.startVolume = startVolume;
|
||||
s.finalVolume = endVolume;
|
||||
s.variation = variation;
|
||||
s.unk14 = 0;
|
||||
status = au_bgm_dispatch_player_event(&s);
|
||||
s.unused_14 = 0;
|
||||
status = au_bgm_process_init_song(&s);
|
||||
PreventBGMPlayerUpdate = FALSE;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_set_song_fade(s32 songName, s32 fadeInTime, s32 startVolume, s32 endVolume) {
|
||||
/// Unused
|
||||
AuResult snd_song_request_fade_in_default(s32 songName, s32 fadeInTime, s32 startVolume, s32 endVolume) {
|
||||
AuResult status;
|
||||
SongUpdateEvent s;
|
||||
SongStartRequest s;
|
||||
|
||||
PreventBGMPlayerUpdate = TRUE;
|
||||
s.songName = songName;
|
||||
|
@ -519,117 +534,135 @@ AuResult snd_set_song_fade(s32 songName, s32 fadeInTime, s32 startVolume, s32 en
|
|||
s.startVolume = startVolume;
|
||||
s.finalVolume = endVolume;
|
||||
s.variation = 0;
|
||||
s.unk14 = 0;
|
||||
status = au_bgm_dispatch_player_event(&s);
|
||||
s.unused_14 = 0;
|
||||
status = au_bgm_process_init_song(&s);
|
||||
PreventBGMPlayerUpdate = FALSE;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult snd_set_song_variation_fade_time(s32 songName, s32 fadeTime, s32 variation) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_request_fade_out(s32 songName, s32 fadeTime, AuCallback callback) {
|
||||
SongFadeOutRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = fadeTime;
|
||||
s.startVolume = 0;
|
||||
s.unused_08 = 0;
|
||||
s.finalVolume = 0;
|
||||
s.variation = variation;
|
||||
s.unk14 = 0;
|
||||
return func_8004DB4C(&s);
|
||||
s.doneCallback = callback;
|
||||
s.onPush = FALSE;
|
||||
|
||||
return au_bgm_process_fade_out(&s);
|
||||
}
|
||||
|
||||
AuResult func_80055AF0(s32 songName) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_push_stop(s32 songName) {
|
||||
SongSuspendRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = 0;
|
||||
s.startVolume = 0;
|
||||
s.finalVolume = 0;
|
||||
s.variation = 0;
|
||||
s.unk14 = 0;
|
||||
return func_8004DCB8(&s, 0);
|
||||
s.index = BGM_SNAPSHOT_0;
|
||||
s.pauseMode = FALSE;
|
||||
|
||||
return au_bgm_process_suspend(&s, FALSE); // force stop
|
||||
}
|
||||
|
||||
AuResult func_80055B28(s32 songName) {
|
||||
AuResult snd_song_request_pop(s32 songName) {
|
||||
AuResult status;
|
||||
SongUpdateEvent s;
|
||||
SongResumeRequest s;
|
||||
|
||||
PreventBGMPlayerUpdate = TRUE;
|
||||
s.songName = songName;
|
||||
s.duration = 2000;
|
||||
s.startVolume = 1;
|
||||
s.finalVolume = 127;
|
||||
s.variation = 0;
|
||||
s.unk14 = 0;
|
||||
status = func_8004DE2C(&s);
|
||||
s.finalVolume = AU_MAX_VOLUME_8;
|
||||
s.index = BGM_SNAPSHOT_0;
|
||||
s.pauseMode = FALSE;
|
||||
status = au_bgm_process_resume(&s);
|
||||
PreventBGMPlayerUpdate = FALSE;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
AuResult func_80055B80(s32 songName) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_request_snapshot(s32 songName) {
|
||||
SongSuspendRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = 0;
|
||||
s.startVolume = 0;
|
||||
s.finalVolume = 0;
|
||||
s.variation = 0;
|
||||
s.unk14 = 0;
|
||||
return func_8004DCB8(&s, 1);
|
||||
s.index = BGM_SNAPSHOT_0;
|
||||
s.pauseMode = FALSE;
|
||||
|
||||
return au_bgm_process_suspend(&s, TRUE); // no stop
|
||||
}
|
||||
|
||||
AuResult func_80055BB8(s32 songName, s32 fadeTime) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_request_push_fade_out(s32 songName, s32 fadeTime) {
|
||||
SongFadeOutRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = fadeTime;
|
||||
s.startVolume = 0;
|
||||
s.unused_08 = 0;
|
||||
s.finalVolume = 0;
|
||||
s.variation = 0;
|
||||
s.unk14 = 1;
|
||||
return func_8004DB4C(&s);
|
||||
s.doneCallback = NULL;
|
||||
s.onPush = TRUE;
|
||||
|
||||
return au_bgm_process_fade_out(&s);
|
||||
}
|
||||
|
||||
AuResult func_80055BF0(s32 songName) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_request_pause(s32 songName) {
|
||||
SongSuspendRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = 0;
|
||||
s.startVolume = 0;
|
||||
s.finalVolume = 0;
|
||||
s.variation = 0;
|
||||
s.unk14 = 1;
|
||||
return func_8004DCB8(&s, 0);
|
||||
s.index = BGM_SNAPSHOT_0;
|
||||
s.pauseMode = TRUE;
|
||||
|
||||
return au_bgm_process_suspend(&s, FALSE); // force stop
|
||||
}
|
||||
|
||||
AuResult func_80055C2C(s32 songName) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_request_unpause(s32 songName) {
|
||||
SongResumeRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = 0;
|
||||
s.startVolume = 0;
|
||||
s.finalVolume = 0;
|
||||
s.variation = 0;
|
||||
s.unk14 = 1;
|
||||
return func_8004DE2C(&s);
|
||||
s.index = BGM_SNAPSHOT_0;
|
||||
s.pauseMode = TRUE;
|
||||
|
||||
return au_bgm_process_resume(&s);
|
||||
}
|
||||
|
||||
AuResult func_80055C64(s32 songName) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_set_volume_quiet(s32 songName) {
|
||||
SongStartRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = 500;
|
||||
s.finalVolume = 0x2000;
|
||||
return func_8004E0F4(&s);
|
||||
s.finalVolume = 0.25001 * AU_MAX_VOLUME_16;
|
||||
|
||||
return au_bgm_adjust_volume(&s);
|
||||
}
|
||||
|
||||
AuResult func_80055C94(s32 songName) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_set_volume_full(s32 songName) {
|
||||
SongStartRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.duration = 500;
|
||||
s.finalVolume = 0x7FFF;
|
||||
return func_8004E0F4(&s);
|
||||
s.finalVolume = AU_MAX_VOLUME_16;
|
||||
|
||||
return au_bgm_adjust_volume(&s);
|
||||
}
|
||||
|
||||
AuResult snd_set_song_variation(s32 songName, s32 variation) {
|
||||
SongUpdateEvent s;
|
||||
AuResult snd_song_set_linked_mode(s32 songName, b32 mode) {
|
||||
SongSwapLinkedRequest s;
|
||||
|
||||
s.songName = songName;
|
||||
s.variation = variation;
|
||||
return func_80050970(&s);
|
||||
s.enabled = mode;
|
||||
|
||||
return au_bgm_set_linked_tracks(&s);
|
||||
}
|
||||
|
||||
// get file and player information for a given song name if it's currently playing
|
||||
|
@ -725,17 +758,17 @@ static u8* snd_song_get_track_volumes_set(MusicTrackVols trackVolSet) {
|
|||
u8* trackVols = NULL;
|
||||
|
||||
switch (trackVolSet) {
|
||||
case TRACK_VOLS_0:
|
||||
trackVols = D_80078DB8;
|
||||
case TRACK_VOLS_JAN_FULL:
|
||||
trackVols = TrackVols_JAN_Full;
|
||||
break;
|
||||
case TRACK_VOLS_1:
|
||||
trackVols = D_80078DC4;
|
||||
case TRACK_VOLS_UNUSED_1:
|
||||
trackVols = TrackVols_Unused1;
|
||||
break;
|
||||
case TRACK_VOLS_2:
|
||||
trackVols = D_80078DCC;
|
||||
case TRACK_VOLS_TIK_SHIVER:
|
||||
trackVols = TrackVols_TIK_Shiver;
|
||||
break;
|
||||
case TRACK_VOLS_3:
|
||||
trackVols = D_80078DD0;
|
||||
case TRACK_VOLS_UNUSED_3:
|
||||
trackVols = TrackVols_Unused3;
|
||||
break;
|
||||
case TRACK_VOLS_KPA_OUTSIDE:
|
||||
trackVols = TrackVols_KPA_Outside;
|
||||
|
@ -754,8 +787,6 @@ static u8* snd_song_get_track_volumes_set(MusicTrackVols trackVolSet) {
|
|||
return trackVols;
|
||||
}
|
||||
|
||||
static const f32 padding[] = {0.0f};
|
||||
|
||||
static AuResult snd_song_change_track_volume(s32 songName, u32 trackIdx, u32 volume) {
|
||||
BGMPlayer* bgmPlayer;
|
||||
BGMHeader* bgmFile;
|
||||
|
@ -763,8 +794,8 @@ static AuResult snd_song_change_track_volume(s32 songName, u32 trackIdx, u32 vol
|
|||
|
||||
status = snd_song_get_playing_info(songName, &bgmFile, &bgmPlayer);
|
||||
if (status == AU_RESULT_OK) {
|
||||
if (volume > 0x7F) {
|
||||
volume = 0x7F;
|
||||
if (volume > AU_MAX_VOLUME_8) {
|
||||
volume = AU_MAX_VOLUME_8;
|
||||
}
|
||||
if (trackIdx > 15) {
|
||||
trackIdx = 15;
|
||||
|
@ -779,46 +810,46 @@ AuResult snd_song_set_track_vol_mute(s32 songName, s32 trackIdx) {
|
|||
}
|
||||
|
||||
AuResult snd_song_set_track_vol_quiet(s32 songName, s32 trackIdx) {
|
||||
return snd_song_change_track_volume(songName, trackIdx, 0x3F);
|
||||
return snd_song_change_track_volume(songName, trackIdx, AU_MAX_VOLUME_8 / 2);
|
||||
}
|
||||
|
||||
AuResult snd_song_set_track_vol_full(s32 songName, s32 trackIdx) {
|
||||
return snd_song_change_track_volume(songName, trackIdx, 0x7F);
|
||||
return snd_song_change_track_volume(songName, trackIdx, AU_MAX_VOLUME_8);
|
||||
}
|
||||
|
||||
void bgm_set_proximity_mix_far(s32 songName, s32 mix) {
|
||||
void snd_song_set_proximity_mix_far(s32 songName, s32 mix) {
|
||||
au_bgm_set_proximity_mix(songName, (u8)mix);
|
||||
}
|
||||
|
||||
void bgm_set_proximity_mix_near(s32 songName, s32 mix) {
|
||||
au_bgm_set_proximity_mix(songName, (u8)mix | 0x57000000);
|
||||
void snd_song_set_proximity_mix_near(s32 songName, s32 mix) {
|
||||
au_bgm_set_proximity_mix(songName, (u8)mix | ((s32)(0.69f * AU_MAX_VOLUME_8) << 24));
|
||||
}
|
||||
|
||||
void bgm_set_proximity_mix_full(s32 songName, s32 mix) {
|
||||
au_bgm_set_proximity_mix(songName, (u8)mix | 0x7F000000);
|
||||
void snd_song_set_proximity_mix_full(s32 songName, s32 mix) {
|
||||
au_bgm_set_proximity_mix(songName, (u8)mix | (AU_MAX_VOLUME_8 << 24));
|
||||
}
|
||||
|
||||
void bgm_poll_music_events(MusicEventTrigger** musicEvents, s32* count) {
|
||||
void snd_song_poll_music_events(MusicEventTrigger** musicEvents, s32* count) {
|
||||
AuGlobals* globals = gSoundGlobals;
|
||||
|
||||
*musicEvents = globals->musicEventQueue;
|
||||
*count = globals->musicEventQueueCount;
|
||||
}
|
||||
|
||||
void bgm_flush_music_events(void) {
|
||||
void snd_song_flush_music_events(void) {
|
||||
gSoundGlobals->flushMusicEventQueue = TRUE;
|
||||
}
|
||||
|
||||
void bgm_trigger_music_event(s32 playerID, s32 trackIndex, s32 eventInfo) {
|
||||
void snd_song_trigger_music_event(s32 playerID, s32 trackIndex, s32 eventInfo) {
|
||||
AuGlobals* globals = gSoundGlobals;
|
||||
|
||||
if (globals->musicEventQueueCount < 16) {
|
||||
*globals->musicEventQueuePos++ = ((playerID << 0x1C) + ((trackIndex & 0xF) << 0x18) + eventInfo);
|
||||
if (globals->musicEventQueueCount < MUS_QUEUE_SIZE) {
|
||||
*globals->musicEventQueuePos++ = ((playerID << 28) + ((trackIndex & 0xF) << 24) + eventInfo);
|
||||
globals->musicEventQueueCount++;
|
||||
}
|
||||
}
|
||||
|
||||
void bgm_clear_music_events(void) {
|
||||
void snd_song_clear_music_events(void) {
|
||||
AuGlobals* globals = gSoundGlobals;
|
||||
s32* buf = globals->musicEventQueue;
|
||||
s32 i = 15;
|
||||
|
@ -832,36 +863,38 @@ void bgm_clear_music_events(void) {
|
|||
globals->musicEventQueuePos = globals->musicEventQueue;
|
||||
}
|
||||
|
||||
void au_register_callback(AuCallback func, s32 index) {
|
||||
static const f32 padding[] = {0.0f};
|
||||
|
||||
void snd_register_callback(AuCallback func, s32 index) {
|
||||
gSoundGlobals->audioThreadCallbacks[index] = func;
|
||||
}
|
||||
|
||||
void audio_set_stereo(void) {
|
||||
func_80056D5C(1);
|
||||
func_80054DA8(0);
|
||||
void snd_set_stereo(void) {
|
||||
au_set_stereo_enabled(TRUE);
|
||||
au_sync_channel_delay_enabled(0);
|
||||
}
|
||||
|
||||
void audio_set_mono(void) {
|
||||
func_80056D5C(0);
|
||||
func_80054DA8(1);
|
||||
void snd_set_mono(void) {
|
||||
au_set_stereo_enabled(FALSE);
|
||||
au_sync_channel_delay_enabled(1);
|
||||
}
|
||||
|
||||
void func_800561A4(s32 arg0) {
|
||||
func_80054CE0(1, arg0);
|
||||
void snd_set_bgm_volume(VolumeLevels volume) {
|
||||
au_set_bus_volume_level(AUDIO_TYPE_BGM, volume);
|
||||
}
|
||||
|
||||
void func_800561C4(s32 arg0) {
|
||||
func_80054CE0(0x10, arg0);
|
||||
void snd_set_sfx_volume(VolumeLevels volume) {
|
||||
au_set_bus_volume_level(AUDIO_TYPE_SFX, volume);
|
||||
}
|
||||
|
||||
void func_800561E4(s32 arg0) {
|
||||
func_80054D74(0x10, arg0);
|
||||
void snd_set_sfx_reverb_type(s32 reverbType) {
|
||||
au_set_reverb_type(AUDIO_TYPE_SFX, reverbType);
|
||||
}
|
||||
|
||||
void enable_sounds(void) {
|
||||
void snd_enable_sfx(void) {
|
||||
au_sfx_set_state(gSoundManager, SND_MANAGER_STATE_ENABLED);
|
||||
}
|
||||
|
||||
void disable_sounds(void) {
|
||||
void snd_disable_sfx(void) {
|
||||
au_sfx_set_state(gSoundManager, SND_MANAGER_STATE_DISABLED);
|
||||
}
|
|
@ -1355,7 +1355,7 @@ API_CALLABLE(N(ManageFakeoutMusic)) {
|
|||
// play 'end battle' song
|
||||
if (isInitialCall) {
|
||||
sfx_play_sound(SOUND_JINGLE_WON_BATTLE);
|
||||
bgm_set_song(0, SONG_BATTLE_END, 0, 500, 8);
|
||||
bgm_set_song(0, SONG_BATTLE_END, 0, 500, VOL_LEVEL_FULL);
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
||||
|
@ -1366,7 +1366,7 @@ API_CALLABLE(N(ManageFakeoutMusic)) {
|
|||
return ApiStatus_BLOCK;
|
||||
case 340:
|
||||
// restart the boss theme with the more intense variation
|
||||
bgm_set_song(0, SONG_LAVA_PIRANHA_BATTLE, 1, 500, 8);
|
||||
bgm_set_song(0, SONG_LAVA_PIRANHA_BATTLE, 1, 500, VOL_LEVEL_FULL);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "audio/public.h"
|
||||
#include "script_api/battle.h"
|
||||
#include "ld_addrs.h"
|
||||
#include "effects.h"
|
||||
|
@ -1926,7 +1928,7 @@ void btl_state_update_victory(void) {
|
|||
}
|
||||
if (gBattleStatus.flags1 & BS_FLAGS1_DISABLE_CELEBRATION) {
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_DONT_STOP_MUSIC)) {
|
||||
bgm_set_song(0, -1, 0, 1500, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 1500, VOL_LEVEL_FULL);
|
||||
}
|
||||
btl_set_state(BATTLE_STATE_END_BATTLE);
|
||||
} else {
|
||||
|
@ -2044,7 +2046,7 @@ void btl_state_update_end_training_battle(void) {
|
|||
}
|
||||
encounterStatus->battleOutcome = OUTCOME_ENEMY_FLED;
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_DONT_STOP_MUSIC)) {
|
||||
bgm_set_song(0, -1, 0, 1500, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 1500, VOL_LEVEL_FULL);
|
||||
}
|
||||
btl_set_state(BATTLE_STATE_END_BATTLE);
|
||||
break;
|
||||
|
@ -2330,7 +2332,7 @@ void btl_state_update_run_away(void) {
|
|||
if (gBattleSubState == BTL_SUBSTATE_RUN_AWAY_DONE) {
|
||||
playerData->battlesFled++;
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_DONT_STOP_MUSIC)) {
|
||||
bgm_set_song(0, -1, 0, 1500, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 1500, VOL_LEVEL_FULL);
|
||||
}
|
||||
btl_set_state(BATTLE_STATE_END_BATTLE);
|
||||
}
|
||||
|
@ -2442,7 +2444,7 @@ void btl_state_update_defeat(void) {
|
|||
if (gBattleSubState == BTL_SUBSTATE_DEFEAT_DONE) {
|
||||
currentEncounter->battleOutcome = OUTCOME_PLAYER_LOST;
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_DONT_STOP_MUSIC)) {
|
||||
bgm_set_song(0, -1, 0, 1500, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 1500, VOL_LEVEL_FULL);
|
||||
}
|
||||
btl_set_state(BATTLE_STATE_END_BATTLE);
|
||||
}
|
||||
|
|
|
@ -401,10 +401,10 @@ API_CALLABLE(N(ProcessPeachStarBeam)) {
|
|||
script->functionTemp[FT_DELAY]--;
|
||||
if (script->functionTemp[FT_DELAY] == 0) {
|
||||
if (!script->functionTemp[FT_IS_PEACH_BEAM]) {
|
||||
snd_stop_tracking_env_sound_pos(SOUND_LRAW_USE_STAR_BEAM, TRUE);
|
||||
sfx_stop_tracking_env_sound_pos(SOUND_LRAW_USE_STAR_BEAM, TRUE);
|
||||
sfx_play_sound(SOUND_LRAW_USE_STAR_BEAM | SOUND_ID_TRIGGER_CHANGE_SOUND);
|
||||
} else {
|
||||
snd_stop_tracking_env_sound_pos(SOUND_LRAW_USE_PEACH_BEAM, TRUE);
|
||||
sfx_stop_tracking_env_sound_pos(SOUND_LRAW_USE_PEACH_BEAM, TRUE);
|
||||
sfx_play_sound(SOUND_LRAW_USE_PEACH_BEAM | SOUND_ID_TRIGGER_CHANGE_SOUND);
|
||||
}
|
||||
}
|
||||
|
@ -444,9 +444,9 @@ API_CALLABLE(N(ProcessPeachStarBeam)) {
|
|||
}
|
||||
|
||||
if (!script->functionTemp[FT_IS_PEACH_BEAM]) {
|
||||
snd_stop_tracking_env_sound_pos(SOUND_LRAW_USE_STAR_BEAM, FALSE);
|
||||
sfx_stop_tracking_env_sound_pos(SOUND_LRAW_USE_STAR_BEAM, FALSE);
|
||||
} else {
|
||||
snd_stop_tracking_env_sound_pos(SOUND_LRAW_USE_PEACH_BEAM, FALSE);
|
||||
sfx_stop_tracking_env_sound_pos(SOUND_LRAW_USE_PEACH_BEAM, FALSE);
|
||||
}
|
||||
script->functionTemp[FT_STATE] = PEACH_STAR_BEAM_SPIRITS_SCATTER;
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "audio/public.h"
|
||||
#include "effects.h"
|
||||
#include "hud_element.h"
|
||||
#include "message_ids.h"
|
||||
|
@ -675,9 +677,9 @@ void btl_state_update_celebration(void) {
|
|||
|
||||
prevSP = playerData->starPoints + battleStatus->totalStarPoints;
|
||||
if (prevSP > 99) {
|
||||
bgm_set_song(0, SONG_LEVEL_UP, 0, 250, 8);
|
||||
bgm_set_song(0, SONG_LEVEL_UP, 0, 250, VOL_LEVEL_FULL);
|
||||
} else {
|
||||
bgm_set_song(0, SONG_BATTLE_END, 0, 250, 8);
|
||||
bgm_set_song(0, SONG_BATTLE_END, 0, 250, VOL_LEVEL_FULL);
|
||||
}
|
||||
|
||||
CelebrateStateTime = 0;
|
||||
|
@ -1251,7 +1253,7 @@ void btl_state_update_celebration(void) {
|
|||
script->owner1.actorID = ACTOR_PARTNER;
|
||||
}
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_DONT_STOP_MUSIC)) {
|
||||
bgm_set_song(0, -1, 0, 2000, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 2000, VOL_LEVEL_FULL);
|
||||
}
|
||||
bFadeToBlackAmt = 0;
|
||||
gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_FADE_OUT;
|
||||
|
@ -1348,7 +1350,7 @@ void btl_state_update_celebration(void) {
|
|||
}
|
||||
if (CelebrateStateTime >= 99) {
|
||||
if (!(gBattleStatus.flags2 & BS_FLAGS2_DONT_STOP_MUSIC)) {
|
||||
bgm_set_song(0, -1, 0, 1500, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 1500, VOL_LEVEL_FULL);
|
||||
}
|
||||
bFadeToBlackAmt = 0;
|
||||
btl_cam_set_params(TRUE, 270, 100, 8, 0, 0x2400, 0, 100);
|
||||
|
|
|
@ -16,7 +16,7 @@ typedef struct {
|
|||
/* 0xC */ s32 unkC;
|
||||
} AmbientSoundSettings;
|
||||
|
||||
BSS MusicSettings gMusicSettings[2];
|
||||
BSS MusicControlData gMusicControlData[2];
|
||||
BSS IMG_BIN D_80159B50[0x200];
|
||||
BSS Window gWindows[64];
|
||||
BSS CollisionStatus gCollisionStatus;
|
||||
|
|
|
@ -325,7 +325,7 @@ void crash_screen_init(void) {
|
|||
gCrashScreen.height = 16;
|
||||
gCrashScreen.frameBuf = (u16*)((osMemSize | 0xA0000000) - ((SCREEN_WIDTH * SCREEN_HEIGHT) * 2));
|
||||
osCreateMesgQueue(&gCrashScreen.queue, &gCrashScreen.mesg, 1);
|
||||
osCreateThread(&gCrashScreen.thread, 2, crash_screen_thread_entry, NULL,
|
||||
osCreateThread(&gCrashScreen.thread, THREAD_ID_CRASH, crash_screen_thread_entry, NULL,
|
||||
gCrashScreen.stack + sizeof(gCrashScreen.stack), 0x80);
|
||||
osStartThread(&gCrashScreen.thread);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "battle/battle.h"
|
||||
#include "script_api/battle.h"
|
||||
#include "audio.h"
|
||||
#include "audio/public.h"
|
||||
#include "npc.h"
|
||||
#include "effects.h"
|
||||
#include "hud_element.h"
|
||||
|
@ -519,7 +521,7 @@ void update_encounters_neutral(void) {
|
|||
}
|
||||
} while (0);
|
||||
|
||||
currentEncounter->songID = -1;
|
||||
currentEncounter->songID = AU_SONG_NONE;
|
||||
currentEncounter->unk_18 = -1;
|
||||
currentEncounter->hitType = 0;
|
||||
currentEncounter->forbidFleeing = FALSE;
|
||||
|
@ -1365,7 +1367,7 @@ void update_encounters_pre_battle(void) {
|
|||
}
|
||||
|
||||
// start battle music
|
||||
if (currentEncounter->songID < 0) {
|
||||
if (currentEncounter->songID <= AU_SONG_NONE) {
|
||||
switch (currentEncounter->firstStrikeType) {
|
||||
case FIRST_STRIKE_NONE:
|
||||
bgm_set_battle_song(SONG_NORMAL_BATTLE, FIRST_STRIKE_NONE);
|
||||
|
@ -1378,7 +1380,7 @@ void update_encounters_pre_battle(void) {
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
bgm_set_battle_song(currentEncounter->songID, FIRST_STRIKE_NONE);
|
||||
bgm_set_battle_song(currentEncounter->songID, BGM_VARIATION_0);
|
||||
}
|
||||
bgm_push_battle_song();
|
||||
HasPreBattleSongPushed = TRUE;
|
||||
|
|
|
@ -144,7 +144,7 @@ void func_802BB314_E2DC44(Entity* entity) {
|
|||
|
||||
void func_802BB34C_E2DC7C(void) {
|
||||
sfx_play_sound(SOUND_LRAW_SPINNING_FLOWER | SOUND_ID_TRIGGER_CHANGE_SOUND);
|
||||
snd_stop_tracking_env_sound_pos(SOUND_LRAW_SPINNING_FLOWER, TRUE);
|
||||
sfx_stop_tracking_env_sound_pos(SOUND_LRAW_SPINNING_FLOWER, TRUE);
|
||||
}
|
||||
|
||||
void entity_PinkFlowerLight_setupGfx(s32 entityIndex) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
|
||||
API_CALLABLE(PollMusicEvents);
|
||||
|
||||
|
@ -20,7 +21,7 @@ API_CALLABLE(PollMusicEvents) {
|
|||
u32 count;
|
||||
s32 i;
|
||||
|
||||
bgm_poll_music_events(&list, &count);
|
||||
snd_song_poll_music_events(&list, &count);
|
||||
|
||||
for (i = 0; i < count; i++, list++) {
|
||||
MusicEvent* cur = MusicEventList;
|
||||
|
@ -46,7 +47,7 @@ API_CALLABLE(PollMusicEvents) {
|
|||
}
|
||||
}
|
||||
}
|
||||
bgm_flush_music_events();
|
||||
snd_song_flush_music_events();
|
||||
MusicEventPollCount++;
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
|
@ -72,14 +73,14 @@ API_CALLABLE(FadeOutMusic) {
|
|||
s32 musicPlayer = evt_get_variable(script, *args++);
|
||||
s32 fadeTime = evt_get_variable(script, *args++);
|
||||
|
||||
if (bgm_set_song(musicPlayer, -1, 0, fadeTime, 8)) {
|
||||
if (bgm_set_song(musicPlayer, AU_SONG_NONE, 0, fadeTime, VOL_LEVEL_FULL)) {
|
||||
return ApiStatus_DONE2;
|
||||
} else {
|
||||
return ApiStatus_BLOCK;
|
||||
}
|
||||
}
|
||||
|
||||
API_CALLABLE(SetMusicTrack) {
|
||||
API_CALLABLE(SetMusic) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s32 musicPlayer = evt_get_variable(script, *args++);
|
||||
s32 songID = evt_get_variable(script, *args++);
|
||||
|
@ -102,7 +103,7 @@ API_CALLABLE(FadeInMusic) {
|
|||
s16 fadeStartVolume = evt_get_variable(script, *args++);
|
||||
s16 fadeEndVolume = evt_get_variable(script, *args++);
|
||||
|
||||
if (func_8014A964(musicPlayer, songID, variation, fadeTime, fadeStartVolume, fadeEndVolume)) {
|
||||
if (bgm_fade_in_song(musicPlayer, songID, variation, fadeTime, fadeStartVolume, fadeEndVolume)) {
|
||||
return ApiStatus_DONE2;
|
||||
} else {
|
||||
return ApiStatus_BLOCK;
|
||||
|
@ -113,7 +114,7 @@ API_CALLABLE(EnableMusicProximityMix) {
|
|||
Bytecode* args = script->ptrReadPos;
|
||||
s32 playerIndex = evt_get_variable(script, *args++);
|
||||
|
||||
gMusicSettings[playerIndex].flags |= MUSIC_SETTINGS_FLAG_ENABLE_PROXIMITY_MIX;
|
||||
gMusicControlData[playerIndex].flags |= MUSIC_FLAG_ENABLE_PROX_MIX;
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
@ -127,7 +128,7 @@ API_CALLABLE(AdjustMusicProximityMix) {
|
|||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
API_CALLABLE(SetMusicTrackVolumes) {
|
||||
API_CALLABLE(SetTrackVolumes) {
|
||||
Bytecode* args = script->ptrReadPos;
|
||||
s16 trackVolSet = evt_get_variable(script, *args++);
|
||||
|
||||
|
@ -231,7 +232,7 @@ API_CALLABLE(StopTrackingSoundPos) {
|
|||
Bytecode* args = script->ptrReadPos;
|
||||
s32 soundID = evt_get_variable(script, *args++);
|
||||
|
||||
snd_stop_tracking_env_sound_pos(soundID, TRUE);
|
||||
sfx_stop_tracking_env_sound_pos(soundID, TRUE);
|
||||
return ApiStatus_DONE2;
|
||||
}
|
||||
|
||||
|
|
|
@ -914,9 +914,9 @@ void filemenu_main_handle_input(MenuPanel* menu) {
|
|||
if (originalOutputMode != gGameStatusPtr->soundOutputMode) {
|
||||
sfx_play_sound(SOUND_MENU_CHANGE_TAB);
|
||||
if (gGameStatusPtr->soundOutputMode != SOUND_OUT_MONO) {
|
||||
audio_set_stereo();
|
||||
snd_set_stereo();
|
||||
} else {
|
||||
audio_set_mono();
|
||||
snd_set_mono();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "nu/nusys.h"
|
||||
#include "audio/public.h"
|
||||
#include "ld_addrs.h"
|
||||
#include "hud_element.h"
|
||||
#include "sprite.h"
|
||||
|
@ -89,7 +90,7 @@ void step_game_loop(void) {
|
|||
step_current_game_mode();
|
||||
update_entities();
|
||||
func_80138198();
|
||||
bgm_update_music_settings();
|
||||
bgm_update_music_control();
|
||||
update_ambient_sounds();
|
||||
sfx_update_env_sound_params();
|
||||
update_windows();
|
||||
|
|
|
@ -35,6 +35,6 @@ static void gfxThread(void* data) {
|
|||
}
|
||||
|
||||
void nuGfxThreadStart(void) {
|
||||
osCreateThread(&D_800B1B90, 4, gfxThread, NULL, &GfxStack[NU_GFX_STACK_SIZE], NU_GFX_THREAD_PRI);
|
||||
osCreateThread(&D_800B1B90, NU_GFX_THREAD_ID, gfxThread, NULL, &GfxStack[NU_GFX_STACK_SIZE], NU_GFX_THREAD_PRI);
|
||||
osStartThread(&D_800B1B90);
|
||||
}
|
||||
|
|
|
@ -177,6 +177,8 @@ s32 spr_get_npc_color_variations(s32 npcSpriteID);
|
|||
|
||||
void create_shading_palette(Matrix4f mtx, s32 uls, s32 ult, s32 lrs, s32 lrt, s32 alpha, s32);
|
||||
|
||||
void func_801491E4(Matrix4f mtx, s32, s32, s32, s32, s32 alpha);
|
||||
|
||||
SpriteAnimData* spr_load_sprite(s32 idx, s32 arg1, s32 arg2);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -151,7 +151,7 @@ void state_init_demo(void) {
|
|||
gGameStatusPtr->demoStickX = 0;
|
||||
gGameStatusPtr->demoStickY = 0;
|
||||
|
||||
disable_sounds();
|
||||
snd_disable_sfx();
|
||||
set_map_transition_effect(TRANSITION_END_DEMO_SCENE_BLACK);
|
||||
set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, 255.0f);
|
||||
clear_saved_variables();
|
||||
|
@ -190,7 +190,7 @@ void state_step_demo(void) {
|
|||
gGameStatusPtr->nextDemoScene = 0;
|
||||
gGameStatusPtr->demoState = DEMO_STATE_NONE;
|
||||
gGameStatusPtr->peachFlags = 0;
|
||||
enable_sounds();
|
||||
snd_enable_sfx();
|
||||
gGameStatusPtr->context = CONTEXT_WORLD;
|
||||
gGameStatusPtr->debugUnused1 = FALSE;
|
||||
gGameStatusPtr->debugScripts = DEBUG_SCRIPTS_NONE;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "audio/public.h"
|
||||
#include "ld_addrs.h"
|
||||
#include "nu/nusys.h"
|
||||
#include "camera.h"
|
||||
|
@ -305,7 +307,7 @@ void state_init_exit_file_select(void) {
|
|||
} else {
|
||||
set_map_transition_effect(TRANSITION_ENTER_WORLD);
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_WINDOWS_OVER_CURTAINS;
|
||||
bgm_set_song(0, -1, 0, 1000, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 1000, VOL_LEVEL_FULL);
|
||||
}
|
||||
gOverrideFlags &= ~GLOBAL_OVERRIDES_40;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "ld_addrs.h"
|
||||
#include "audio/public.h"
|
||||
#include "npc.h"
|
||||
#include "nu/nusys.h"
|
||||
#include "hud_element.h"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "hud_element.h"
|
||||
#include "audio/public.h"
|
||||
#include "fio.h"
|
||||
#include "sprite.h"
|
||||
#include "game_modes.h"
|
||||
|
@ -74,10 +75,10 @@ void state_step_startup(void) {
|
|||
|
||||
if (gSaveGlobals.useMonoSound == 0) {
|
||||
gGameStatusPtr->soundOutputMode = SOUND_OUT_STEREO;
|
||||
audio_set_stereo();
|
||||
snd_set_stereo();
|
||||
} else {
|
||||
gGameStatusPtr->soundOutputMode = SOUND_OUT_MONO;
|
||||
audio_set_mono();
|
||||
snd_set_mono();
|
||||
}
|
||||
|
||||
#if VERSION_PAL
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "common.h"
|
||||
#include "audio.h"
|
||||
#include "audio/public.h"
|
||||
#include "nu/nusys.h"
|
||||
#include "hud_element.h"
|
||||
#include "sprite.h"
|
||||
|
@ -232,7 +234,7 @@ void state_init_title_screen(void) {
|
|||
game_mode_set_fpDrawAuxUI(0, appendGfx_title_screen);
|
||||
load_map_bg("title_bg");
|
||||
set_background(&gBackgroundImage);
|
||||
bgm_set_song(0, SONG_MAIN_THEME, 0, 500, 8);
|
||||
bgm_set_song(0, SONG_MAIN_THEME, 0, 500, VOL_LEVEL_FULL);
|
||||
TitleScreen_TimeLeft = TITLE_START_TIME;
|
||||
}
|
||||
|
||||
|
@ -290,7 +292,7 @@ void state_step_title_screen(void) {
|
|||
}
|
||||
#endif
|
||||
if (PlayIntroNext && TitleScreen_TimeLeft == 120) {
|
||||
bgm_set_song(0, -1, 0, 3900, 8);
|
||||
bgm_set_song(0, AU_SONG_NONE, 0, 3900, VOL_LEVEL_FULL);
|
||||
}
|
||||
if (TitleScreen_TimeLeft == 0) {
|
||||
gGameStatusPtr->startupState = TITLE_STATE_BEGIN_DISMISS;
|
||||
|
@ -306,7 +308,7 @@ void state_step_title_screen(void) {
|
|||
gGameStatusPtr->startupState = TITLE_STATE_BEGIN_DISMISS;
|
||||
TitleScreenNextState = NEXT_STATE_FILE_SELECT;
|
||||
sfx_play_sound(SOUND_FILE_MENU_IN);
|
||||
bgm_set_song(0, SONG_FILE_SELECT, 0, 500, 8);
|
||||
bgm_set_song(0, SONG_FILE_SELECT, 0, 500, VOL_LEVEL_FULL);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -50,7 +50,7 @@ void action_update_spin(void) {
|
|||
playerSpinState->hitWallTime = 0;
|
||||
playerSpinState->bufferedStickAxis.x = 0;
|
||||
playerSpinState->bufferedStickAxis.y = 0;
|
||||
playerSpinState->spinSoundID = 0;
|
||||
playerSpinState->spinSoundID = SOUND_NONE;
|
||||
playerStatus->specialDecorationEffect = NULL;
|
||||
playerSpinState->initialSpinTime = 25;
|
||||
playerSpinState->fullSpeedSpinTime = 15;
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
Return
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
Return
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
Return
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_SAW_TUBBA_EAT_BOO)
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
Return
|
||||
|
|
|
@ -418,7 +418,7 @@ EvtScript N(EVS_Scene_TubbaRaid) = {
|
|||
Call(CloseMessage)
|
||||
Call(ForceUsePartner)
|
||||
Wait(60 * DT)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 1, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, BGM_VARIATION_1, VOL_LEVEL_FULL)
|
||||
Call(SetCamType, CAM_DEFAULT, 6, TRUE)
|
||||
Call(SetCamSpeed, CAM_DEFAULT, Float(90.0))
|
||||
Call(SetCamPitch, CAM_DEFAULT, Float(17.0), Float(-11.5))
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
CaseLt(STORY_CH3_HEART_ESCAPED_WINDY_MILL)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
CaseEq(STORY_CH3_BEGAN_PEACH_MISSION)
|
||||
Call(SetMusicTrack, 0, SONG_STAR_SPIRIT_THEME, 1, 8)
|
||||
Call(SetMusic, 0, SONG_STAR_SPIRIT_THEME, BGM_VARIATION_1, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
Call(PlayAmbientSounds, AMBIENT_WIND)
|
||||
EndSwitch
|
||||
Return
|
||||
|
|
|
@ -117,7 +117,7 @@ EvtScript N(EVS_Scene_BossDefeated) = {
|
|||
Call(SetNpcPos, NPC_SELF, NPC_DISPOSE_LOCATION)
|
||||
Call(EnableNpcShadow, NPC_SELF, FALSE)
|
||||
Set(GB_StoryProgress, STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_CHEERFUL_BOOS_MANSION, 0, 8)
|
||||
Call(SetMusic, 0, SONG_CHEERFUL_BOOS_MANSION, 0, VOL_LEVEL_FULL)
|
||||
Call(GetCurrentPartnerID, LVar6)
|
||||
IfEq(LVar6, PARTNER_BOW)
|
||||
Set(LVar5, -4)
|
||||
|
@ -310,7 +310,7 @@ EvtScript N(EVS_NpcDefeat_Tubba) = {
|
|||
Call(GetBattleOutcome, LVar0)
|
||||
Switch(LVar0)
|
||||
CaseEq(OUTCOME_PLAYER_WON)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 1, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, BGM_VARIATION_1, VOL_LEVEL_FULL)
|
||||
ExecWait(N(EVS_Scene_TubbaRelents))
|
||||
Exec(N(EVS_Scene_BossDefeated))
|
||||
CaseEq(OUTCOME_PLAYER_LOST)
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_HEART_FLED_FIRST_TUNNEL)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Call(ClearAmbientSounds, 250)
|
||||
Return
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_HEART_FLED_FIRST_TUNNEL)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_HEART_FLED_FIRST_TUNNEL)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_WENT_DOWN_THE_WELL)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_HEART_FLED_FIRST_TUNNEL)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_HEART_FLED_FIRST_TUNNEL)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_GUSTY_GULCH, 0, 8)
|
||||
Call(SetMusic, 0, SONG_GUSTY_GULCH, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Call(ClearAmbientSounds, 250)
|
||||
Return
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Call(ClearAmbientSounds, 250)
|
||||
Return
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -4,14 +4,14 @@ EvtScript N(EVS_SetupMusic) = {
|
|||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
IfEq(GB_ARN_Tubba_MapID, 15)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndIf
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -38,7 +38,7 @@ EvtScript N(EVS_NpcIdle_Tubba) = {
|
|||
Wait(1)
|
||||
EndLoop
|
||||
Call(DisablePlayerInput, TRUE)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
Wait(15)
|
||||
Thread
|
||||
Call(UseSettingsFrom, CAM_DEFAULT, -50, 0, 180)
|
||||
|
@ -51,7 +51,7 @@ EvtScript N(EVS_NpcIdle_Tubba) = {
|
|||
Call(SetNpcAnimation, NPC_Tubba, ANIM_WorldTubba_Anim09)
|
||||
Call(SetNpcYaw, NPC_SELF, 270)
|
||||
Call(NpcMoveTo, NPC_SELF, -53, 180, 60)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
Call(SetNpcAnimation, NPC_SELF, ANIM_WorldTubba_Anim06)
|
||||
Wait(15)
|
||||
Call(SpeakToPlayer, NPC_SELF, ANIM_WorldTubba_Anim10, ANIM_WorldTubba_Anim06, 0, MSG_CH3_00F3)
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH3_TUBBA_WOKE_UP)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
CaseLt(STORY_CH3_DEFEATED_TUBBA_BLUBBA)
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_TUBBAS_MANOR, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBAS_MANOR, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -102,7 +102,7 @@ EvtScript N(EVS_Scene_TubbaFallsAsleep) = {
|
|||
Wait(5)
|
||||
EndLoop
|
||||
EndThread
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_BLUBBA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_BLUBBA_THEME, 0, VOL_LEVEL_FULL)
|
||||
Call(SetNpcAnimation, NPC_SELF, ANIM_WorldTubba_Anim09)
|
||||
Call(SetNpcPos, NPC_SELF, -210, 0, 180)
|
||||
Call(NpcMoveTo, NPC_SELF, -60, 180, 30)
|
||||
|
@ -427,7 +427,7 @@ EvtScript N(EVS_Scene_YakkeyShouts) = {
|
|||
BreakLoop
|
||||
EndIf
|
||||
EndLoop
|
||||
Call(SetMusicTrack, 0, SONG_TUBBA_ESCAPE, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TUBBA_ESCAPE, 0, VOL_LEVEL_FULL)
|
||||
Call(SetNpcVar, NPC_Tubba, 1, 1)
|
||||
Wait(15)
|
||||
Call(SetNpcAnimation, NPC_Tubba, ANIM_WorldTubba_Anim25)
|
||||
|
|
|
@ -7,7 +7,7 @@ EvtScript N(EVS_SetupMusic) = {
|
|||
CaseOrEq(dro_01_ENTRY_4)
|
||||
EndCaseGroup
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_DRY_DRY_OUTPOST, 0, 8)
|
||||
Call(SetMusic, 0, SONG_DRY_DRY_OUTPOST, 0, VOL_LEVEL_FULL)
|
||||
EndCaseGroup
|
||||
EndSwitch
|
||||
Return
|
||||
|
|
|
@ -7,7 +7,7 @@ EvtScript N(EVS_SetupMusic) = {
|
|||
CaseOrEq(dro_02_ENTRY_3)
|
||||
EndCaseGroup
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_DRY_DRY_OUTPOST, 0, 8)
|
||||
Call(SetMusic, 0, SONG_DRY_DRY_OUTPOST, 0, VOL_LEVEL_FULL)
|
||||
EndCaseGroup
|
||||
EndSwitch
|
||||
Return
|
||||
|
@ -15,13 +15,13 @@ EvtScript N(EVS_SetupMusic) = {
|
|||
};
|
||||
|
||||
EvtScript N(EVS_PlayRestMusic) = {
|
||||
Call(SetMusicTrack, 0, SONG_TAKING_REST, 0, 8)
|
||||
Call(SetMusic, 0, SONG_TAKING_REST, 0, VOL_LEVEL_FULL)
|
||||
Return
|
||||
End
|
||||
};
|
||||
|
||||
EvtScript N(EVS_PlayMoustafaMusic) = {
|
||||
Call(SetMusicTrack, 0, SONG_MOUSTAFA_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_MOUSTAFA_THEME, 0, VOL_LEVEL_FULL)
|
||||
Return
|
||||
End
|
||||
};
|
||||
|
|
|
@ -812,7 +812,7 @@ EvtScript N(EVS_NpcInteract_Merlee) = {
|
|||
Return
|
||||
EndIf
|
||||
Call(ContinueSpeech, -1, ANIM_WorldMerlee_Talk, ANIM_WorldMerlee_Idle, 0, MSG_CH2_00DA)
|
||||
Call(SetMusicTrack, 0, SONG_MERLEE_SPELL, 0, 8)
|
||||
Call(SetMusic, 0, SONG_MERLEE_SPELL, 0, VOL_LEVEL_FULL)
|
||||
Call(DisablePartnerAI, 0)
|
||||
Call(SetNpcAnimation, NPC_PARTNER, PARTNER_ANIM_IDLE)
|
||||
ExecGetTID(N(EVS_PerformRitual), LVar9)
|
||||
|
|
|
@ -29,7 +29,7 @@ EvtScript N(EVS_ParadePhase_Luigi) = {
|
|||
Wait(30 * DT)
|
||||
Call(SetNpcAnimation, NPC_Luigi, ANIM_ParadeLuigi_MarchInPlace)
|
||||
Wait(7 * DT)
|
||||
Call(SetMusicTrack, 0, SONG_PARADE_DAY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_PARADE_DAY, 0, VOL_LEVEL_FULL)
|
||||
Wait(120 * DT)
|
||||
Wait(100 * DT)
|
||||
Call(InterpNpcYaw, NPC_Luigi, 270, 0)
|
||||
|
|
|
@ -735,7 +735,7 @@ EvtScript N(EVS_ParadePhase_PlayCredits) = {
|
|||
EvtScript N(EVS_ManageParade) = {
|
||||
Call(DisablePlayerInput, TRUE)
|
||||
Call(DisablePlayerPhysics, TRUE)
|
||||
Call(SetMusicTrack, 0, SONG_PARADE_NIGHT, 0, 8)
|
||||
Call(SetMusic, 0, SONG_PARADE_NIGHT, 0, VOL_LEVEL_FULL)
|
||||
Exec(N(EVS_SetupInitialCamera))
|
||||
Exec(N(EVS_ManageNpcPool))
|
||||
ExecGetTID(N(EVS_ParadePhase_StarSpirits), LVarA)
|
||||
|
|
|
@ -253,7 +253,7 @@ EvtScript N(EVS_Exit_Beanstalk) = {
|
|||
Call(SetNpcJumpscale, NPC_PARTNER, Float(0.0))
|
||||
Call(NpcJump0, NPC_PARTNER, LVarC, LVarD, LVarE, 5)
|
||||
Call(PlaySound, SOUND_FLO_RIDE_BEANSTALK_UP_LOOP)
|
||||
Call(SetMusicTrack, 0, SONG_MAGIC_BEANSTALK, 1, 8)
|
||||
Call(SetMusic, 0, SONG_MAGIC_BEANSTALK, BGM_VARIATION_1, VOL_LEVEL_FULL)
|
||||
Call(SetNpcAnimation, NPC_PARTNER, PARTNER_ANIM_IDLE)
|
||||
Call(SetPlayerAnimation, ANIM_Mario1_Walk)
|
||||
Call(N(GetPlayerAngles), LVar3, LVar4)
|
||||
|
|
|
@ -5,14 +5,14 @@ EvtScript N(EVS_SetupMusic) = {
|
|||
Switch(LVar0)
|
||||
CaseEq(flo_00_ENTRY_8)
|
||||
IfNe(AF_FLO_RidingBeanstalk, FALSE)
|
||||
Call(SetMusicTrack, 0, SONG_MAGIC_BEANSTALK, 1, 8)
|
||||
Call(SetMusic, 0, SONG_MAGIC_BEANSTALK, BGM_VARIATION_1, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndIf
|
||||
CaseEq(flo_00_ENTRY_9)
|
||||
Call(SetMusicTrack, 0, SONG_SUNSHINE_RETURNS, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUNSHINE_RETURNS, 0, VOL_LEVEL_FULL)
|
||||
CaseEq(flo_00_ENTRY_A)
|
||||
Call(SetMusicTrack, 0, SONG_STAR_SPIRIT_THEME, 1, 8)
|
||||
Call(SetMusic, 0, SONG_STAR_SPIRIT_THEME, BGM_VARIATION_1, VOL_LEVEL_FULL)
|
||||
Thread
|
||||
Loop(0)
|
||||
Wait(1)
|
||||
|
@ -20,16 +20,16 @@ EvtScript N(EVS_SetupMusic) = {
|
|||
BreakLoop
|
||||
EndIf
|
||||
EndLoop
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndThread
|
||||
CaseEq(flo_00_ENTRY_B)
|
||||
Call(FadeInMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 3000, 0, 127)
|
||||
CaseDefault
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
EndSwitch
|
||||
Return
|
||||
|
|
|
@ -3,19 +3,19 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Call(GetEntryID, LVar0)
|
||||
IfEq(LVar0, flo_03_ENTRY_2)
|
||||
Call(SetMusicTrack, 0, SONG_SUNSHINE_RETURNS, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUNSHINE_RETURNS, 0, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLe(STORY_CH6_ASKED_TO_DEFEAT_MONTY_MOLES)
|
||||
IfEq(GF_FLO03_DefeatedAll_MontyMoles, FALSE)
|
||||
Call(SetMusicTrack, 0, SONG_MONTY_MOLE_ASSAULT, 0, 8)
|
||||
Call(SetMusic, 0, SONG_MONTY_MOLE_ASSAULT, 0, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
EndIf
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
EndIf
|
||||
Return
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Call(GetEntryID, LVar0)
|
||||
IfEq(LVar0, flo_07_ENTRY_1)
|
||||
Call(SetMusicTrack, 0, SONG_SUNSHINE_RETURNS, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUNSHINE_RETURNS, 0, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
EndIf
|
||||
Call(PlaySound, SOUND_LOOP_FLO_WATER_FLOW_1)
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Call(GetEntryID, LVar0)
|
||||
IfEq(LVar0, flo_10_ENTRY_1)
|
||||
Call(SetMusicTrack, 0, SONG_SUNSHINE_RETURNS, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUNSHINE_RETURNS, 0, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
EndIf
|
||||
IfGe(GB_StoryProgress, STORY_CH6_FILLED_SPRING_WITH_WATER)
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Call(GetEntryID, LVar0)
|
||||
IfEq(LVar0, flo_12_ENTRY_1)
|
||||
Call(SetMusicTrack, 0, SONG_SUNSHINE_RETURNS, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUNSHINE_RETURNS, 0, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
EndIf
|
||||
Return
|
||||
|
|
|
@ -8,9 +8,9 @@ EvtScript N(EVS_PlaySongForPlayerPos) = {
|
|||
Label(0)
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Loop(0)
|
||||
Call(GetPlayerPos, LVar0, LVar1, LVar2)
|
||||
|
@ -22,9 +22,9 @@ EvtScript N(EVS_PlaySongForPlayerPos) = {
|
|||
Label(10)
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_SUN_TOWER_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUN_TOWER_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_SUN_TOWER_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUN_TOWER_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Loop(0)
|
||||
Call(GetPlayerPos, LVar0, LVar1, LVar2)
|
||||
|
@ -45,7 +45,7 @@ EvtScript N(EVS_SetupMusic) = {
|
|||
};
|
||||
|
||||
EvtScript N(EVS_PushPartnerSong) = {
|
||||
Call(SetMusicTrack, 0, SONG_NEW_PARTNER, 0, 8)
|
||||
Call(SetMusic, 0, SONG_NEW_PARTNER, 0, VOL_LEVEL_FULL)
|
||||
Return
|
||||
End
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ EvtScript N(EVS_PushPartnerSong) = {
|
|||
EvtScript N(EVS_PopSong) = {
|
||||
Call(FadeOutMusic, 0, 500)
|
||||
Wait(15)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
Return
|
||||
End
|
||||
};
|
||||
|
|
|
@ -230,7 +230,7 @@ EvtScript N(EVS_NpcIdle_Lakilester) = {
|
|||
Call(AwaitPlayerApproach, 200, 20, 275)
|
||||
Call(DisablePlayerInput, TRUE)
|
||||
Call(SetNpcPos, NPC_Lakilester, -250, 120, 45)
|
||||
Call(SetMusicTrack, 0, SONG_LAKILESTER_THEME, 0, 8)
|
||||
Call(SetMusic, 0, SONG_LAKILESTER_THEME, 0, VOL_LEVEL_FULL)
|
||||
Call(ShowMessageAtScreenPos, MSG_CH6_00A0, 160, 40)
|
||||
Call(InterruptUsePartner)
|
||||
Call(SetPlayerAnimation, ANIM_Mario1_LookUp)
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Call(GetEntryID, LVar0)
|
||||
IfEq(LVar0, flo_15_ENTRY_1)
|
||||
Call(SetMusicTrack, 0, SONG_SUNSHINE_RETURNS, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUNSHINE_RETURNS, 0, VOL_LEVEL_FULL)
|
||||
Else
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_SUN_TOWER_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUN_TOWER_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_SUN_TOWER_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_SUN_TOWER_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
EndIf
|
||||
Return
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
EvtScript N(EVS_SetupMusic) = {
|
||||
Switch(GB_StoryProgress)
|
||||
CaseLt(STORY_CH6_DESTROYED_PUFF_PUFF_MACHINE)
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_CLOUDY, 0, VOL_LEVEL_FULL)
|
||||
CaseDefault
|
||||
Call(SetMusicTrack, 0, SONG_FLOWER_FIELDS_SUNNY, 0, 8)
|
||||
Call(SetMusic, 0, SONG_FLOWER_FIELDS_SUNNY, 0, VOL_LEVEL_FULL)
|
||||
EndSwitch
|
||||
Return
|
||||
End
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue