summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorRay <[email protected]>2023-12-14 15:32:45 +0100
committerRay <[email protected]>2023-12-14 15:32:45 +0100
commitd29b36310ff155cebd9e8227752805106489943a (patch)
tree41293470cb61df7c96c83e8bbeb0f806206277d4 /examples
parent88db11fda4421c66a6043011b36a3f13494b98e5 (diff)
parentcec2261e968bfc554d7b1639dd4d55ab4e2235e6 (diff)
downloadraylib-d29b36310ff155cebd9e8227752805106489943a.tar.gz
raylib-d29b36310ff155cebd9e8227752805106489943a.zip
Merge branch 'master' of https://github.com/raysan5/raylib
Diffstat (limited to 'examples')
-rw-r--r--examples/audio/audio_stream_effects.c16
-rw-r--r--examples/core/core_vr_simulator.c1
2 files changed, 10 insertions, 7 deletions
diff --git a/examples/audio/audio_stream_effects.c b/examples/audio/audio_stream_effects.c
index 21930505..2262d41f 100644
--- a/examples/audio/audio_stream_effects.c
+++ b/examples/audio/audio_stream_effects.c
@@ -2,7 +2,7 @@
*
* raylib [audio] example - Music stream processing effects
*
-* Example originally created with raylib 4.2, last time updated with raylib 4.2
+* Example originally created with raylib 4.2, last time updated with raylib 5.0
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
@@ -13,7 +13,7 @@
#include "raylib.h"
-#include <stdlib.h> // Required for: NULL
+#include <stdlib.h> // Required for: NULL
// Required delay effect variables
static float *delayBuffer = NULL;
@@ -149,13 +149,17 @@ static void AudioProcessEffectLPF(void *buffer, unsigned int frames)
static const float cutoff = 70.0f / 44100.0f; // 70 Hz lowpass filter
const float k = cutoff / (cutoff + 0.1591549431f); // RC filter formula
+ // Converts the buffer data before using it
+ float *bufferData = (float *)buffer;
for (unsigned int i = 0; i < frames*2; i += 2)
{
- float l = ((float *)buffer)[i], r = ((float *)buffer)[i + 1];
+ const float l = bufferData[i];
+ const float r = bufferData[i + 1];
+
low[0] += k * (l - low[0]);
low[1] += k * (r - low[1]);
- ((float *)buffer)[i] = low[0];
- ((float *)buffer)[i + 1] = low[1];
+ bufferData[i] = low[0];
+ bufferData[i + 1] = low[1];
}
}
@@ -176,4 +180,4 @@ static void AudioProcessEffectDelay(void *buffer, unsigned int frames)
delayBuffer[delayWriteIndex++] = ((float *)buffer)[i + 1];
if (delayWriteIndex == delayBufferSize) delayWriteIndex = 0;
}
-} \ No newline at end of file
+}
diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c
index fc2dee6b..9acea197 100644
--- a/examples/core/core_vr_simulator.c
+++ b/examples/core/core_vr_simulator.c
@@ -39,7 +39,6 @@ int main(void)
.vResolution = 1200, // Vertical resolution in pixels
.hScreenSize = 0.133793f, // Horizontal size in meters
.vScreenSize = 0.0669f, // Vertical size in meters
- .vScreenCenter = 0.04678f, // Screen center in meters
.eyeToScreenDistance = 0.041f, // Distance between eye and display in meters
.lensSeparationDistance = 0.07f, // Lens separation distance in meters
.interpupillaryDistance = 0.07f, // IPD (distance between pupils) in meters