SDL: examples: Use SDL_GetAudioStreamQueued, not SDL_GetAudioStreamAvailable.

From f7cadcba84f20a5d8c8b84ba0c8f294915d66f81 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 27 Feb 2025 11:44:22 -0500
Subject: [PATCH] examples: Use SDL_GetAudioStreamQueued, not
 SDL_GetAudioStreamAvailable.

The "available" side is at the mercy of whatever format the hardware wants,
but we control what we queued.

Fixes #12403.
---
 examples/audio/01-simple-playback/simple-playback.c   | 2 +-
 examples/audio/03-load-wav/load-wav.c                 | 2 +-
 examples/audio/04-multiple-streams/multiple-streams.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c
index 330df800759ef..15126e56828f5 100644
--- a/examples/audio/01-simple-playback/simple-playback.c
+++ b/examples/audio/01-simple-playback/simple-playback.c
@@ -69,7 +69,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
        A sine wave is unchanging audio--easy to stream--but for video games, you'll want
        to generate significantly _less_ audio ahead of time! */
     const int minimum_audio = (8000 * sizeof (float)) / 2;  /* 8000 float samples per second. Half of that. */
-    if (SDL_GetAudioStreamAvailable(stream) < minimum_audio) {
+    if (SDL_GetAudioStreamQueued(stream) < minimum_audio) {
         static float samples[512];  /* this will feed 512 samples each frame until we get to our maximum. */
         int i;
 
diff --git a/examples/audio/03-load-wav/load-wav.c b/examples/audio/03-load-wav/load-wav.c
index 966fccb26baab..c517e5d66b23b 100644
--- a/examples/audio/03-load-wav/load-wav.c
+++ b/examples/audio/03-load-wav/load-wav.c
@@ -82,7 +82,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
        We're being lazy here, but if there's less than the entire wav file left to play,
        just shove a whole copy of it into the queue, so we always have _tons_ of
        data queued for playback. */
-    if (SDL_GetAudioStreamAvailable(stream) < (int)wav_data_len) {
+    if (SDL_GetAudioStreamQueued(stream) < (int)wav_data_len) {
         /* feed more data to the stream. It will queue at the end, and trickle out as the hardware needs more data. */
         SDL_PutAudioStreamData(stream, wav_data, wav_data_len);
     }
diff --git a/examples/audio/04-multiple-streams/multiple-streams.c b/examples/audio/04-multiple-streams/multiple-streams.c
index 57f3cd0e0d8cf..8d3bfaa0906d3 100644
--- a/examples/audio/04-multiple-streams/multiple-streams.c
+++ b/examples/audio/04-multiple-streams/multiple-streams.c
@@ -104,7 +104,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
         /* If less than a full copy of the audio is queued for playback, put another copy in there.
            This is overkill, but easy when lots of RAM is cheap. One could be more careful and
            queue less at a time, as long as the stream doesn't run dry.  */
-        if (SDL_GetAudioStreamAvailable(sounds[i].stream) < ((int) sounds[i].wav_data_len)) {
+        if (SDL_GetAudioStreamQueued(sounds[i].stream) < ((int) sounds[i].wav_data_len)) {
             SDL_PutAudioStreamData(sounds[i].stream, sounds[i].wav_data, (int) sounds[i].wav_data_len);
         }
     }