Commit fe1bc980 authored by David Reid's avatar David Reid

Use block comments for major sections.

parent f223ea49
// Audio playback and capture library. Public domain. See "unlicense" statement at the end of this file. /*
// mini_al - v0.8.15 - 201x-xx-xx Audio playback and capture library. Public domain. See "unlicense" statement at the end of this file.
// mini_al - v0.8.15 - 201x-xx-xx
// David Reid - davidreidsoftware@gmail.com
// ABOUT David Reid - davidreidsoftware@gmail.com
// ===== */
// mini_al is a single file library for audio playback and capture. It's written in C (compilable as
// C++) and released into the public domain. /*
// ABOUT
// Supported Backends: =====
// - WASAPI mini_al is a single file library for audio playback and capture. It's written in C (compilable as
// - DirectSound C++) and released into the public domain.
// - WinMM
// - Core Audio (Apple) Supported Backends:
// - ALSA - WASAPI
// - PulseAudio - DirectSound
// - JACK - WinMM
// - sndio (OpenBSD) - Core Audio (Apple)
// - audio(4) (NetBSD and OpenBSD) - ALSA
// - OSS (FreeBSD) - PulseAudio
// - AAudio (Android 8.0+) - JACK
// - OpenSL|ES (Android only) - sndio (OpenBSD)
// - Web Audio (Emscripten) - audio(4) (NetBSD and OpenBSD)
// - Null (Silence) - OSS (FreeBSD)
// - AAudio (Android 8.0+)
// Supported Formats: - OpenSL|ES (Android only)
// - Unsigned 8-bit PCM - Web Audio (Emscripten)
// - Signed 16-bit PCM - Null (Silence)
// - Signed 24-bit PCM (tightly packed)
// - Signed 32-bit PCM Supported Formats:
// - IEEE 32-bit floating point PCM - Unsigned 8-bit PCM
// - Signed 16-bit PCM
// - Signed 24-bit PCM (tightly packed)
// USAGE - Signed 32-bit PCM
// ===== - IEEE 32-bit floating point PCM
// mini_al is a single-file library. To use it, do something like the following in one .c file.
// #define MINI_AL_IMPLEMENTATION
// #include "mini_al.h" USAGE
// =====
// You can then #include this file in other parts of the program as you would with any other header file. mini_al is a single-file library. To use it, do something like the following in one .c file.
// #define MINI_AL_IMPLEMENTATION
// mini_al uses an asynchronous, callback based API. You initialize a device with a configuration (sample rate, #include "mini_al.h"
// channel count, etc.) which includes the callback you want to use to handle data transmission to/from the
// device. In the callback you either read from a data pointer in the case of playback or write to it in the case You can then #include this file in other parts of the program as you would with any other header file.
// of capture.
// mini_al uses an asynchronous, callback based API. You initialize a device with a configuration (sample rate,
// Playback Example channel count, etc.) which includes the callback you want to use to handle data transmission to/from the
// ---------------- device. In the callback you either read from a data pointer in the case of playback or write to it in the case
// mal_uint32 on_send_samples(mal_device* pDevice, mal_uint32 frameCount, void* pSamples) of capture.
// {
// // This callback is set at initialization time and will be called when a playback device needs more Playback Example
// // data. You need to write as many frames as you can to pSamples (but no more than frameCount) and ----------------
// // then return the number of frames you wrote. mal_uint32 on_send_samples(mal_device* pDevice, mal_uint32 frameCount, void* pSamples)
// // {
// // The user data (pDevice->pUserData) is set by mal_device_init(). // This callback is set at initialization time and will be called when a playback device needs more
// return (mal_uint32)mal_decoder_read((mal_decoder*)pDevice->pUserData, frameCount, pSamples); // data. You need to write as many frames as you can to pSamples (but no more than frameCount) and
// } // then return the number of frames you wrote.
// //
// ... // The user data (pDevice->pUserData) is set by mal_device_init().
// return (mal_uint32)mal_decoder_read_pcm_frames((mal_decoder*)pDevice->pUserData, frameCount, pSamples);
// mal_device_config config = mal_device_config_init_playback(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, on_send_frames_to_device); }
//
// mal_device device; ...
// mal_result result = mal_device_init(NULL, mal_device_type_playback, NULL, &config, &decoder /*pUserData*/, &device);
// if (result != MAL_SUCCESS) { mal_device_config config = mal_device_config_init_playback(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, on_send_frames_to_device);
// return -1;
// } mal_device device;
// mal_result result = mal_device_init(NULL, mal_device_type_playback, NULL, &config, &decoder, &device);
// mal_device_start(&device); // The device is sleeping by default so you'll need to start it manually. if (result != MAL_SUCCESS) {
// return -1;
// ... }
//
// mal_device_uninit(&device); // This will stop the device so no need to do that manually. mal_device_start(&device); // The device is sleeping by default so you'll need to start it manually.
//
// ...
//
// If you want to disable a specific backend, #define the appropriate MAL_NO_* option before the implementation. mal_device_uninit(&device); // This will stop the device so no need to do that manually.
//
// Note that GCC and Clang requires "-msse2", "-mavx2", etc. for SIMD optimizations.
//
// If you want to disable a specific backend, #define the appropriate MAL_NO_* option before the implementation.
// Building for Windows
// -------------------- Note that GCC and Clang requires "-msse2", "-mavx2", etc. for SIMD optimizations.
// The Windows build should compile clean on all popular compilers without the need to configure any include paths
// nor link to any libraries.
// Building for Windows
// Building for macOS and iOS --------------------
// -------------------------- The Windows build should compile clean on all popular compilers without the need to configure any include paths
// The macOS build should compile clean without the need to download any dependencies or link to any libraries or nor link to any libraries.
// frameworks. The iOS build needs to be compiled as Objective-C (sorry) and will need to link the relevant frameworks
// but should Just Work with Xcode. Building for macOS and iOS
// --------------------------
// Building for Linux The macOS build should compile clean without the need to download any dependencies or link to any libraries or
// ------------------ frameworks. The iOS build needs to be compiled as Objective-C (sorry) and will need to link the relevant frameworks
// The Linux build only requires linking to -ldl, -lpthread and -lm. You do not need any development packages. but should Just Work with Xcode.
//
// Building for BSD Building for Linux
// ---------------- ------------------
// The BSD build only requires linking to -ldl, -lpthread and -lm. NetBSD uses audio(4), OpenBSD uses sndio and The Linux build only requires linking to -ldl, -lpthread and -lm. You do not need any development packages.
// FreeBSD uses OSS.
// Building for BSD
// Building for Android ----------------
// -------------------- The BSD build only requires linking to -ldl, -lpthread and -lm. NetBSD uses audio(4), OpenBSD uses sndio and
// AAudio is the highest priority backend on Android. This should work out out of the box without needing any kind of FreeBSD uses OSS.
// compiler configuration. Support for AAudio starts with Android 8 which means older versions will fall back to
// OpenSL|ES which requires API level 16+. Building for Android
// --------------------
// Building for Emscripten AAudio is the highest priority backend on Android. This should work out out of the box without needing any kind of
// ----------------------- compiler configuration. Support for AAudio starts with Android 8 which means older versions will fall back to
// The Emscripten build emits Web Audio JavaScript directly and should Just Work without any configuration. OpenSL|ES which requires API level 16+.
//
// Building for Emscripten
// NOTES -----------------------
// ===== The Emscripten build emits Web Audio JavaScript directly and should Just Work without any configuration.
// - This library uses an asynchronous API for delivering and requesting audio data. Each device will have
// it's own worker thread which is managed by the library.
// - If mal_device_init() is called with a device that's not aligned to the platform's natural alignment NOTES
// boundary (4 bytes on 32-bit, 8 bytes on 64-bit), it will _not_ be thread-safe. The reason for this =====
// is that it depends on members of mal_device being correctly aligned for atomic assignments. - This library uses an asynchronous API for delivering and requesting audio data. Each device will have
// - Sample data is always native-endian and interleaved. For example, mal_format_s16 means signed 16-bit it's own worker thread which is managed by the library.
// integer samples, interleaved. Let me know if you need non-interleaved and I'll look into it. - If mal_device_init() is called with a device that's not aligned to the platform's natural alignment
// - The sndio backend is currently only enabled on OpenBSD builds. boundary (4 bytes on 32-bit, 8 bytes on 64-bit), it will _not_ be thread-safe. The reason for this
// - The audio(4) backend is supported on OpenBSD, but you may need to disable sndiod before you can use it. is that it depends on members of mal_device being correctly aligned for atomic assignments.
// - If you are using the platform's default device, mini_al will try automatically switching the internal - Sample data is always native-endian and interleaved. For example, mal_format_s16 means signed 16-bit
// device when the device is unplugged. This feature is disabled when the device is opened in exclusive integer samples, interleaved. Let me know if you need non-interleaved and I'll look into it.
// mode. - The sndio backend is currently only enabled on OpenBSD builds.
// - The audio(4) backend is supported on OpenBSD, but you may need to disable sndiod before you can use it.
// - If you are using the platform's default device, mini_al will try automatically switching the internal
// BACKEND NUANCES device when the device is unplugged. This feature is disabled when the device is opened in exclusive
// =============== mode.
//
// PulseAudio
// ---------- BACKEND NUANCES
// - If you experience bad glitching/noise on Arch Linux, consider this fix from the Arch wiki: ===============
// https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Glitches,_skips_or_crackling
// Alternatively, consider using a different backend such as ALSA. PulseAudio
// ----------
// Android - If you experience bad glitching/noise on Arch Linux, consider this fix from the Arch wiki:
// ------- https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting#Glitches,_skips_or_crackling
// - To capture audio on Android, remember to add the RECORD_AUDIO permission to your manifest: Alternatively, consider using a different backend such as ALSA.
// <uses-permission android:name="android.permission.RECORD_AUDIO" />
// - With OpenSL|ES, only a single mal_context can be active at any given time. This is due to a limitation with OpenSL|ES. Android
// - With AAudio, only default devices are enumerated. This is due to AAudio not having an enumeration API (devices are -------
// enumerated through Java). You can however perform your own device enumeration through Java and then set the ID in the - To capture audio on Android, remember to add the RECORD_AUDIO permission to your manifest:
// mal_device_id structure (mal_device_id.aaudio) and pass it to mal_device_init(). <uses-permission android:name="android.permission.RECORD_AUDIO" />
// - The backend API will perform resampling where possible. The reason for this as opposed to using mini_al's built-in - With OpenSL|ES, only a single mal_context can be active at any given time. This is due to a limitation with OpenSL|ES.
// resampler is to take advantage of any potential device-specific optimizations the driver may implement. - With AAudio, only default devices are enumerated. This is due to AAudio not having an enumeration API (devices are
// enumerated through Java). You can however perform your own device enumeration through Java and then set the ID in the
// UWP mal_device_id structure (mal_device_id.aaudio) and pass it to mal_device_init().
// --- - The backend API will perform resampling where possible. The reason for this as opposed to using mini_al's built-in
// - UWP only supports default playback and capture devices. resampler is to take advantage of any potential device-specific optimizations the driver may implement.
// - UWP requires the Microphone capability to be enabled in the application's manifest (Package.appxmanifest):
// <Package ...> UWP
// ... ---
// <Capabilities> - UWP only supports default playback and capture devices.
// <DeviceCapability Name="microphone" /> - UWP requires the Microphone capability to be enabled in the application's manifest (Package.appxmanifest):
// </Capabilities> <Package ...>
// </Package> ...
// <Capabilities>
// Web Audio / Emscripten <DeviceCapability Name="microphone" />
// ---------------------- </Capabilities>
// - The first time a context is initialized it will create a global object called "mal" whose primary purpose is to act </Package>
// as a factory for device objects.
// - Currently the Web Audio backend uses ScriptProcessorNode's, but this may need to change later as they've been deprecated. Web Audio / Emscripten
// - Google is implementing a policy in their browsers that prevent automatic media output without first receiving some kind ----------------------
// of user input. See here for details: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes. Starting - The first time a context is initialized it will create a global object called "mal" whose primary purpose is to act
// the device may fail if you try to start playback without first handling some kind of user input. as a factory for device objects.
// - Currently the Web Audio backend uses ScriptProcessorNode's, but this may need to change later as they've been deprecated.
// OpenAL - Google is implementing a policy in their browsers that prevent automatic media output without first receiving some kind
// ------ of user input. See here for details: https://developers.google.com/web/updates/2017/09/autoplay-policy-changes. Starting
// - Capture is not supported on iOS with OpenAL. Use the Core Audio backend instead. the device may fail if you try to start playback without first handling some kind of user input.
//
// OpenAL
// OPTIONS ------
// ======= - Capture is not supported on iOS with OpenAL. Use the Core Audio backend instead.
// #define these options before including this file.
//
// #define MAL_NO_WASAPI OPTIONS
// Disables the WASAPI backend. =======
// #define these options before including this file.
// #define MAL_NO_DSOUND
// Disables the DirectSound backend. #define MAL_NO_WASAPI
// Disables the WASAPI backend.
// #define MAL_NO_WINMM
// Disables the WinMM backend. #define MAL_NO_DSOUND
// Disables the DirectSound backend.
// #define MAL_NO_ALSA
// Disables the ALSA backend. #define MAL_NO_WINMM
// Disables the WinMM backend.
// #define MAL_NO_PULSEAUDIO
// Disables the PulseAudio backend. #define MAL_NO_ALSA
// Disables the ALSA backend.
// #define MAL_NO_JACK
// Disables the JACK backend. #define MAL_NO_PULSEAUDIO
// Disables the PulseAudio backend.
// #define MAL_NO_COREAUDIO
// Disables the Core Audio backend. #define MAL_NO_JACK
// Disables the JACK backend.
// #define MAL_NO_SNDIO
// Disables the sndio backend. #define MAL_NO_COREAUDIO
// Disables the Core Audio backend.
// #define MAL_NO_AUDIO4
// Disables the audio(4) backend. #define MAL_NO_SNDIO
// Disables the sndio backend.
// #define MAL_NO_OSS
// Disables the OSS backend. #define MAL_NO_AUDIO4
// Disables the audio(4) backend.
// #define MAL_NO_AAUDIO
// Disables the AAudio backend. #define MAL_NO_OSS
// Disables the OSS backend.
// #define MAL_NO_OPENSL
// Disables the OpenSL|ES backend. #define MAL_NO_AAUDIO
// Disables the AAudio backend.
// #define MAL_NO_WEBAUDIO
// Disables the Web Audio backend. #define MAL_NO_OPENSL
// Disables the OpenSL|ES backend.
// #define MAL_NO_OPENAL
// Disables the OpenAL backend. #define MAL_NO_WEBAUDIO
// Disables the Web Audio backend.
// #define MAL_NO_SDL
// Disables the SDL backend. #define MAL_NO_OPENAL
// Disables the OpenAL backend.
// #define MAL_NO_NULL
// Disables the null backend. #define MAL_NO_SDL
// Disables the SDL backend.
// #define MAL_DEFAULT_PERIODS
// When a period count of 0 is specified when a device is initialized, it will default to this. #define MAL_NO_NULL
// Disables the null backend.
// #define MAL_BASE_BUFFER_SIZE_IN_MILLISECONDS_LOW_LATENCY
// #define MAL_BASE_BUFFER_SIZE_IN_MILLISECONDS_CONSERVATIVE #define MAL_DEFAULT_PERIODS
// When a buffer size of 0 is specified when a device is initialized it will default to a buffer of this size, depending When a period count of 0 is specified when a device is initialized, it will default to this.
// on the chosen performance profile. These can be increased or decreased depending on your specific requirements.
// #define MAL_BASE_BUFFER_SIZE_IN_MILLISECONDS_LOW_LATENCY
// #define MAL_NO_DECODING #define MAL_BASE_BUFFER_SIZE_IN_MILLISECONDS_CONSERVATIVE
// Disables the decoding APIs. When a buffer size of 0 is specified when a device is initialized it will default to a buffer of this size, depending
// on the chosen performance profile. These can be increased or decreased depending on your specific requirements.
// #define MAL_NO_DEVICE_IO
// Disables playback and recording. This will disable mal_context and mal_device APIs. This is useful if you only want to #define MAL_NO_DECODING
// use mini_al's data conversion and/or decoding APIs. Disables the decoding APIs.
//
// #define MAL_NO_STDIO #define MAL_NO_DEVICE_IO
// Disables file IO APIs. Disables playback and recording. This will disable mal_context and mal_device APIs. This is useful if you only want to
// use mini_al's data conversion and/or decoding APIs.
// #define MAL_NO_SSE2
// Disables SSE2 optimizations. #define MAL_NO_STDIO
// Disables file IO APIs.
// #define MAL_NO_AVX2
// Disables AVX2 optimizations. #define MAL_NO_SSE2
// Disables SSE2 optimizations.
// #define MAL_NO_AVX512
// Disables AVX-512 optimizations. #define MAL_NO_AVX2
// Disables AVX2 optimizations.
// #define MAL_NO_NEON
// Disables NEON optimizations. #define MAL_NO_AVX512
// Disables AVX-512 optimizations.
// #define MAL_LOG_LEVEL <Level>
// Sets the logging level. Set level to one of the following: #define MAL_NO_NEON
// MAL_LOG_LEVEL_VERBOSE Disables NEON optimizations.
// MAL_LOG_LEVEL_INFO
// MAL_LOG_LEVEL_WARNING #define MAL_LOG_LEVEL <Level>
// MAL_LOG_LEVEL_ERROR Sets the logging level. Set level to one of the following:
// MAL_LOG_LEVEL_VERBOSE
// #define MAL_DEBUT_OUTPUT MAL_LOG_LEVEL_INFO
// Enable printf() debug output. MAL_LOG_LEVEL_WARNING
// MAL_LOG_LEVEL_ERROR
// #ifndef MAL_COINIT_VALUE
// Windows only. The value to pass to internal calls to CoInitializeEx(). Defaults to COINIT_MULTITHREADED. #define MAL_DEBUT_OUTPUT
Enable printf() debug output.
#ifndef MAL_COINIT_VALUE
Windows only. The value to pass to internal calls to CoInitializeEx(). Defaults to COINIT_MULTITHREADED.
*/
#ifndef mini_al_h #ifndef mini_al_h
#define mini_al_h #define mini_al_h
...@@ -29578,255 +29582,256 @@ mal_uint64 mal_sine_wave_read_f32_ex(mal_sine_wave* pSineWave, mal_uint64 frameC ...@@ -29578,255 +29582,256 @@ mal_uint64 mal_sine_wave_read_f32_ex(mal_sine_wave* pSineWave, mal_uint64 frameC
#endif // MINI_AL_IMPLEMENTATION #endif // MINI_AL_IMPLEMENTATION
/*
// REVISION HISTORY REVISION HISTORY
// ================ ================
//
// v0.8.15 - 201x-xx-xx v0.8.15 - 201x-xx-xx
// - Add Web Audio backend. This is used when compiling with Emscripten. The SDL backend, which was previously - Add Web Audio backend. This is used when compiling with Emscripten. The SDL backend, which was previously
// used for web support, will be removed in a future version. used for web support, will be removed in a future version.
// - Add AAudio backend (Android Audio). This is the new priority backend for Android. Support for AAudio starts - Add AAudio backend (Android Audio). This is the new priority backend for Android. Support for AAudio starts
// with Android 8. OpenSL|ES is used as a fallback for older versions of Android. with Android 8. OpenSL|ES is used as a fallback for older versions of Android.
// - Deprecate the OpenAL backend. - Deprecate the OpenAL backend.
// - Deprecate the SDL backend. - Deprecate the SDL backend.
//
// v0.8.14 - 2018-12-16 v0.8.14 - 2018-12-16
// - Core Audio: Fix a bug where the device state is not set correctly after stopping. - Core Audio: Fix a bug where the device state is not set correctly after stopping.
// - Add support for custom weights to the channel router. - Add support for custom weights to the channel router.
// - Update decoders to use updated APIs in dr_flac, dr_mp3 and dr_wav. - Update decoders to use updated APIs in dr_flac, dr_mp3 and dr_wav.
//
// v0.8.13 - 2018-12-04 v0.8.13 - 2018-12-04
// - Core Audio: Fix a bug with channel mapping. - Core Audio: Fix a bug with channel mapping.
// - Fix a bug with channel routing where the back/left and back/right channels have the wrong weight. - Fix a bug with channel routing where the back/left and back/right channels have the wrong weight.
//
// v0.8.12 - 2018-11-27 v0.8.12 - 2018-11-27
// - Drop support for SDL 1.2. The Emscripten build now requires "-s USE_SDL=2". - Drop support for SDL 1.2. The Emscripten build now requires "-s USE_SDL=2".
// - Fix a linking error with ALSA. - Fix a linking error with ALSA.
// - Fix a bug on iOS where the device name is not set correctly. - Fix a bug on iOS where the device name is not set correctly.
//
// v0.8.11 - 2018-11-21 v0.8.11 - 2018-11-21
// - iOS bug fixes. - iOS bug fixes.
// - Minor tweaks to PulseAudio. - Minor tweaks to PulseAudio.
//
// v0.8.10 - 2018-10-21 v0.8.10 - 2018-10-21
// - Core Audio: Fix a hang when uninitializing a device. - Core Audio: Fix a hang when uninitializing a device.
// - Fix a bug where an incorrect value is returned from mal_device_stop(). - Fix a bug where an incorrect value is returned from mal_device_stop().
//
// v0.8.9 - 2018-09-28 v0.8.9 - 2018-09-28
// - Fix a bug with the SDL backend where device initialization fails. - Fix a bug with the SDL backend where device initialization fails.
//
// v0.8.8 - 2018-09-14 v0.8.8 - 2018-09-14
// - Fix Linux build with the ALSA backend. - Fix Linux build with the ALSA backend.
// - Minor documentation fix. - Minor documentation fix.
//
// v0.8.7 - 2018-09-12 v0.8.7 - 2018-09-12
// - Fix a bug with UWP detection. - Fix a bug with UWP detection.
//
// v0.8.6 - 2018-08-26 v0.8.6 - 2018-08-26
// - Automatically switch the internal device when the default device is unplugged. Note that this is still in the - Automatically switch the internal device when the default device is unplugged. Note that this is still in the
// early stages and not all backends handle this the same way. As of this version, this will not detect a default early stages and not all backends handle this the same way. As of this version, this will not detect a default
// device switch when changed from the operating system's audio preferences (unless the backend itself handles device switch when changed from the operating system's audio preferences (unless the backend itself handles
// this automatically). This is not supported in exclusive mode. this automatically). This is not supported in exclusive mode.
// - WASAPI and Core Audio: Add support for stream routing. When the application is using a default device and the - WASAPI and Core Audio: Add support for stream routing. When the application is using a default device and the
// user switches the default device via the operating system's audio preferences, mini_al will automatically switch user switches the default device via the operating system's audio preferences, mini_al will automatically switch
// the internal device to the new default. This is not supported in exclusive mode. the internal device to the new default. This is not supported in exclusive mode.
// - WASAPI: Add support for hardware offloading via IAudioClient2. Only supported on Windows 8 and newer. - WASAPI: Add support for hardware offloading via IAudioClient2. Only supported on Windows 8 and newer.
// - WASAPI: Add support for low-latency shared mode via IAudioClient3. Only supported on Windows 10 and newer. - WASAPI: Add support for low-latency shared mode via IAudioClient3. Only supported on Windows 10 and newer.
// - Add support for compiling the UWP build as C. - Add support for compiling the UWP build as C.
// - mal_device_set_recv_callback() and mal_device_set_send_callback() have been deprecated. You must now set this - mal_device_set_recv_callback() and mal_device_set_send_callback() have been deprecated. You must now set this
// when the device is initialized with mal_device_init*(). These will be removed in version 0.9.0. when the device is initialized with mal_device_init*(). These will be removed in version 0.9.0.
//
// v0.8.5 - 2018-08-12 v0.8.5 - 2018-08-12
// - Add support for specifying the size of a device's buffer in milliseconds. You can still set the buffer size in - Add support for specifying the size of a device's buffer in milliseconds. You can still set the buffer size in
// frames if that suits you. When bufferSizeInFrames is 0, bufferSizeInMilliseconds will be used. If both are non-0 frames if that suits you. When bufferSizeInFrames is 0, bufferSizeInMilliseconds will be used. If both are non-0
// then bufferSizeInFrames will take priority. If both are set to 0 the default buffer size is used. then bufferSizeInFrames will take priority. If both are set to 0 the default buffer size is used.
// - Add support for the audio(4) backend to OpenBSD. - Add support for the audio(4) backend to OpenBSD.
// - Fix a bug with the ALSA backend that was causing problems on Raspberry Pi. This significantly improves the - Fix a bug with the ALSA backend that was causing problems on Raspberry Pi. This significantly improves the
// Raspberry Pi experience. Raspberry Pi experience.
// - Fix a bug where an incorrect number of samples is returned from sinc resampling. - Fix a bug where an incorrect number of samples is returned from sinc resampling.
// - Add support for setting the value to be passed to internal calls to CoInitializeEx(). - Add support for setting the value to be passed to internal calls to CoInitializeEx().
// - WASAPI and WinMM: Stop the device when it is unplugged. - WASAPI and WinMM: Stop the device when it is unplugged.
//
// v0.8.4 - 2018-08-06 v0.8.4 - 2018-08-06
// - Add sndio backend for OpenBSD. - Add sndio backend for OpenBSD.
// - Add audio(4) backend for NetBSD. - Add audio(4) backend for NetBSD.
// - Drop support for the OSS backend on everything except FreeBSD and DragonFly BSD. - Drop support for the OSS backend on everything except FreeBSD and DragonFly BSD.
// - Formats are now native-endian (were previously little-endian). - Formats are now native-endian (were previously little-endian).
// - Mark some APIs as deprecated: - Mark some APIs as deprecated:
// - mal_src_set_input_sample_rate() and mal_src_set_output_sample_rate() are replaced with mal_src_set_sample_rate(). - mal_src_set_input_sample_rate() and mal_src_set_output_sample_rate() are replaced with mal_src_set_sample_rate().
// - mal_dsp_set_input_sample_rate() and mal_dsp_set_output_sample_rate() are replaced with mal_dsp_set_sample_rate(). - mal_dsp_set_input_sample_rate() and mal_dsp_set_output_sample_rate() are replaced with mal_dsp_set_sample_rate().
// - Fix a bug when capturing using the WASAPI backend. - Fix a bug when capturing using the WASAPI backend.
// - Fix some aliasing issues with resampling, specifically when increasing the sample rate. - Fix some aliasing issues with resampling, specifically when increasing the sample rate.
// - Fix warnings. - Fix warnings.
//
// v0.8.3 - 2018-07-15 v0.8.3 - 2018-07-15
// - Fix a crackling bug when resampling in capture mode. - Fix a crackling bug when resampling in capture mode.
// - Core Audio: Fix a bug where capture does not work. - Core Audio: Fix a bug where capture does not work.
// - ALSA: Fix a bug where the worker thread can get stuck in an infinite loop. - ALSA: Fix a bug where the worker thread can get stuck in an infinite loop.
// - PulseAudio: Fix a bug where mal_context_init() succeeds when PulseAudio is unusable. - PulseAudio: Fix a bug where mal_context_init() succeeds when PulseAudio is unusable.
// - JACK: Fix a bug where mal_context_init() succeeds when JACK is unusable. - JACK: Fix a bug where mal_context_init() succeeds when JACK is unusable.
//
// v0.8.2 - 2018-07-07 v0.8.2 - 2018-07-07
// - Fix a bug on macOS with Core Audio where the internal callback is not called. - Fix a bug on macOS with Core Audio where the internal callback is not called.
//
// v0.8.1 - 2018-07-06 v0.8.1 - 2018-07-06
// - Fix compilation errors and warnings. - Fix compilation errors and warnings.
//
// v0.8 - 2018-07-05 v0.8 - 2018-07-05
// - Changed MAL_IMPLEMENTATION to MINI_AL_IMPLEMENTATION for consistency with other libraries. The old - Changed MAL_IMPLEMENTATION to MINI_AL_IMPLEMENTATION for consistency with other libraries. The old
// way is still supported for now, but you should update as it may be removed in the future. way is still supported for now, but you should update as it may be removed in the future.
// - API CHANGE: Replace device enumeration APIs. mal_enumerate_devices() has been replaced with - API CHANGE: Replace device enumeration APIs. mal_enumerate_devices() has been replaced with
// mal_context_get_devices(). An additional low-level device enumration API has been introduced called mal_context_get_devices(). An additional low-level device enumration API has been introduced called
// mal_context_enumerate_devices() which uses a callback to report devices. mal_context_enumerate_devices() which uses a callback to report devices.
// - API CHANGE: Rename mal_get_sample_size_in_bytes() to mal_get_bytes_per_sample() and add - API CHANGE: Rename mal_get_sample_size_in_bytes() to mal_get_bytes_per_sample() and add
// mal_get_bytes_per_frame(). mal_get_bytes_per_frame().
// - API CHANGE: Replace mal_device_config.preferExclusiveMode with mal_device_config.shareMode. - API CHANGE: Replace mal_device_config.preferExclusiveMode with mal_device_config.shareMode.
// - This new config can be set to mal_share_mode_shared (default) or mal_share_mode_exclusive. - This new config can be set to mal_share_mode_shared (default) or mal_share_mode_exclusive.
// - API CHANGE: Remove excludeNullDevice from mal_context_config.alsa. - API CHANGE: Remove excludeNullDevice from mal_context_config.alsa.
// - API CHANGE: Rename MAL_MAX_SAMPLE_SIZE_IN_BYTES to MAL_MAX_PCM_SAMPLE_SIZE_IN_BYTES. - API CHANGE: Rename MAL_MAX_SAMPLE_SIZE_IN_BYTES to MAL_MAX_PCM_SAMPLE_SIZE_IN_BYTES.
// - API CHANGE: Change the default channel mapping to the standard Microsoft mapping. - API CHANGE: Change the default channel mapping to the standard Microsoft mapping.
// - API CHANGE: Remove backend-specific result codes. - API CHANGE: Remove backend-specific result codes.
// - API CHANGE: Changes to the format conversion APIs (mal_pcm_f32_to_s16(), etc.) - API CHANGE: Changes to the format conversion APIs (mal_pcm_f32_to_s16(), etc.)
// - Add support for Core Audio (Apple). - Add support for Core Audio (Apple).
// - Add support for PulseAudio. - Add support for PulseAudio.
// - This is the highest priority backend on Linux (higher priority than ALSA) since it is commonly - This is the highest priority backend on Linux (higher priority than ALSA) since it is commonly
// installed by default on many of the popular distros and offer's more seamless integration on installed by default on many of the popular distros and offer's more seamless integration on
// platforms where PulseAudio is used. In addition, if PulseAudio is installed and running (which platforms where PulseAudio is used. In addition, if PulseAudio is installed and running (which
// is extremely common), it's better to just use PulseAudio directly rather than going through the is extremely common), it's better to just use PulseAudio directly rather than going through the
// "pulse" ALSA plugin (which is what the "default" ALSA device is likely set to). "pulse" ALSA plugin (which is what the "default" ALSA device is likely set to).
// - Add support for JACK. - Add support for JACK.
// - Remove dependency on asound.h for the ALSA backend. This means the ALSA development packages are no - Remove dependency on asound.h for the ALSA backend. This means the ALSA development packages are no
// longer required to build mini_al. longer required to build mini_al.
// - Remove dependency on dsound.h for the DirectSound backend. This fixes build issues with some - Remove dependency on dsound.h for the DirectSound backend. This fixes build issues with some
// distributions of MinGW. distributions of MinGW.
// - Remove dependency on audioclient.h for the WASAPI backend. This fixes build issues with some - Remove dependency on audioclient.h for the WASAPI backend. This fixes build issues with some
// distributions of MinGW. distributions of MinGW.
// - Add support for dithering to format conversion. - Add support for dithering to format conversion.
// - Add support for configuring the priority of the worker thread. - Add support for configuring the priority of the worker thread.
// - Add a sine wave generator. - Add a sine wave generator.
// - Improve efficiency of sample rate conversion. - Improve efficiency of sample rate conversion.
// - Introduce the notion of standard channel maps. Use mal_get_standard_channel_map(). - Introduce the notion of standard channel maps. Use mal_get_standard_channel_map().
// - Introduce the notion of default device configurations. A default config uses the same configuration - Introduce the notion of default device configurations. A default config uses the same configuration
// as the backend's internal device, and as such results in a pass-through data transmission pipeline. as the backend's internal device, and as such results in a pass-through data transmission pipeline.
// - Add support for passing in NULL for the device config in mal_device_init(), which uses a default - Add support for passing in NULL for the device config in mal_device_init(), which uses a default
// config. This requires manually calling mal_device_set_send/recv_callback(). config. This requires manually calling mal_device_set_send/recv_callback().
// - Add support for decoding from raw PCM data (mal_decoder_init_raw(), etc.) - Add support for decoding from raw PCM data (mal_decoder_init_raw(), etc.)
// - Make mal_device_init_ex() more robust. - Make mal_device_init_ex() more robust.
// - Make some APIs more const-correct. - Make some APIs more const-correct.
// - Fix errors with SDL detection on Apple platforms. - Fix errors with SDL detection on Apple platforms.
// - Fix errors with OpenAL detection. - Fix errors with OpenAL detection.
// - Fix some memory leaks. - Fix some memory leaks.
// - Fix a bug with opening decoders from memory. - Fix a bug with opening decoders from memory.
// - Early work on SSE2, AVX2 and NEON optimizations. - Early work on SSE2, AVX2 and NEON optimizations.
// - Miscellaneous bug fixes. - Miscellaneous bug fixes.
// - Documentation updates. - Documentation updates.
//
// v0.7 - 2018-02-25 v0.7 - 2018-02-25
// - API CHANGE: Change mal_src_read_frames() and mal_dsp_read_frames() to use 64-bit sample counts. - API CHANGE: Change mal_src_read_frames() and mal_dsp_read_frames() to use 64-bit sample counts.
// - Add decoder APIs for loading WAV, FLAC, Vorbis and MP3 files. - Add decoder APIs for loading WAV, FLAC, Vorbis and MP3 files.
// - Allow opening of devices without a context. - Allow opening of devices without a context.
// - In this case the context is created and managed internally by the device. - In this case the context is created and managed internally by the device.
// - Change the default channel mapping to the same as that used by FLAC. - Change the default channel mapping to the same as that used by FLAC.
// - Fix build errors with macOS. - Fix build errors with macOS.
//
// v0.6c - 2018-02-12 v0.6c - 2018-02-12
// - Fix build errors with BSD/OSS. - Fix build errors with BSD/OSS.
//
// v0.6b - 2018-02-03 v0.6b - 2018-02-03
// - Fix some warnings when compiling with Visual C++. - Fix some warnings when compiling with Visual C++.
//
// v0.6a - 2018-01-26 v0.6a - 2018-01-26
// - Fix errors with channel mixing when increasing the channel count. - Fix errors with channel mixing when increasing the channel count.
// - Improvements to the build system for the OpenAL backend. - Improvements to the build system for the OpenAL backend.
// - Documentation fixes. - Documentation fixes.
//
// v0.6 - 2017-12-08 v0.6 - 2017-12-08
// - API CHANGE: Expose and improve mutex APIs. If you were using the mutex APIs before this version you'll - API CHANGE: Expose and improve mutex APIs. If you were using the mutex APIs before this version you'll
// need to update. need to update.
// - API CHANGE: SRC and DSP callbacks now take a pointer to a mal_src and mal_dsp object respectively. - API CHANGE: SRC and DSP callbacks now take a pointer to a mal_src and mal_dsp object respectively.
// - API CHANGE: Improvements to event and thread APIs. These changes make these APIs more consistent. - API CHANGE: Improvements to event and thread APIs. These changes make these APIs more consistent.
// - Add support for SDL and Emscripten. - Add support for SDL and Emscripten.
// - Simplify the build system further for when development packages for various backends are not installed. - Simplify the build system further for when development packages for various backends are not installed.
// With this change, when the compiler supports __has_include, backends without the relevant development With this change, when the compiler supports __has_include, backends without the relevant development
// packages installed will be ignored. This fixes the build for old versions of MinGW. packages installed will be ignored. This fixes the build for old versions of MinGW.
// - Fixes to the Android build. - Fixes to the Android build.
// - Add mal_convert_frames(). This is a high-level helper API for performing a one-time, bulk conversion of - Add mal_convert_frames(). This is a high-level helper API for performing a one-time, bulk conversion of
// audio data to a different format. audio data to a different format.
// - Improvements to f32 -> u8/s16/s24/s32 conversion routines. - Improvements to f32 -> u8/s16/s24/s32 conversion routines.
// - Fix a bug where the wrong value is returned from mal_device_start() for the OpenSL backend. - Fix a bug where the wrong value is returned from mal_device_start() for the OpenSL backend.
// - Fixes and improvements for Raspberry Pi. - Fixes and improvements for Raspberry Pi.
// - Warning fixes. - Warning fixes.
//
// v0.5 - 2017-11-11 v0.5 - 2017-11-11
// - API CHANGE: The mal_context_init() function now takes a pointer to a mal_context_config object for - API CHANGE: The mal_context_init() function now takes a pointer to a mal_context_config object for
// configuring the context. The works in the same kind of way as the device config. The rationale for this configuring the context. The works in the same kind of way as the device config. The rationale for this
// change is to give applications better control over context-level properties, add support for backend- change is to give applications better control over context-level properties, add support for backend-
// specific configurations, and support extensibility without breaking the API. specific configurations, and support extensibility without breaking the API.
// - API CHANGE: The alsa.preferPlugHW device config variable has been removed since it's not really useful for - API CHANGE: The alsa.preferPlugHW device config variable has been removed since it's not really useful for
// anything anymore. anything anymore.
// - ALSA: By default, device enumeration will now only enumerate over unique card/device pairs. Applications - ALSA: By default, device enumeration will now only enumerate over unique card/device pairs. Applications
// can enable verbose device enumeration by setting the alsa.useVerboseDeviceEnumeration context config can enable verbose device enumeration by setting the alsa.useVerboseDeviceEnumeration context config
// variable. variable.
// - ALSA: When opening a device in shared mode (the default), the dmix/dsnoop plugin will be prioritized. If - ALSA: When opening a device in shared mode (the default), the dmix/dsnoop plugin will be prioritized. If
// this fails it will fall back to the hw plugin. With this change the preferExclusiveMode config is now this fails it will fall back to the hw plugin. With this change the preferExclusiveMode config is now
// honored. Note that this does not happen when alsa.useVerboseDeviceEnumeration is set to true (see above) honored. Note that this does not happen when alsa.useVerboseDeviceEnumeration is set to true (see above)
// which is by design. which is by design.
// - ALSA: Add support for excluding the "null" device using the alsa.excludeNullDevice context config variable. - ALSA: Add support for excluding the "null" device using the alsa.excludeNullDevice context config variable.
// - ALSA: Fix a bug with channel mapping which causes an assertion to fail. - ALSA: Fix a bug with channel mapping which causes an assertion to fail.
// - Fix errors with enumeration when pInfo is set to NULL. - Fix errors with enumeration when pInfo is set to NULL.
// - OSS: Fix a bug when starting a device when the client sends 0 samples for the initial buffer fill. - OSS: Fix a bug when starting a device when the client sends 0 samples for the initial buffer fill.
//
// v0.4 - 2017-11-05 v0.4 - 2017-11-05
// - API CHANGE: The log callback is now per-context rather than per-device and as is thus now passed to - API CHANGE: The log callback is now per-context rather than per-device and as is thus now passed to
// mal_context_init(). The rationale for this change is that it allows applications to capture diagnostic mal_context_init(). The rationale for this change is that it allows applications to capture diagnostic
// messages at the context level. Previously this was only available at the device level. messages at the context level. Previously this was only available at the device level.
// - API CHANGE: The device config passed to mal_device_init() is now const. - API CHANGE: The device config passed to mal_device_init() is now const.
// - Added support for OSS which enables support on BSD platforms. - Added support for OSS which enables support on BSD platforms.
// - Added support for WinMM (waveOut/waveIn). - Added support for WinMM (waveOut/waveIn).
// - Added support for UWP (Universal Windows Platform) applications. Currently C++ only. - Added support for UWP (Universal Windows Platform) applications. Currently C++ only.
// - Added support for exclusive mode for selected backends. Currently supported on WASAPI. - Added support for exclusive mode for selected backends. Currently supported on WASAPI.
// - POSIX builds no longer require explicit linking to libpthread (-lpthread). - POSIX builds no longer require explicit linking to libpthread (-lpthread).
// - ALSA: Explicit linking to libasound (-lasound) is no longer required. - ALSA: Explicit linking to libasound (-lasound) is no longer required.
// - ALSA: Latency improvements. - ALSA: Latency improvements.
// - ALSA: Use MMAP mode where available. This can be disabled with the alsa.noMMap config. - ALSA: Use MMAP mode where available. This can be disabled with the alsa.noMMap config.
// - ALSA: Use "hw" devices instead of "plughw" devices by default. This can be disabled with the - ALSA: Use "hw" devices instead of "plughw" devices by default. This can be disabled with the
// alsa.preferPlugHW config. alsa.preferPlugHW config.
// - WASAPI is now the highest priority backend on Windows platforms. - WASAPI is now the highest priority backend on Windows platforms.
// - Fixed an error with sample rate conversion which was causing crackling when capturing. - Fixed an error with sample rate conversion which was causing crackling when capturing.
// - Improved error handling. - Improved error handling.
// - Improved compiler support. - Improved compiler support.
// - Miscellaneous bug fixes. - Miscellaneous bug fixes.
//
// v0.3 - 2017-06-19 v0.3 - 2017-06-19
// - API CHANGE: Introduced the notion of a context. The context is the highest level object and is required for - API CHANGE: Introduced the notion of a context. The context is the highest level object and is required for
// enumerating and creating devices. Now, applications must first create a context, and then use that to enumerating and creating devices. Now, applications must first create a context, and then use that to
// enumerate and create devices. The reason for this change is to ensure device enumeration and creation is enumerate and create devices. The reason for this change is to ensure device enumeration and creation is
// tied to the same backend. In addition, some backends are better suited to this design. tied to the same backend. In addition, some backends are better suited to this design.
// - API CHANGE: Removed the rewinding APIs because they're too inconsistent across the different backends, hard - API CHANGE: Removed the rewinding APIs because they're too inconsistent across the different backends, hard
// to test and maintain, and just generally unreliable. to test and maintain, and just generally unreliable.
// - Added helper APIs for initializing mal_device_config objects. - Added helper APIs for initializing mal_device_config objects.
// - Null Backend: Fixed a crash when recording. - Null Backend: Fixed a crash when recording.
// - Fixed build for UWP. - Fixed build for UWP.
// - Added support for f32 formats to the OpenSL|ES backend. - Added support for f32 formats to the OpenSL|ES backend.
// - Added initial implementation of the WASAPI backend. - Added initial implementation of the WASAPI backend.
// - Added initial implementation of the OpenAL backend. - Added initial implementation of the OpenAL backend.
// - Added support for low quality linear sample rate conversion. - Added support for low quality linear sample rate conversion.
// - Added early support for basic channel mapping. - Added early support for basic channel mapping.
//
// v0.2 - 2016-10-28 v0.2 - 2016-10-28
// - API CHANGE: Add user data pointer as the last parameter to mal_device_init(). The rationale for this - API CHANGE: Add user data pointer as the last parameter to mal_device_init(). The rationale for this
// change is to ensure the logging callback has access to the user data during initialization. change is to ensure the logging callback has access to the user data during initialization.
// - API CHANGE: Have device configuration properties be passed to mal_device_init() via a structure. Rationale: - API CHANGE: Have device configuration properties be passed to mal_device_init() via a structure. Rationale:
// 1) The number of parameters is just getting too much. 1) The number of parameters is just getting too much.
// 2) It makes it a bit easier to add new configuration properties in the future. In particular, there's a 2) It makes it a bit easier to add new configuration properties in the future. In particular, there's a
// chance there will be support added for backend-specific properties. chance there will be support added for backend-specific properties.
// - Dropped support for f64, A-law and Mu-law formats since they just aren't common enough to justify the - Dropped support for f64, A-law and Mu-law formats since they just aren't common enough to justify the
// added maintenance cost. added maintenance cost.
// - DirectSound: Increased the default buffer size for capture devices. - DirectSound: Increased the default buffer size for capture devices.
// - Added initial implementation of the OpenSL|ES backend. - Added initial implementation of the OpenSL|ES backend.
//
// v0.1 - 2016-10-21 v0.1 - 2016-10-21
// - Initial versioned release. - Initial versioned release.
*/
/* /*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment