Don't export SDL_AudioInit/Quit, use SDL_InitSubsystem instead (#6912)
* Don't export SDL_AudioInit/Quit, use SDL_InitSubsystem instead * Update README Co-authored-by: Sam Lantinga <slouken@libsdl.org>
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "SDL_assert_c.h"
|
||||
#include "SDL_log_c.h"
|
||||
#include "audio/SDL_audio_c.h"
|
||||
#include "events/SDL_events_c.h"
|
||||
#include "haptic/SDL_haptic_c.h"
|
||||
#include "joystick/SDL_joystick_c.h"
|
||||
|
||||
@@ -71,4 +71,26 @@ extern SDL_AudioFilter SDL_Convert_F32_to_S16;
|
||||
extern SDL_AudioFilter SDL_Convert_F32_to_U16;
|
||||
extern SDL_AudioFilter SDL_Convert_F32_to_S32;
|
||||
|
||||
/**
|
||||
* Use this function to initialize a particular audio driver.
|
||||
*
|
||||
* This function is used internally, and should not be used unless you have a
|
||||
* specific need to designate the audio driver you want to use. You should
|
||||
* normally use SDL_Init() or SDL_InitSubSystem().
|
||||
*
|
||||
* \param driver_name the name of the desired audio driver
|
||||
* \returns 0 on success or a negative error code on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*/
|
||||
extern int SDL_AudioInit(const char *driver_name);
|
||||
|
||||
/**
|
||||
* Use this function to shut down audio if you initialized it with SDL_AudioInit().
|
||||
*
|
||||
* This function is used internally, and should not be used unless you have a
|
||||
* specific need to specify the audio driver you want to use. You should
|
||||
* normally use SDL_Quit() or SDL_QuitSubSystem().
|
||||
*/
|
||||
extern void SDL_AudioQuit(void);
|
||||
|
||||
#endif /* SDL_audio_c_h_ */
|
||||
|
||||
@@ -34,8 +34,6 @@ SDL3_0.0.0 {
|
||||
SDL_WriteBE64;
|
||||
SDL_GetNumAudioDrivers;
|
||||
SDL_GetAudioDriver;
|
||||
SDL_AudioInit;
|
||||
SDL_AudioQuit;
|
||||
SDL_GetCurrentAudioDriver;
|
||||
SDL_OpenAudio;
|
||||
SDL_GetNumAudioDevices;
|
||||
|
||||
@@ -70,8 +70,6 @@
|
||||
#define SDL_AtomicGetPtr SDL_AtomicGetPtr_REAL
|
||||
#define SDL_GetNumAudioDrivers SDL_GetNumAudioDrivers_REAL
|
||||
#define SDL_GetAudioDriver SDL_GetAudioDriver_REAL
|
||||
#define SDL_AudioInit SDL_AudioInit_REAL
|
||||
#define SDL_AudioQuit SDL_AudioQuit_REAL
|
||||
#define SDL_GetCurrentAudioDriver SDL_GetCurrentAudioDriver_REAL
|
||||
#define SDL_OpenAudio SDL_OpenAudio_REAL
|
||||
#define SDL_GetNumAudioDevices SDL_GetNumAudioDevices_REAL
|
||||
|
||||
@@ -97,8 +97,6 @@ SDL_DYNAPI_PROC(void*,SDL_AtomicSetPtr,(void **a, void *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_AtomicGetPtr,(void **a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetNumAudioDrivers,(void),(),return)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetAudioDriver,(int a),(a),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_AudioInit,(const char *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_AudioQuit,(void),(),)
|
||||
SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_OpenAudio,(SDL_AudioSpec *a, SDL_AudioSpec *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_GetNumAudioDevices,(int a),(a),return)
|
||||
|
||||
@@ -1346,7 +1346,8 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
SDL_Log("%s\n", text);
|
||||
}
|
||||
}
|
||||
if (SDL_AudioInit(state->audiodriver) < 0) {
|
||||
SDL_SetHint("SDL_AUDIO_DRIVER", state->audiodriver);
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
|
||||
SDL_Log("Couldn't initialize audio driver: %s\n",
|
||||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
@@ -2163,7 +2164,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState *state)
|
||||
SDL_VideoQuit();
|
||||
}
|
||||
if (state->flags & SDL_INIT_AUDIO) {
|
||||
SDL_AudioQuit();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
}
|
||||
SDL_free(state);
|
||||
SDL_Quit();
|
||||
|
||||
Reference in New Issue
Block a user