-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[examples] Review audio examples audio_raw_stream(split) and audio_sound_loading to add more clarity
#5350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[examples] Review audio examples audio_raw_stream(split) and audio_sound_loading to add more clarity
#5350
Conversation
|
@meisei4 I prefer to avoid changing |
|
@raysan5 I have reverted the changes for that example. But i wanted to confirm that The issue i encountered here was from trying to figure out how to use the |
audio_raw_stream(split) and audio_load_sound to add more clarityaudio_raw_stream(split) and audio_sound_loading to add more clarity
No, afair, it is dependand on the loaded sound. About |
Now it goes from -1.0 (full left) to 1.0 (full right) being 0.0 center
I see, so then i think there might be an issue here in expected behavior. Because
So far in this area there has only been an addition in the form of commented warnings (thanks to @AmityWilder for helping me discover this behavior: #5031). It was being encountered over in the rust bindings initially: raylib-rs/raylib-rs#212 @raysan5 I am wondering if you would like for this to be updated such that |
Review audio examples to provide more clarity
I was encountering many time-consuming audio specification issues in my own tests and so I thought things could be improved documentation-wise in this area. My idea is simply updating the following examples to be a little more clear/expressive with how
raudio.cworks, especially in relation to theUpdaterelated functions.NOTE: the main diff for this reviewing this PR is:b3c2518 because it allows you to see how the original
audio_raw_streamwas updated after it was COPIED/SPLIT for both manual and callbacks variations.audio_raw_stream: (manual) diff with originalmanualand thecallbackinto two separate examplescallbackandmanual(manual resulted in an octave pitch higher than callback version):waveLength = (int)(22050/frequency);towaveLength = (int)(stream.sampleRate/frequency);<- this will use44100viasampleRateaudio_raw_stream_callback: diff with originalaudio_sound_loadingUpdateSoundanywhere in the raylib codebase, so I added a simple reversal effect using that function in the existingaudio_load_soundexample. If this is inappropriate then perhapsUpdateSoundas a function should be removed from raudio? as it is never used and just callsStopAudioBufferandmemcpy(which is very different behavior than something likeUpdateAudioStream, and AudioProcessors take care of all the sort of effects you can do on sounds anyways i believe)Soundalways setting stream specifications 'sampleSizeto32`, and channels as stereo, so I also thought it would be helpful to have this example for showing that updating sound you need to also always match those specs between any scratch data you want to work withsampleSize(code refs)LoadSoundFromWave32 sampleSizeraudio.cAUDIO_DEVICE_FORMAT32config.hAUDIO_DEVICE_FORMAT32LoadSoundFromWavereturnchannelsas stereoraudio.cAUDIO_DEVICE_CHANNELS2config.hAUDIO_DEVICE_CHANNELS2Also since it provides really simple opportunity to demonstrate how strict the
Soundstreams are, I believe it is appropriate to add to this bare mininum load sound example, rather than try to add it somewhere else.