diff --git a/WhatsNew.txt b/WhatsNew.txt index 2d0a1d7b7..bd4511c82 100644 --- a/WhatsNew.txt +++ b/WhatsNew.txt @@ -16,6 +16,7 @@ General: * RW_SEEK_END -> SDL_RW_SEEK_END * RW_SEEK_SET -> SDL_RW_SEEK_SET * The following functions have been renamed: + * SDL_FreeWAV => SDL_free * Removed the following functions from the API, see docs/README-migration.md for details: * SDL_CalculateGammaRamp() * SDL_CreateRGBSurface() diff --git a/docs/README-migration.md b/docs/README-migration.md index 6f1ca3e50..e782a6734 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -40,6 +40,11 @@ begin_code.h and close_code.h in the public headers have been renamed to SDL_beg The vi format comments have been removed from source code. Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim) to automatically set tab spacing for the SDL coding style. +## SDL_audio.h + +The following functions have been renamed: +* SDL_FreeWAV => SDL_free + ## SDL_cpuinfo.h - SDL_Has3DNow() has been removed; there is no replacement. diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 51c83440d..6c436f4e1 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -808,7 +808,7 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, * data in the buffer. The `samples` member is set to a sane default and all * others are set to zero. * - * It's necessary to use SDL_FreeWAV() to free the audio data returned in + * It's necessary to use SDL_free() to free the audio data returned in * `audio_buf` when it is no longer used. * * Because of the underspecification of the .WAV format, there are many @@ -860,11 +860,11 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, * more information. * * When the application is done with the data returned in - * `audio_buf`, it should call SDL_FreeWAV() to dispose of it. + * `audio_buf`, it should call SDL_free() to dispose of it. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_FreeWAV + * \sa SDL_free * \sa SDL_LoadWAV */ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, @@ -880,23 +880,6 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) -/** - * Free data previously allocated with SDL_LoadWAV() or SDL_LoadWAV_RW(). - * - * After a WAVE file has been opened with SDL_LoadWAV() or SDL_LoadWAV_RW() - * its data can eventually be freed with SDL_FreeWAV(). It is safe to call - * this function with a NULL pointer. - * - * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or - * SDL_LoadWAV_RW() - * - * \since This function is available since SDL 3.0.0. - * - * \sa SDL_LoadWAV - * \sa SDL_LoadWAV_RW - */ -extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); - /** * Initialize an SDL_AudioCVT structure for conversion. * diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index 24f36f695..4ffcffec0 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -39,6 +39,9 @@ */ #ifdef SDL_ENABLE_OLD_NAMES +/* ##SDL_audio.h */ +#define SDL_FreeWAV SDL_free + /* ##SDL_keycode.h */ #define KMOD_ALT SDL_KMOD_ALT #define KMOD_CAPS SDL_KMOD_CAPS @@ -74,6 +77,9 @@ #else /* !SDL_ENABLE_OLD_NAMES */ +/* ##SDL_audio.h */ +#define SDL_FreeWAV SDL_FreeWAV_renamed_SDL_free + /* ##SDL_keycode.h */ #define KMOD_ALT KMOD_ALT_renamed_SDL_KMOD_ALT #define KMOD_CAPS KMOD_CAPS_renamed_SDL_KMOD_CAPS diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index c28a31a45..04c4f6455 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -2124,11 +2124,3 @@ SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_b return spec; } - -/* Since the WAV memory is allocated in the shared library, it must also - be freed here. (Necessary under Win32, VC++) - */ -void SDL_FreeWAV(Uint8 *audio_buf) -{ - SDL_free(audio_buf); -} diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 1a3e2d69c..6b5d565c2 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -48,7 +48,6 @@ SDL3_0.0.0 { SDL_PauseAudio; SDL_PauseAudioDevice; SDL_LoadWAV_RW; - SDL_FreeWAV; SDL_BuildAudioCVT; SDL_ConvertAudio; SDL_NewAudioStream; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index dec3fab44..35a0a662c 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -82,7 +82,6 @@ #define SDL_PauseAudio SDL_PauseAudio_REAL #define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL #define SDL_LoadWAV_RW SDL_LoadWAV_RW_REAL -#define SDL_FreeWAV SDL_FreeWAV_REAL #define SDL_BuildAudioCVT SDL_BuildAudioCVT_REAL #define SDL_ConvertAudio SDL_ConvertAudio_REAL #define SDL_MixAudio SDL_MixAudio_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 7a80f80de..ce81e7f83 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -109,7 +109,6 @@ SDL_DYNAPI_PROC(SDL_AudioStatus,SDL_GetAudioDeviceStatus,(SDL_AudioDeviceID a),( SDL_DYNAPI_PROC(void,SDL_PauseAudio,(int a),(a),) SDL_DYNAPI_PROC(void,SDL_PauseAudioDevice,(SDL_AudioDeviceID a, int b),(a,b),) SDL_DYNAPI_PROC(SDL_AudioSpec*,SDL_LoadWAV_RW,(SDL_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(void,SDL_FreeWAV,(Uint8 *a),(a),) SDL_DYNAPI_PROC(int,SDL_BuildAudioCVT,(SDL_AudioCVT *a, SDL_AudioFormat b, Uint8 c, int d, SDL_AudioFormat e, Uint8 f, int g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(int,SDL_ConvertAudio,(SDL_AudioCVT *a),(a),return) SDL_DYNAPI_PROC(void,SDL_MixAudio,(Uint8 *a, const Uint8 *b, Uint32 c, int d),(a,b,c,d),) diff --git a/test/loopwave.c b/test/loopwave.c index eccee138b..a4d05e04d 100644 --- a/test/loopwave.c +++ b/test/loopwave.c @@ -59,7 +59,7 @@ open_audio() device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0); if (!device) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); - SDL_FreeWAV(wave.sound); + SDL_free(wave.sound); quit(2); } @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) /* Clean up on signal */ close_audio(); - SDL_FreeWAV(wave.sound); + SDL_free(wave.sound); SDL_free(filename); SDL_Quit(); return 0; diff --git a/test/loopwavequeue.c b/test/loopwavequeue.c index 3acd92fba..25fce1ec5 100644 --- a/test/loopwavequeue.c +++ b/test/loopwavequeue.c @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) /* Initialize fillerup() variables */ if (SDL_OpenAudio(&wave.spec, NULL) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); - SDL_FreeWAV(wave.sound); + SDL_free(wave.sound); quit(2); } @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) /* Clean up on signal */ SDL_CloseAudio(); - SDL_FreeWAV(wave.sound); + SDL_free(wave.sound); SDL_free(filename); SDL_Quit(); return 0; diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c index a5d3c73a0..085dbb030 100644 --- a/test/testaudiohotplug.c +++ b/test/testaudiohotplug.c @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) /* Clean up on signal */ /* Quit audio first, then free WAV. This prevents access violations in the audio threads. */ SDL_QuitSubSystem(SDL_INIT_AUDIO); - SDL_FreeWAV(sound); + SDL_free(sound); SDL_free(filename); SDL_Quit(); return 0; diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c index 906cda3cf..1e6ad500f 100644 --- a/test/testmultiaudio.c +++ b/test/testmultiaudio.c @@ -62,7 +62,7 @@ void loop() #endif SDL_PauseAudioDevice(cbd[0].dev, 1); SDL_CloseAudioDevice(cbd[0].dev); - SDL_FreeWAV(sound); + SDL_free(sound); SDL_Quit(); } } @@ -190,7 +190,7 @@ int main(int argc, char **argv) SDL_GetError()); } else { test_multi_audio(devcount); - SDL_FreeWAV(sound); + SDL_free(sound); } SDL_free(file); diff --git a/test/testresample.c b/test/testresample.c index 7d40778f8..1487d3d22 100644 --- a/test/testresample.c +++ b/test/testresample.c @@ -51,7 +51,7 @@ int main(int argc, char **argv) if (SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq, spec.format, cvtchans, cvtfreq) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to build CVT: %s\n", SDL_GetError()); - SDL_FreeWAV(data); + SDL_free(data); SDL_Quit(); return 4; } @@ -60,7 +60,7 @@ int main(int argc, char **argv) cvt.buf = (Uint8 *)SDL_malloc((size_t)len * cvt.len_mult); if (cvt.buf == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory.\n"); - SDL_FreeWAV(data); + SDL_free(data); SDL_Quit(); return 5; } @@ -69,7 +69,7 @@ int main(int argc, char **argv) if (SDL_ConvertAudio(&cvt) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Conversion failed: %s\n", SDL_GetError()); SDL_free(cvt.buf); - SDL_FreeWAV(data); + SDL_free(data); SDL_Quit(); return 6; } @@ -79,7 +79,7 @@ int main(int argc, char **argv) if (io == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", argv[2], SDL_GetError()); SDL_free(cvt.buf); - SDL_FreeWAV(data); + SDL_free(data); SDL_Quit(); return 7; } @@ -106,13 +106,13 @@ int main(int argc, char **argv) if (SDL_RWclose(io) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fclose('%s') failed: %s\n", argv[2], SDL_GetError()); SDL_free(cvt.buf); - SDL_FreeWAV(data); + SDL_free(data); SDL_Quit(); return 8; } /* if */ SDL_free(cvt.buf); - SDL_FreeWAV(data); + SDL_free(data); SDL_Quit(); return 0; } /* main */