mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-24 21:49:10 +00:00
audio: Added SDL_IsAudioDevicePhysical and SDL_IsAudioDevicePlayback.
Fixes #11529.
This commit is contained in:
parent
d53241a299
commit
ce573b01f8
5 changed files with 51 additions and 0 deletions
|
@ -679,6 +679,41 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec);
|
extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if an audio device is physical (instead of logical).
|
||||||
|
*
|
||||||
|
* An SDL_AudioDeviceID that represents physical hardare is a physical device;
|
||||||
|
* there is one for each piece of hardware that SDL can see. Logical devices
|
||||||
|
* are created by calling SDL_OpenAudioDevice or SDL_OpenAudioDeviceStream,
|
||||||
|
* and while each is associated with a physical device, there can be any
|
||||||
|
* number of logical devices on one physical device.
|
||||||
|
*
|
||||||
|
* For the most part, logical and physical IDs are interchangeable--if you
|
||||||
|
* try to open a logical device, SDL understands to assign that effort to the
|
||||||
|
* underlying physical device, etc. However, it might be useful to know if an
|
||||||
|
* arbitrary device ID is physical or logical. This function reports which.
|
||||||
|
*
|
||||||
|
* This function may return either true or false for invalid device IDs.
|
||||||
|
*
|
||||||
|
* \param devid the device ID to query.
|
||||||
|
* \returns true if devid is a physical device, false if it is logical.
|
||||||
|
*
|
||||||
|
* \threadsafety It is safe to call this function from any thread.
|
||||||
|
*/
|
||||||
|
extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if an audio device is a playback device (instead of recording).
|
||||||
|
*
|
||||||
|
* This function may return either true or false for invalid device IDs.
|
||||||
|
*
|
||||||
|
* \param devid the device ID to query.
|
||||||
|
* \returns true if devid is a playback device, false if it is recording.
|
||||||
|
*
|
||||||
|
* \threadsafety It is safe to call this function from any thread.
|
||||||
|
*/
|
||||||
|
extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this function to pause audio playback on a specified device.
|
* Use this function to pause audio playback on a specified device.
|
||||||
*
|
*
|
||||||
|
|
|
@ -346,6 +346,16 @@ static SDL_AudioDeviceID AssignAudioDeviceInstanceId(bool recording, bool islogi
|
||||||
return instance_id;
|
return instance_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid)
|
||||||
|
{
|
||||||
|
return (devid & (1 << 1)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid)
|
||||||
|
{
|
||||||
|
return (devid & (1 << 0)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void ObtainPhysicalAudioDeviceObj(SDL_AudioDevice *device) SDL_NO_THREAD_SAFETY_ANALYSIS // !!! FIXMEL SDL_ACQUIRE
|
static void ObtainPhysicalAudioDeviceObj(SDL_AudioDevice *device) SDL_NO_THREAD_SAFETY_ANALYSIS // !!! FIXMEL SDL_ACQUIRE
|
||||||
{
|
{
|
||||||
if (device) {
|
if (device) {
|
||||||
|
|
|
@ -1187,6 +1187,8 @@ SDL3_0.0.0 {
|
||||||
SDL_SaveFile_IO;
|
SDL_SaveFile_IO;
|
||||||
SDL_SaveFile;
|
SDL_SaveFile;
|
||||||
SDL_GetCurrentDirectory;
|
SDL_GetCurrentDirectory;
|
||||||
|
SDL_IsAudioDevicePhysical;
|
||||||
|
SDL_IsAudioDevicePlayback;
|
||||||
# extra symbols go here (don't modify this line)
|
# extra symbols go here (don't modify this line)
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1212,3 +1212,5 @@
|
||||||
#define SDL_SaveFile_IO SDL_SaveFile_IO_REAL
|
#define SDL_SaveFile_IO SDL_SaveFile_IO_REAL
|
||||||
#define SDL_SaveFile SDL_SaveFile_REAL
|
#define SDL_SaveFile SDL_SaveFile_REAL
|
||||||
#define SDL_GetCurrentDirectory SDL_GetCurrentDirectory_REAL
|
#define SDL_GetCurrentDirectory SDL_GetCurrentDirectory_REAL
|
||||||
|
#define SDL_IsAudioDevicePhysical SDL_IsAudioDevicePhysical_REAL
|
||||||
|
#define SDL_IsAudioDevicePlayback SDL_IsAudioDevicePlayback_REAL
|
||||||
|
|
|
@ -1218,3 +1218,5 @@ SDL_DYNAPI_PROC(bool,SDL_CancelGPUCommandBuffer,(SDL_GPUCommandBuffer *a),(a),re
|
||||||
SDL_DYNAPI_PROC(bool,SDL_SaveFile_IO,(SDL_IOStream *a,const void *b,size_t c,bool d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(bool,SDL_SaveFile_IO,(SDL_IOStream *a,const void *b,size_t c,bool d),(a,b,c,d),return)
|
||||||
SDL_DYNAPI_PROC(bool,SDL_SaveFile,(const char *a,const void *b,size_t c),(a,b,c),return)
|
SDL_DYNAPI_PROC(bool,SDL_SaveFile,(const char *a,const void *b,size_t c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(char*,SDL_GetCurrentDirectory,(void),(),return)
|
SDL_DYNAPI_PROC(char*,SDL_GetCurrentDirectory,(void),(),return)
|
||||||
|
SDL_DYNAPI_PROC(bool,SDL_IsAudioDevicePhysical,(SDL_AudioDeviceID a),(a),return)
|
||||||
|
SDL_DYNAPI_PROC(bool,SDL_IsAudioDevicePlayback,(SDL_AudioDeviceID a),(a),return)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue