[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.
This commit is contained in:
Bruno Cabral 2024-06-30 22:23:35 -07:00
parent 4c90fc6eff
commit c524319870

View File

@ -927,6 +927,12 @@ Sound LoadSoundFromWave(Wave wave)
if (wave.data != NULL) 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 // 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 // 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: // the format used to open the playback AUDIO.System.device. We can do this two ways: