From c524319870aca969a3e42b9718048ab8291000d9 Mon Sep 17 00:00:00 2001 From: Bruno Cabral Date: Sun, 30 Jun 2024 22:23:35 -0700 Subject: [PATCH] [raudio] check audio device state early I was getting "frame count" warning message, but the real reason was that I forgot to call `InitAudioDevice()`. I feel that having this check early would better describe the problem. --- src/raudio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/raudio.c b/src/raudio.c index e33712978939..fd271620e9d6 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -927,6 +927,12 @@ Sound LoadSoundFromWave(Wave wave) if (wave.data != NULL) { + if (ma_device_get_state(&AUDIO.System.device) == ma_device_state_uninitialized) + { + TRACELOG(LOG_WARNING, "SOUND: Audio device uninitialized"); + return sound; + } + // When using miniaudio we need to do our own mixing // To simplify this we need convert the format of each sound to be consistent with // the format used to open the playback AUDIO.System.device. We can do this two ways: