Fix some audio corruption

This commit is contained in:
MysterD 2023-04-20 00:20:31 -07:00
parent 61c059d688
commit ffc2b431ec
2 changed files with 8 additions and 6 deletions

View File

@ -38,17 +38,17 @@
extern u8 newcam_mouse;
#endif
static bool init_ok;
static bool haptics_enabled;
static SDL_GameController *sdl_cntrl;
static SDL_Haptic *sdl_haptic;
static bool init_ok = false;
static bool haptics_enabled = false;
static SDL_GameController *sdl_cntrl = NULL;
static SDL_Haptic *sdl_haptic = NULL;
static bool sBackgroundGamepad = false;
static u32 num_joy_binds = 0;
static u32 num_mouse_binds = 0;
static u32 joy_binds[MAX_JOYBINDS][2];
static u32 mouse_binds[MAX_JOYBINDS][2];
static u32 joy_binds[MAX_JOYBINDS][2] = { 0 };
static u32 mouse_binds[MAX_JOYBINDS][2] = { 0 };
static bool joy_buttons[MAX_JOYBUTTONS] = { false };
static u32 mouse_buttons = 0;

View File

@ -43,6 +43,7 @@ static void smlua_audio_utils_reset(struct AudioOverride* override) {
}
void smlua_audio_utils_reset_all(void) {
audio_init();
for (s32 i = 0; i < MAX_AUDIO_OVERRIDE; i++) {
if (sAudioOverrides[i].enabled) { sound_reset_background_music_default_volume(i); }
smlua_audio_utils_reset(&sAudioOverrides[i]);
@ -116,6 +117,7 @@ void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolu
normalize_path(relPath);
if (str_ends_with(relPath, m64path)) {
struct AudioOverride* override = &sAudioOverrides[sequenceId];
if (override->enabled) { audio_init(); }
smlua_audio_utils_reset(override);
LOG_INFO("Loading audio: %s", file->cachedPath);
override->filename = strdup(file->cachedPath);