mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 08:14:04 +02:00
Add ma_get_device_backend_info() and ma_context_get_backend_info().
These functions are used to retrieve basic information about the backend, such as the name. Useful for logging and UI.
This commit is contained in:
+39
-5
@@ -7219,6 +7219,16 @@ extern ma_device_backend_vtable* ma_device_backend_null;
|
|||||||
END BACKENDS
|
END BACKENDS
|
||||||
|
|
||||||
************************************************************************************************************************************************************/
|
************************************************************************************************************************************************************/
|
||||||
|
typedef struct ma_device_backend_info
|
||||||
|
{
|
||||||
|
const char* pName;
|
||||||
|
} ma_device_backend_info;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Retrieves information about a backend.
|
||||||
|
*/
|
||||||
|
MA_API void ma_get_device_backend_info(ma_device_backend_vtable* pBackendVTable, ma_device_backend_info* pBackendInfo);
|
||||||
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -7487,11 +7497,6 @@ typedef struct
|
|||||||
ma_uint32 periodCount;
|
ma_uint32 periodCount;
|
||||||
} ma_device_descriptor;
|
} ma_device_descriptor;
|
||||||
|
|
||||||
typedef struct ma_device_backend_info
|
|
||||||
{
|
|
||||||
const char* pName;
|
|
||||||
} ma_device_backend_info;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This data structure is used to bridge backends to miniaudio. There are two main uses for it:
|
This data structure is used to bridge backends to miniaudio. There are two main uses for it:
|
||||||
@@ -8224,6 +8229,13 @@ A pointer to the backend-specific state object.
|
|||||||
MA_API void* ma_context_get_backend_state(ma_context* pContext);
|
MA_API void* ma_context_get_backend_state(ma_context* pContext);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Retrieves basic information about the backend, most notably the name.
|
||||||
|
*/
|
||||||
|
MA_API void ma_context_get_backend_info(ma_context* pContext, ma_device_backend_info* pBackendInfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Enumerates over every device (both playback and capture).
|
Enumerates over every device (both playback and capture).
|
||||||
|
|
||||||
@@ -43920,6 +43932,17 @@ ma_device_backend_vtable* ma_device_backend_webaudio = NULL;
|
|||||||
#endif /* MA_HAS_WEBAUDIO */
|
#endif /* MA_HAS_WEBAUDIO */
|
||||||
|
|
||||||
|
|
||||||
|
MA_API void ma_get_device_backend_info(ma_device_backend_vtable* pBackendVTable, ma_device_backend_info* pBackendInfo)
|
||||||
|
{
|
||||||
|
if (pBackendVTable == NULL || pBackendVTable->onBackendInfo || pBackendInfo == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MA_ZERO_OBJECT(pBackendInfo);
|
||||||
|
pBackendVTable->onBackendInfo(pBackendInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ma_bool32 ma__is_channel_map_valid(const ma_channel* pChannelMap, ma_uint32 channels)
|
static ma_bool32 ma__is_channel_map_valid(const ma_channel* pChannelMap, ma_uint32 channels)
|
||||||
{
|
{
|
||||||
@@ -44869,6 +44892,17 @@ MA_API void* ma_context_get_backend_state(ma_context* pContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MA_API void ma_context_get_backend_info(ma_context* pContext, ma_device_backend_info* pBackendInfo)
|
||||||
|
{
|
||||||
|
if (pContext == NULL || pBackendInfo == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ma_get_device_backend_info(pContext->pVTable, pBackendInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MA_API ma_result ma_context_enumerate_devices(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData)
|
MA_API ma_result ma_context_enumerate_devices(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData)
|
||||||
{
|
{
|
||||||
ma_result result;
|
ma_result result;
|
||||||
|
|||||||
Reference in New Issue
Block a user