Verified that audio has been initialized before playing sounds or ticking audio.

This commit is contained in:
MeltyPlayer
2022-12-06 17:38:17 -06:00
parent a81188b4ff
commit 85422d9d59
4 changed files with 18 additions and 4 deletions
+7 -4
View File
@@ -2,14 +2,17 @@
#include "decomp/audio/external.h"
#include "debug_print.h"
#include "load_audio_data.h"
SM64PlaySoundFunctionPtr g_play_sound_func = NULL;
extern void play_sound( uint32_t soundBits, f32 *pos ) {
DEBUG_PRINT("$ play_sound(%d) request %d; pos %f %f %f\n", soundBits,sSoundRequestCount,pos[0],pos[1],pos[2]);
sSoundRequests[sSoundRequestCount].soundBits = soundBits;
sSoundRequests[sSoundRequestCount].position = pos;
sSoundRequestCount++;
if ( is_audio_initialized ) {
DEBUG_PRINT("$ play_sound(%d) request %d; pos %f %f %f\n", soundBits,sSoundRequestCount,pos[0],pos[1],pos[2]);
sSoundRequests[sSoundRequestCount].soundBits = soundBits;
sSoundRequests[sSoundRequestCount].position = pos;
sSoundRequestCount++;
}
if ( g_play_sound_func ) {
g_play_sound_func(soundBits, pos);