From 4876d703f52356c78b0f58176251cfacab0c7671 Mon Sep 17 00:00:00 2001 From: dan-hoang <56205882+dan-hoang@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:03:39 -0700 Subject: [PATCH] Update audio_raw_stream.c to more closely follow raylib coding conventions I accidentally put the file in the wrong folder. --- examples/audio/audio_raw_stream.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/examples/audio/audio_raw_stream.c b/examples/audio/audio_raw_stream.c index 169806927..bd9f8adec 100644 --- a/examples/audio/audio_raw_stream.c +++ b/examples/audio/audio_raw_stream.c @@ -62,35 +62,27 @@ int main(void) if (IsKeyDown(KEY_UP)) { newSineFrequency += 10; - - if (newSineFrequency > 12500) - newSineFrequency = 12500; + if (newSineFrequency > 12500) newSineFrequency = 12500; } if (IsKeyDown(KEY_DOWN)) { newSineFrequency -= 10; - - if (newSineFrequency < 20) - newSineFrequency = 20; + if (newSineFrequency < 20) newSineFrequency = 20; } if (IsKeyDown(KEY_LEFT)) { pan -= 0.01f; + if (pan < -1.0f) pan = -1.0f; SetAudioStreamPan(stream, pan); - - if (pan < -1.0f) - pan = -1.0f; } if (IsKeyDown(KEY_RIGHT)) { pan += 0.01f; + if (pan > 1.0f) pan = 1.0f; SetAudioStreamPan(stream, pan); - - if (pan > 1.0f) - pan = 1.0f; } if (IsAudioStreamProcessed(stream)) @@ -129,7 +121,8 @@ int main(void) int wavelength = SAMPLE_RATE/sineFrequency; // Draw a sine wave with the same frequency as the one being sent to the audio stream - for (int i = 0; i < screenWidth; i++) { + for (int i = 0; i < screenWidth; i++) + { int t0 = windowStart + i*windowSize/screenWidth; int t1 = windowStart + (i + 1)*windowSize/screenWidth; Vector2 startPos = { i, 250 + 50*sin(2*PI*t0/wavelength) };