mirror of https://github.com/libsdl-org/SDL
Renamed SDL_IsAudioDevicePaused() to SDL_AudioDevicePaused()
This aligns with the SDL3 convention of removing "Is" from self-explanatory function names Also improved some documentation in SDL_audio.h
This commit is contained in:
parent
c6cad07faa
commit
cd633b9a88
|
@ -148,7 +148,7 @@ SDL_PauseAudioDevice() no longer takes a second argument; it always pauses the d
|
||||||
|
|
||||||
Audio devices, opened by SDL_OpenAudioDevice(), no longer start in a paused state, as they don't begin processing audio until a stream is bound.
|
Audio devices, opened by SDL_OpenAudioDevice(), no longer start in a paused state, as they don't begin processing audio until a stream is bound.
|
||||||
|
|
||||||
SDL_GetAudioDeviceStatus() has been removed; there is now SDL_IsAudioDevicePaused().
|
SDL_GetAudioDeviceStatus() has been removed; there is now SDL_AudioDevicePaused().
|
||||||
|
|
||||||
SDL_QueueAudio(), SDL_DequeueAudio, and SDL_ClearQueuedAudio and SDL_GetQueuedAudioSize() have been removed; an SDL_AudioStream bound to a device provides the exact same functionality.
|
SDL_QueueAudio(), SDL_DequeueAudio, and SDL_ClearQueuedAudio and SDL_GetQueuedAudioSize() have been removed; an SDL_AudioStream bound to a device provides the exact same functionality.
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,8 @@ extern DECLSPEC SDL_AudioDeviceID *SDLCALL SDL_GetAudioCaptureDevices(int *count
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_GetNumAudioDevices
|
* \sa SDL_GetAudioOutputDevices
|
||||||
|
* \sa SDL_GetAudioCaptureDevices
|
||||||
* \sa SDL_GetDefaultAudioInfo
|
* \sa SDL_GetDefaultAudioInfo
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC char *SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceID devid);
|
extern DECLSPEC char *SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceID devid);
|
||||||
|
@ -440,7 +441,7 @@ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDeviceID
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_ResumeAudioDevice
|
* \sa SDL_ResumeAudioDevice
|
||||||
* \sa SDL_IsAudioDevicePaused
|
* \sa SDL_AudioDevicePaused
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
|
extern DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
|
||||||
|
|
||||||
|
@ -468,7 +469,7 @@ extern DECLSPEC int SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev);
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_ResumeAudioDevice
|
* \sa SDL_ResumeAudioDevice
|
||||||
* \sa SDL_IsAudioDevicePaused
|
* \sa SDL_AudioDevicePaused
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
|
extern DECLSPEC int SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
|
||||||
|
|
||||||
|
@ -491,9 +492,9 @@ extern DECLSPEC int SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev);
|
||||||
*
|
*
|
||||||
* \sa SDL_PauseAudioDevice
|
* \sa SDL_PauseAudioDevice
|
||||||
* \sa SDL_ResumeAudioDevice
|
* \sa SDL_ResumeAudioDevice
|
||||||
* \sa SDL_IsAudioDevicePaused
|
* \sa SDL_AudioDevicePaused
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_IsAudioDevicePaused(SDL_AudioDeviceID dev);
|
extern DECLSPEC SDL_bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close a previously-opened audio device.
|
* Close a previously-opened audio device.
|
||||||
|
@ -1089,7 +1090,8 @@ extern DECLSPEC void SDLCALL SDL_DestroyAudioStream(SDL_AudioStream *stream);
|
||||||
*
|
*
|
||||||
* Also unlike other functions, the audio device begins paused. This is to map
|
* Also unlike other functions, the audio device begins paused. This is to map
|
||||||
* more closely to SDL2-style behavior, and since there is no extra step here
|
* more closely to SDL2-style behavior, and since there is no extra step here
|
||||||
* to bind a stream to begin audio flowing.
|
* to bind a stream to begin audio flowing. The audio device should be resumed
|
||||||
|
* with SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
|
||||||
*
|
*
|
||||||
* This function works with both playback and capture devices.
|
* This function works with both playback and capture devices.
|
||||||
*
|
*
|
||||||
|
@ -1123,6 +1125,9 @@ extern DECLSPEC void SDLCALL SDL_DestroyAudioStream(SDL_AudioStream *stream);
|
||||||
* \threadsafety It is safe to call this function from any thread.
|
* \threadsafety It is safe to call this function from any thread.
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_GetAudioStreamDevice
|
||||||
|
* \sa SDL_ResumeAudioDevice
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_AudioStream *SDLCALL SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec, SDL_AudioStreamCallback callback, void *userdata);
|
extern DECLSPEC SDL_AudioStream *SDLCALL SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec, SDL_AudioStreamCallback callback, void *userdata);
|
||||||
|
|
||||||
|
|
|
@ -1415,7 +1415,7 @@ int SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID devid)
|
||||||
return SetLogicalAudioDevicePauseState(devid, 0);
|
return SetLogicalAudioDevicePauseState(devid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool SDL_IsAudioDevicePaused(SDL_AudioDeviceID devid)
|
SDL_bool SDL_AudioDevicePaused(SDL_AudioDeviceID devid)
|
||||||
{
|
{
|
||||||
SDL_LogicalAudioDevice *logdev = ObtainLogicalAudioDevice(devid);
|
SDL_LogicalAudioDevice *logdev = ObtainLogicalAudioDevice(devid);
|
||||||
SDL_bool retval = SDL_FALSE;
|
SDL_bool retval = SDL_FALSE;
|
||||||
|
|
|
@ -885,7 +885,7 @@ SDL3_0.0.0 {
|
||||||
SDL_LoadWAV;
|
SDL_LoadWAV;
|
||||||
SDL_PauseAudioDevice;
|
SDL_PauseAudioDevice;
|
||||||
SDL_ResumeAudioDevice;
|
SDL_ResumeAudioDevice;
|
||||||
SDL_IsAudioDevicePaused;
|
SDL_AudioDevicePaused;
|
||||||
SDL_GetAudioStreamDevice;
|
SDL_GetAudioStreamDevice;
|
||||||
SDL_ShowWindowSystemMenu;
|
SDL_ShowWindowSystemMenu;
|
||||||
SDL_ReadS16LE;
|
SDL_ReadS16LE;
|
||||||
|
|
|
@ -910,7 +910,7 @@
|
||||||
#define SDL_LoadWAV SDL_LoadWAV_REAL
|
#define SDL_LoadWAV SDL_LoadWAV_REAL
|
||||||
#define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL
|
#define SDL_PauseAudioDevice SDL_PauseAudioDevice_REAL
|
||||||
#define SDL_ResumeAudioDevice SDL_ResumeAudioDevice_REAL
|
#define SDL_ResumeAudioDevice SDL_ResumeAudioDevice_REAL
|
||||||
#define SDL_IsAudioDevicePaused SDL_IsAudioDevicePaused_REAL
|
#define SDL_AudioDevicePaused SDL_AudioDevicePaused_REAL
|
||||||
#define SDL_GetAudioStreamDevice SDL_GetAudioStreamDevice_REAL
|
#define SDL_GetAudioStreamDevice SDL_GetAudioStreamDevice_REAL
|
||||||
#define SDL_ShowWindowSystemMenu SDL_ShowWindowSystemMenu_REAL
|
#define SDL_ShowWindowSystemMenu SDL_ShowWindowSystemMenu_REAL
|
||||||
#define SDL_ReadS16LE SDL_ReadS16LE_REAL
|
#define SDL_ReadS16LE SDL_ReadS16LE_REAL
|
||||||
|
|
|
@ -954,7 +954,7 @@ SDL_DYNAPI_PROC(int,SDL_GetSilenceValueForFormat,(SDL_AudioFormat a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uint32 *d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(int,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uint32 *d),(a,b,c,d),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_IsAudioDevicePaused,(SDL_AudioDeviceID a),(a),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_AudioDevicePaused,(SDL_AudioDeviceID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_GetAudioStreamDevice,(SDL_AudioStream *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_GetAudioStreamDevice,(SDL_AudioStream *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16LE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16LE,(SDL_RWops *a, Sint16 *b),(a,b),return)
|
||||||
|
|
|
@ -54,7 +54,7 @@ static void loop(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_IsAudioDevicePaused(devid_in)) {
|
if (!SDL_AudioDevicePaused(devid_in)) {
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
|
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
|
||||||
} else {
|
} else {
|
||||||
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
|
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
|
||||||
|
|
|
@ -226,7 +226,7 @@ static void loop(void)
|
||||||
if (e.type == SDL_EVENT_KEY_DOWN) {
|
if (e.type == SDL_EVENT_KEY_DOWN) {
|
||||||
SDL_Keycode sym = e.key.keysym.sym;
|
SDL_Keycode sym = e.key.keysym.sym;
|
||||||
if (sym == SDLK_q) {
|
if (sym == SDLK_q) {
|
||||||
if (SDL_IsAudioDevicePaused(state->audio_id)) {
|
if (SDL_AudioDevicePaused(state->audio_id)) {
|
||||||
SDL_ResumeAudioDevice(state->audio_id);
|
SDL_ResumeAudioDevice(state->audio_id);
|
||||||
} else {
|
} else {
|
||||||
SDL_PauseAudioDevice(state->audio_id);
|
SDL_PauseAudioDevice(state->audio_id);
|
||||||
|
@ -325,7 +325,7 @@ static void loop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_textf(rend, 0, draw_y, "%7s, Loop: %3s, Flush: %3s",
|
draw_textf(rend, 0, draw_y, "%7s, Loop: %3s, Flush: %3s",
|
||||||
SDL_IsAudioDevicePaused(state->audio_id) ? "Paused" : "Playing", auto_loop ? "On" : "Off", auto_flush ? "On" : "Off");
|
SDL_AudioDevicePaused(state->audio_id) ? "Paused" : "Playing", auto_loop ? "On" : "Off", auto_flush ? "On" : "Off");
|
||||||
draw_y += FONT_LINE_HEIGHT;
|
draw_y += FONT_LINE_HEIGHT;
|
||||||
|
|
||||||
draw_textf(rend, 0, draw_y, "Available: %4.2f (%i bytes)", available_seconds, available_bytes);
|
draw_textf(rend, 0, draw_y, "Available: %4.2f (%i bytes)", available_seconds, available_bytes);
|
||||||
|
|
Loading…
Reference in New Issue