From 8e28872fe14f607073d2a1c4abf1bc76b52bc343 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 25 Mar 2022 10:19:40 +0100 Subject: [PATCH] Rename audio callback --- examples/audio/audio_raw_stream.c | 5 +++-- src/raudio.c | 4 ++-- src/raylib.h | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/audio/audio_raw_stream.c b/examples/audio/audio_raw_stream.c index ddf4337e..9599339f 100644 --- a/examples/audio/audio_raw_stream.c +++ b/examples/audio/audio_raw_stream.c @@ -32,7 +32,8 @@ float oldFrequency = 1.0f; // Index for audio rendering float sineIdx = 0.0f; -void AudioCallback(void *buffer, unsigned int frames) +// Audio input processing callback +void AudioInputCallback(void *buffer, unsigned int frames) { audioFrequency = frequency + (audioFrequency - frequency)*0.95f; audioFrequency += 1.0f; @@ -65,7 +66,7 @@ int main(void) // Init raw audio stream (sample rate: 44100, sample size: 16bit-short, channels: 1-mono) AudioStream stream = LoadAudioStream(44100, 16, 1); - SetAudioStreamCallback(stream, &AudioCallback); + SetAudioStreamCallback(stream, AudioInputCallback); // Buffer for the single cycle waveform we are synthesizing short *data = (short *)malloc(sizeof(short)*MAX_SAMPLES); diff --git a/src/raudio.c b/src/raudio.c index 8118338b..f25de079 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -315,7 +315,7 @@ typedef enum { struct rAudioBuffer { ma_data_converter converter; // Audio data converter - AudioStreamCallback callback; // Audio buffer callback for buffer filling on audio threads + AudioCallback callback; // Audio buffer callback for buffer filling on audio threads float volume; // Audio buffer volume float pitch; // Audio buffer pitch @@ -2034,7 +2034,7 @@ void SetAudioStreamBufferSizeDefault(int size) } // Audio thread callback to request new data -void SetAudioStreamCallback(AudioStream stream, AudioStreamCallback callback) +void SetAudioStreamCallback(AudioStream stream, AudioCallback callback) { if (stream.buffer != NULL) stream.buffer->callback = callback; } diff --git a/src/raylib.h b/src/raylib.h index 198cadea..2bee82dc 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1474,7 +1474,7 @@ RLAPI RayCollision GetRayCollisionQuad(Ray ray, Vector3 p1, Vector3 p2, Vector3 //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) //------------------------------------------------------------------------------------ -typedef void (*AudioStreamCallback)(void *bufferData, unsigned int frames); +typedef void (*AudioCallback)(void *bufferData, unsigned int frames); // Audio device management functions RLAPI void InitAudioDevice(void); // Initialize audio device and context @@ -1542,7 +1542,7 @@ RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set vol RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level) RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered) RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams -RLAPI void SetAudioStreamCallback(AudioStream stream, AudioStreamCallback callback); // Audio thread callback to request new data +RLAPI void SetAudioStreamCallback(AudioStream stream, AudioCallback callback); // Audio thread callback to request new data #if defined(__cplusplus) }