Skip to content

[examples] Update audio_raw_stream.c#5637

Merged
raysan5 merged 6 commits into
raysan5:masterfrom
dan-hoang:audio-raw-stream
Mar 12, 2026
Merged

[examples] Update audio_raw_stream.c#5637
raysan5 merged 6 commits into
raysan5:masterfrom
dan-hoang:audio-raw-stream

Conversation

@dan-hoang
Copy link
Copy Markdown
Contributor

@dan-hoang dan-hoang commented Mar 11, 2026

One of the first examples I played with when I found out about Raylib was audio_raw_stream.c.

I love how easy it is to synthesize stuff in Raylib, but the example did puzzle me for a bit. The big issues:

  1. There are two ways to upload data, and both are put in this one example. The reader must sort out what code is necessary to do things the way they want.
  2. The mouse controls are unintuitive.

To address (1), I propose to split this example in two: audio_raw_stream.c and audio_raw_stream_callback.c. To address (2), I propose to use the keyboard instead of the mouse.

This commit updates audio_raw_stream.c to

  1. Only use the old API (i.e., IsAudioStreamProcessed and UpdateAudioStream). I feel that the old API is more in the spirit of Raylib and so should be the one that takes a plainer name.
  2. Use the keyboard instead of the mouse.
  3. Remove the use of malloc, free, and memcpy. This is to reduce the number of headers included.
  4. Show a more dynamic visualization.

@dan-hoang dan-hoang changed the title Update audio_raw_stream.c [examples] Update audio_raw_stream.c Mar 11, 2026
Comment thread examples/audio/audio_raw_stream.c Outdated
Comment thread examples/audio_raw_stream.c Outdated
Comment thread examples/audio/audio_raw_stream.c Outdated
@raysan5 raysan5 merged commit ee4f4a2 into raysan5:master Mar 12, 2026
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented Mar 12, 2026

@dan-hoang thanks for the simplification and @CrackedPixel thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants