Skip to content

Commit

Permalink
[raudio] check audio device state early
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brccabral committed Jul 1, 2024
1 parent 4c90fc6 commit c524319
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/raudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c524319

Please sign in to comment.