Skip to content

[examples] Add audio_stream_callback#5638

Merged
raysan5 merged 12 commits intoraysan5:masterfrom
dan-hoang:audio-raw-stream-callback
Mar 13, 2026
Merged

[examples] Add audio_stream_callback#5638
raysan5 merged 12 commits intoraysan5:masterfrom
dan-hoang:audio-raw-stream-callback

Conversation

@dan-hoang
Copy link
Copy Markdown
Contributor

This is a sister pull request to https://github.com/raysan5/raylib/pull/5637#issue-4054960372.

This commit adds audio_raw_stream_callback.c, which is the same as audio_raw_stream.c in the pull request above, but uses the new API (i.e., SetAudioStreamCallback) instead of the old API (i.e., IsAudioStreamProcessed and UpdateAudioStream).

@dan-hoang dan-hoang force-pushed the audio-raw-stream-callback branch from 32cae29 to f1572fd Compare March 11, 2026 04:16
@dan-hoang dan-hoang changed the title Add audio_raw_stream_callback.c [examples] Add audio_raw_stream_callback.c Mar 11, 2026
Comment thread examples/audio/audio_raw_stream_callback.c Outdated
Comment thread examples/audio/audio_raw_stream_callback.c Outdated
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented Mar 12, 2026

@dan-hoang @CrackedPixel I think this example can be redesigned to avoid being mostly a copy of the other one, maybe also renamed to audio_stream_callback and do some processing in the callback? Ideas for a more interesting and appealing example to illustrate callback functionality?

@dan-hoang
Copy link
Copy Markdown
Contributor Author

@dan-hoang @CrackedPixel I think this example can be redesigned to avoid being mostly a copy of the other one, maybe also renamed to audio_stream_callback and do some processing in the callback? Ideas for a more interesting and appealing example to illustrate callback functionality?

I'm not an audio guy, so I don't have any good ideas. For now, I just let the user choose between four different waves (sine, square, triangle, and sawtooth), with each wave generated by a different callback. When the user changes the wave they want, the stream's callback is changed appropriately.

I'm thinking that you would do something like this if you have a pipeline of effects set up (like in the stream effects example) and want to swap out the base signal.

@raysan5 raysan5 changed the title [examples] Add audio_raw_stream_callback.c [examples] Add audio_stream_callback Mar 13, 2026
@raysan5 raysan5 merged commit 70cb8d1 into raysan5:master Mar 13, 2026
17 checks passed
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented Mar 13, 2026

@dan-hoang example looks good, thanks for the improvement

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