summaryrefslogtreecommitdiffhomepage
path: root/src/raudio.c
diff options
context:
space:
mode:
authorRay <[email protected]>2020-12-18 21:03:08 +0100
committerRay <[email protected]>2020-12-18 21:03:08 +0100
commite07bc372a1109cc782b940162c2aedb5defc0ba8 (patch)
treecaeddf2d949ec325720149c61c9aaaeb901d2a92 /src/raudio.c
parent5dd142beb62f7848eb857505250fb9978601bc6e (diff)
downloadraylib-e07bc372a1109cc782b940162c2aedb5defc0ba8.tar.gz
raylib-e07bc372a1109cc782b940162c2aedb5defc0ba8.zip
WARNING: RENAMED several functions for consistency #1440
This is a BREAKING CHANGE! To address the linked issue, several functions have been renamed and couterpart functions have been created to free loaded memory: - RENAMED: GetImageData() -> LoadImageColors() - RENAMED: GetImagePalette() -> LoadImagePalette() - RENAMED: GetWaveData() -> LoadWaveSamples() - ADDED: UnloadImageColors() - ADDED: UnloadImagePalette() - ADDED: UnloadWaveSamples()
Diffstat (limited to 'src/raudio.c')
-rw-r--r--src/raudio.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/raudio.c b/src/raudio.c
index 0e378c80..c840bb61 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -1079,9 +1079,10 @@ void WaveCrop(Wave *wave, int initSample, int finalSample)
else TRACELOG(LOG_WARNING, "WAVE: Crop range out of bounds");
}
-// Get samples data from wave as a floats array
-// NOTE: Returned sample values are normalized to range [-1..1]
-float *GetWaveData(Wave wave)
+// Load samples data from wave as a floats array
+// NOTE 1: Returned sample values are normalized to range [-1..1]
+// NOTE 2: Sample data allocated should be freed with UnloadWaveSamples()
+float *LoadWaveSamples(Wave wave)
{
float *samples = (float *)RL_MALLOC(wave.sampleCount*sizeof(float));
@@ -1097,6 +1098,12 @@ float *GetWaveData(Wave wave)
return samples;
}
+// Unload samples data loaded with LoadWaveSamples()
+void UnloadWaveSamples(float *samples)
+{
+ RL_FREE(samples);
+}
+
//----------------------------------------------------------------------------------
// Module Functions Definition - Music loading and stream playing (.OGG)
//----------------------------------------------------------------------------------