summaryrefslogtreecommitdiffhomepage
path: root/src/raudio.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-11-09 11:49:03 +0100
committerRay <[email protected]>2021-11-09 11:49:03 +0100
commit21ec8c38ae67abde1b465913db9d89e0b86cbe6a (patch)
tree858339ef69fce977492bab1217957520a72e7f6e /src/raudio.c
parent8ec5b2dc2f73036bf8175e14c638f8f5d8718b9d (diff)
downloadraylib-21ec8c38ae67abde1b465913db9d89e0b86cbe6a.tar.gz
raylib-21ec8c38ae67abde1b465913db9d89e0b86cbe6a.zip
Review variables initialization
- All variables are initialized on declaration, some arrays were not properly initialized - Static array buffers require memset() for re-initialization on every function call
Diffstat (limited to 'src/raudio.c')
-rw-r--r--src/raudio.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/raudio.c b/src/raudio.c
index 223310f3..bf2af3f7 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -2013,7 +2013,7 @@ static ma_uint32 ReadAudioBufferFramesInInternalFormat(AudioBuffer *audioBuffer,
// Another thread can update the processed state of buffers so
// we just take a copy here to try and avoid potential synchronization problems
- bool isSubBufferProcessed[2];
+ bool isSubBufferProcessed[2] = { 0 };
isSubBufferProcessed[0] = audioBuffer->isSubBufferProcessed[0];
isSubBufferProcessed[1] = audioBuffer->isSubBufferProcessed[1];
@@ -2096,7 +2096,7 @@ static ma_uint32 ReadAudioBufferFramesInMixingFormat(AudioBuffer *audioBuffer, f
// should be defined by the output format of the data converter. We do this until frameCount frames have been output. The important
// detail to remember here is that we never, ever attempt to read more input data than is required for the specified number of output
// frames. This can be achieved with ma_data_converter_get_required_input_frame_count().
- ma_uint8 inputBuffer[4096];
+ ma_uint8 inputBuffer[4096] = { 0 };
ma_uint32 inputBufferFrameCap = sizeof(inputBuffer)/ma_get_bytes_per_frame(audioBuffer->converter.config.formatIn, audioBuffer->converter.config.channelsIn);
ma_uint32 totalOutputFramesProcessed = 0;
@@ -2165,7 +2165,7 @@ static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const
while (framesToRead > 0)
{
- float tempBuffer[1024]; // 512 frames for stereo
+ float tempBuffer[1024] = { 0 }; // Frames for stereo
ma_uint32 framesToReadRightNow = framesToRead;
if (framesToReadRightNow > sizeof(tempBuffer)/sizeof(tempBuffer[0])/AUDIO_DEVICE_CHANNELS)