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()
This commit is contained in:
Ray 2020-12-18 21:03:08 +01:00
parent 5dd142beb6
commit e07bc372a1
4 changed files with 89 additions and 60 deletions

View file

@ -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)
//----------------------------------------------------------------------------------