mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Version 0.10.21
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||
miniaudio - v0.10.20 - 2020-10-06
|
||||
miniaudio - v0.10.21 - 2020-10-30
|
||||
|
||||
David Reid - mackron@gmail.com
|
||||
|
||||
@@ -20,7 +20,7 @@ extern "C" {
|
||||
|
||||
#define MA_VERSION_MAJOR 0
|
||||
#define MA_VERSION_MINOR 10
|
||||
#define MA_VERSION_REVISION 20
|
||||
#define MA_VERSION_REVISION 21
|
||||
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
@@ -1525,6 +1525,8 @@ typedef enum
|
||||
ma_backend_null /* <-- Must always be the last item. Lowest priority, and used as the terminator for backend enumeration. */
|
||||
} ma_backend;
|
||||
|
||||
#define MA_BACKEND_COUNT (ma_backend_null+1)
|
||||
|
||||
|
||||
/*
|
||||
The callback for processing audio data from the device.
|
||||
@@ -2474,7 +2476,7 @@ struct ma_device
|
||||
ma_uint32 currentPeriodFramesRemainingPlayback;
|
||||
ma_uint32 currentPeriodFramesRemainingCapture;
|
||||
ma_uint64 lastProcessedFramePlayback;
|
||||
ma_uint32 lastProcessedFrameCapture;
|
||||
ma_uint64 lastProcessedFrameCapture;
|
||||
ma_bool32 isStarted;
|
||||
} null_device;
|
||||
#endif
|
||||
@@ -3674,6 +3676,84 @@ Retrieves a friendly name for a backend.
|
||||
*/
|
||||
MA_API const char* ma_get_backend_name(ma_backend backend);
|
||||
|
||||
/*
|
||||
Determines whether or not the given backend is available by the compilation environment.
|
||||
*/
|
||||
MA_API ma_bool32 ma_is_backend_enabled(ma_backend backend);
|
||||
|
||||
/*
|
||||
Retrieves compile-time enabled backends.
|
||||
|
||||
|
||||
Parameters
|
||||
----------
|
||||
pBackends(out, optional)
|
||||
A pointer to the buffer that will receive the enabled backends. Set to NULL to retrieve the backend count. Setting
|
||||
the capacity of the buffer to `MA_BUFFER_COUNT` will guarantee it's large enough for all backends.
|
||||
|
||||
backendCap(in)
|
||||
The capacity of the `pBackends` buffer.
|
||||
|
||||
pBackendCount(out)
|
||||
A pointer to the variable that will receive the enabled backend count.
|
||||
|
||||
|
||||
Return Value
|
||||
------------
|
||||
MA_SUCCESS if successful.
|
||||
MA_INVALID_ARGS if `pBackendCount` is NULL.
|
||||
MA_NO_SPACE if the capacity of `pBackends` is not large enough.
|
||||
|
||||
If `MA_NO_SPACE` is returned, the `pBackends` buffer will be filled with `*pBackendCount` values.
|
||||
|
||||
|
||||
Thread Safety
|
||||
-------------
|
||||
Safe.
|
||||
|
||||
|
||||
Callback Safety
|
||||
---------------
|
||||
Safe.
|
||||
|
||||
|
||||
Remarks
|
||||
-------
|
||||
If you want to retrieve the number of backends so you can determine the capacity of `pBackends` buffer, you can call
|
||||
this function with `pBackends` set to NULL.
|
||||
|
||||
This will also enumerate the null backend. If you don't want to include this you need to check for `ma_backend_null`
|
||||
when you enumerate over the returned backends and handle it appropriately. Alternatively, you can disable it at
|
||||
compile time with `MA_NO_NULL`.
|
||||
|
||||
The returned backends are determined based on compile time settings, not the platform it's currently running on. For
|
||||
example, PulseAudio will be returned if it was enabled at compile time, even when the user doesn't actually have
|
||||
PulseAudio installed.
|
||||
|
||||
|
||||
Example 1
|
||||
---------
|
||||
The example below retrieves the enabled backend count using a fixed sized buffer allocated on the stack. The buffer is
|
||||
given a capacity of `MA_BACKEND_COUNT` which will guarantee it'll be large enough to store all available backends.
|
||||
Since `MA_BACKEND_COUNT` is always a relatively small value, this should be suitable for most scenarios.
|
||||
|
||||
```
|
||||
ma_backend enabledBackends[MA_BACKEND_COUNT];
|
||||
size_t enabledBackendCount;
|
||||
|
||||
result = ma_get_enabled_backends(enabledBackends, MA_BACKEND_COUNT, &enabledBackendCount);
|
||||
if (result != MA_SUCCESS) {
|
||||
// Failed to retrieve enabled backends. Should never happen in this example since all inputs are valid.
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
ma_is_backend_enabled()
|
||||
*/
|
||||
MA_API ma_result ma_get_enabled_backends(ma_backend* pBackends, size_t backendCap, size_t* pBackendCount);
|
||||
|
||||
/*
|
||||
Determines whether or not loopback mode is support by a backend.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user