summaryrefslogtreecommitdiffhomepage
path: root/examples/audio
diff options
context:
space:
mode:
authorptarabbia <[email protected]>2022-01-16 06:49:58 -0500
committerGitHub <[email protected]>2022-01-16 12:49:58 +0100
commit5ac07122bd92c008550b3e55ea0555055c99aaa0 (patch)
treeea3ba14c384bd1c39ed40eeab683b02cec8ceb4c /examples/audio
parent48a463cca869309f598399b1c2aff431feb5685a (diff)
downloadraylib-5ac07122bd92c008550b3e55ea0555055c99aaa0.tar.gz
raylib-5ac07122bd92c008550b3e55ea0555055c99aaa0.zip
Add panning to raudio and update audio_raw_stream example. (#2205)
* Add panning to raudio and update audio_raw_stream example. * remove pan smoothing, code formatting changes following pull request comments Co-authored-by: Ray <[email protected]>
Diffstat (limited to 'examples/audio')
-rw-r--r--examples/audio/audio_raw_stream.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/audio/audio_raw_stream.c b/examples/audio/audio_raw_stream.c
index c9ec7a9d..9b2d1022 100644
--- a/examples/audio/audio_raw_stream.c
+++ b/examples/audio/audio_raw_stream.c
@@ -77,6 +77,9 @@ int main(void)
{
float fp = (float)(mousePosition.y);
frequency = 40.0f + (float)(fp);
+
+ float pan = (float)(mousePosition.x) / (float)screenWidth;
+ SetAudioStreamPan(stream, pan);
}
// Rewrite the sine wave.
@@ -137,7 +140,7 @@ int main(void)
ClearBackground(RAYWHITE);
DrawText(TextFormat("sine frequency: %i",(int)frequency), GetScreenWidth() - 220, 10, 20, RED);
- DrawText("click mouse button to change frequency", 10, 10, 20, DARKGRAY);
+ DrawText("click mouse button to change frequency or pan", 10, 10, 20, DARKGRAY);
// Draw the current buffer state proportionate to the screen
for (int i = 0; i < screenWidth; i++)