These will be used when a platform lacks any kind of threading support,
such as DOS. This is in preparation for future work to allow the device
API to work without threading support.
With this commit, the DJGPP DOS build can be compiled without
`MA_NO_THREADING`.
This disables the WASAPI, DirectSound and WinMM backends which means
you will not get any actual audio output working. An Xbox backend will
need to come later. The main purpose of this commit is to get the main
library compiling.
The main complication arises from the fact that both _WIN32 and
_MSC_VER are defined which makes miniaudio think it's using a normal
desktop Windows build. In practice it mostly works, but there's a few
things needing to be changed specifically for NXDK:
- `fopen_s()` is not a thing with NXDK. It always uses `fopen()`.
- There is no `_wfopen()`, nor `wcsrtombs()`, so attempting to open
a file from a wide character string will fail.
- There is also no `CreateFileW()`, so this code path will also
result in an error if you attempt to open a file from a wide
character path.
- `CoInitialize()` is not a thing with NXDK and has therefore been
excluded from the build.
- `GetFileInformationByHandle()` does not exist, and neither does
`struct stat` or `stat()`. Since the only file information miniaudio
attempts to retrieve is the file size, I've implemented a fall back
which uses the seek/tell/seek pattern when info retrieval is
unavailable.
- A fall back has been implemented for comparing wide character path
extensions which performs a case-sensitive compare instead. This
means that if you are using wide character paths, miniaudio will not
detect an extension like "wav" and "WAV" as the same thing. This
might be made more robust later if there is enough demand.
Public issue https://github.com/mackron/miniaudio/issues/1023
It's been useful for backends to be able to iterate over an array of
sample rates in a standard order of priority, so I've made this public
for the benefit of custom backends.
This also removes a hard coding for `ma_standard_sample_rate_count`.
It is technically possible for a backend to create a thread which
calls `ma_context/device_get_backend_state()` before miniaudio has
set the internal pointer.
Device information retrieval is now implemented in terms of device
enumeration. Backends should now return any information that would have
been returned from `onContextGetDeviceInfo` straight from
`onContextEnumerateDevices` instead.
The callback passed into `ma_context_enumerate_devices()` would
previously return a boolean, with true telling miniaudio to continue
enumeration, and false to abort. This got a bit confusing to read at
times, so I've decided to make this more explicit.
The new return type is an enum called `ma_device_enumeration_result`.
Instead of returning true to continue enumeration, the new return value
is `MA_DEVICE_ENUMERATION_CONTINUE`. Similarly, instead of returning
false to abort enumeration, `MA_DEVICE_ENUMERATION_ABORT` should be
returned instead.
* Fix an error with the recent refactoring work.
* Fix some build errors with the UWP build.
* Update device enumeration to include format information.