Commit 1778a5e8 authored by David Reid's avatar David Reid

Version 0.11.10

parent 89875c2b
v0.11.10 - TBD v0.11.10 - 2022-10-20
===================== =====================
* Add support for setting the device notification callback when initializing an engine object. * Add support for setting the device notification callback when initializing an engine object.
* Add support for more than 2 outputs to splitter nodes.
* Fix a crash when initializing a channel converter. * Fix a crash when initializing a channel converter.
* Fix a channel mapping error where weights are calculated incorrectly.
* Fix an unaligned access error. * Fix an unaligned access error.
* Fix logging with the C++ build.
* Fix some undefined behavior errors, including some memset()'s to null pointers of 0 bytes.
* Fix logging of device info for loopback devices.
* WASAPI: Fix an error where 32-bit formats are not properly detected.
* WASAPI: Fix a bug where the device is not drained when stopped.
* WASAPI: Fix an issue with loopback mode that results in waiting indefinitely and the callback never getting fired.
* WASAPI: Add support for the Avrt API to specify the audio thread's latency sensitivity requirements. Use the `deviceConfig.wasapi.usage` configuration option.
* PulseAudio: Pass the requested sample rate, if set, to PulseAudio so that it uses the requested sample rate internally rather than always using miniaudio's resampler.
* PulseAudio: Fix a rare null pointer dereference.
* ALSA: Fix a potential crash on older versions of Linux.
* Core Audio: Fix a very unlikely memory leak.
* Core Audio: Update a deprecated symbol.
* AAudio: Fix an error where the wrong tokens are being used for usage, content types and input preset hints.
* WebAudio: Do some cleanup of the internal global JavaScript object when the last context has been uninitialized.
* Win32: Fix an error when the channel mask reported by Windows is all zero. * Win32: Fix an error when the channel mask reported by Windows is all zero.
* Various documentation fixes.
* Bring dr_wav, dr_flac and dr_mp3 up-to-date with latest versions.
v0.11.9 - 2022-04-20 v0.11.9 - 2022-04-20
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/* /*
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file. Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
miniaudio - v0.11.9 - 2022-04-20 miniaudio - v0.11.10 - 2022-10-20
David Reid - mackron@gmail.com David Reid - mackron@gmail.com
...@@ -20,7 +20,7 @@ extern "C" { ...@@ -20,7 +20,7 @@ extern "C" {
#define MA_VERSION_MAJOR 0 #define MA_VERSION_MAJOR 0
#define MA_VERSION_MINOR 11 #define MA_VERSION_MINOR 11
#define MA_VERSION_REVISION 9 #define MA_VERSION_REVISION 10
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION) #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__) #if defined(_MSC_VER) && !defined(__clang__)
...@@ -117,7 +117,7 @@ typedef ma_uint16 wchar_t; ...@@ -117,7 +117,7 @@ typedef ma_uint16 wchar_t;
/* Platform/backend detection. */ /* Platform/backend detection. */
#ifdef _WIN32 #ifdef _WIN32
#define MA_WIN32 #define MA_WIN32
#if defined(WINAPI_FAMILY) && ((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || (defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)) #if defined(MA_FORCE_UWP) || (defined(WINAPI_FAMILY) && ((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || (defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)))
#define MA_WIN32_UWP #define MA_WIN32_UWP
#elif defined(WINAPI_FAMILY) && (defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES) #elif defined(WINAPI_FAMILY) && (defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
#define MA_WIN32_GDK #define MA_WIN32_GDK
...@@ -270,7 +270,7 @@ implications. Where supported by the compiler, alignment will be used, but other ...@@ -270,7 +270,7 @@ implications. Where supported by the compiler, alignment will be used, but other
architecture does not require it, it will simply leave it unaligned. This is the case with old architecture does not require it, it will simply leave it unaligned. This is the case with old
versions of Visual Studio, which I've confirmed with at least VC6. versions of Visual Studio, which I've confirmed with at least VC6.
*/ */
#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #if !defined(_MSC_VER) && defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#include <stdalign.h> #include <stdalign.h>
#define MA_ATOMIC(alignment, type) alignas(alignment) type #define MA_ATOMIC(alignment, type) alignas(alignment) type
#else #else
...@@ -503,7 +503,7 @@ typedef enum ...@@ -503,7 +503,7 @@ typedef enum
{ {
ma_channel_mix_mode_rectangular = 0, /* Simple averaging based on the plane(s) the channel is sitting on. */ ma_channel_mix_mode_rectangular = 0, /* Simple averaging based on the plane(s) the channel is sitting on. */
ma_channel_mix_mode_simple, /* Drop excess channels; zeroed out extra channels. */ ma_channel_mix_mode_simple, /* Drop excess channels; zeroed out extra channels. */
ma_channel_mix_mode_custom_weights, /* Use custom weights specified in ma_channel_router_config. */ ma_channel_mix_mode_custom_weights, /* Use custom weights specified in ma_channel_converter_config. */
ma_channel_mix_mode_default = ma_channel_mix_mode_rectangular ma_channel_mix_mode_default = ma_channel_mix_mode_rectangular
} ma_channel_mix_mode; } ma_channel_mix_mode;
...@@ -1128,7 +1128,7 @@ typedef struct ...@@ -1128,7 +1128,7 @@ typedef struct
{ {
ma_delay_config config; ma_delay_config config;
ma_uint32 cursor; /* Feedback is written to this cursor. Always equal or in front of the read cursor. */ ma_uint32 cursor; /* Feedback is written to this cursor. Always equal or in front of the read cursor. */
ma_uint32 bufferSizeInFrames; /* The maximum of config.startDelayInFrames and config.feedbackDelayInFrames. */ ma_uint32 bufferSizeInFrames;
float* pBuffer; float* pBuffer;
} ma_delay; } ma_delay;
...@@ -1644,6 +1644,7 @@ typedef struct ...@@ -1644,6 +1644,7 @@ typedef struct
const ma_channel* pChannelMapIn; const ma_channel* pChannelMapIn;
const ma_channel* pChannelMapOut; const ma_channel* pChannelMapOut;
ma_channel_mix_mode mixingMode; ma_channel_mix_mode mixingMode;
ma_bool32 calculateLFEFromSpatialChannels; /* When an output LFE channel is present, but no input LFE, set to true to set the output LFE to the average of all spatial channels (LR, FR, etc.). Ignored when an input LFE is present. */
float** ppWeights; /* [in][out]. Only used when mixingMode is set to ma_channel_mix_mode_custom_weights. */ float** ppWeights; /* [in][out]. Only used when mixingMode is set to ma_channel_mix_mode_custom_weights. */
} ma_channel_converter_config; } ma_channel_converter_config;
...@@ -1696,6 +1697,7 @@ typedef struct ...@@ -1696,6 +1697,7 @@ typedef struct
ma_channel* pChannelMapOut; ma_channel* pChannelMapOut;
ma_dither_mode ditherMode; ma_dither_mode ditherMode;
ma_channel_mix_mode channelMixMode; ma_channel_mix_mode channelMixMode;
ma_bool32 calculateLFEFromSpatialChannels; /* When an output LFE channel is present, but no input LFE, set to true to set the output LFE to the average of all spatial channels (LR, FR, etc.). Ignored when an input LFE is present. */
float** ppChannelWeights; /* [in][out]. Only used when mixingMode is set to ma_channel_mix_mode_custom_weights. */ float** ppChannelWeights; /* [in][out]. Only used when mixingMode is set to ma_channel_mix_mode_custom_weights. */
ma_bool32 allowDynamicSampleRate; ma_bool32 allowDynamicSampleRate;
ma_resampler_config resampling; ma_resampler_config resampling;
...@@ -1876,6 +1878,28 @@ The channel map buffer must have a capacity of at least `channels`. ...@@ -1876,6 +1878,28 @@ The channel map buffer must have a capacity of at least `channels`.
*/ */
MA_API ma_bool32 ma_channel_map_contains_channel_position(ma_uint32 channels, const ma_channel* pChannelMap, ma_channel channelPosition); MA_API ma_bool32 ma_channel_map_contains_channel_position(ma_uint32 channels, const ma_channel* pChannelMap, ma_channel channelPosition);
/*
Find a channel position in the given channel map. Returns MA_TRUE if the channel is found; MA_FALSE otherwise. The
index of the channel is output to `pChannelIndex`.
The channel map buffer must have a capacity of at least `channels`.
*/
MA_API ma_bool32 ma_channel_map_find_channel_position(ma_uint32 channels, const ma_channel* pChannelMap, ma_channel channelPosition, ma_uint32* pChannelIndex);
/*
Generates a string representing the given channel map.
This is for printing and debugging purposes, not serialization/deserialization.
Returns the length of the string, not including the null terminator.
*/
MA_API size_t ma_channel_map_to_string(const ma_channel* pChannelMap, ma_uint32 channels, char* pBufferOut, size_t bufferCap);
/*
Retrieves a human readable version of a channel position.
*/
MA_API const char* ma_channel_position_to_string(ma_channel channel);
/************************************************************************************************************************************************************ /************************************************************************************************************************************************************
...@@ -2792,7 +2816,7 @@ typedef enum ...@@ -2792,7 +2816,7 @@ typedef enum
/* iOS/tvOS/watchOS session categories. */ /* iOS/tvOS/watchOS session categories. */
typedef enum typedef enum
{ {
ma_ios_session_category_default = 0, /* AVAudioSessionCategoryPlayAndRecord with AVAudioSessionCategoryOptionDefaultToSpeaker. */ ma_ios_session_category_default = 0, /* AVAudioSessionCategoryPlayAndRecord. */
ma_ios_session_category_none, /* Leave the session category unchanged. */ ma_ios_session_category_none, /* Leave the session category unchanged. */
ma_ios_session_category_ambient, /* AVAudioSessionCategoryAmbient */ ma_ios_session_category_ambient, /* AVAudioSessionCategoryAmbient */
ma_ios_session_category_solo_ambient, /* AVAudioSessionCategorySoloAmbient */ ma_ios_session_category_solo_ambient, /* AVAudioSessionCategorySoloAmbient */
...@@ -2837,36 +2861,44 @@ typedef enum ...@@ -2837,36 +2861,44 @@ typedef enum
ma_opensl_recording_preset_voice_unprocessed /* SL_ANDROID_RECORDING_PRESET_UNPROCESSED */ ma_opensl_recording_preset_voice_unprocessed /* SL_ANDROID_RECORDING_PRESET_UNPROCESSED */
} ma_opensl_recording_preset; } ma_opensl_recording_preset;
/* WASAPI audio thread priority characteristics. */
typedef enum
{
ma_wasapi_usage_default = 0,
ma_wasapi_usage_games,
ma_wasapi_usage_pro_audio,
} ma_wasapi_usage;
/* AAudio usage types. */ /* AAudio usage types. */
typedef enum typedef enum
{ {
ma_aaudio_usage_default = 0, /* Leaves the usage type unset. */ ma_aaudio_usage_default = 0, /* Leaves the usage type unset. */
ma_aaudio_usage_announcement, /* AAUDIO_SYSTEM_USAGE_ANNOUNCEMENT */ ma_aaudio_usage_media, /* AAUDIO_USAGE_MEDIA */
ma_aaudio_usage_emergency, /* AAUDIO_SYSTEM_USAGE_EMERGENCY */ ma_aaudio_usage_voice_communication, /* AAUDIO_USAGE_VOICE_COMMUNICATION */
ma_aaudio_usage_safety, /* AAUDIO_SYSTEM_USAGE_SAFETY */ ma_aaudio_usage_voice_communication_signalling, /* AAUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING */
ma_aaudio_usage_vehicle_status, /* AAUDIO_SYSTEM_USAGE_VEHICLE_STATUS */
ma_aaudio_usage_alarm, /* AAUDIO_USAGE_ALARM */ ma_aaudio_usage_alarm, /* AAUDIO_USAGE_ALARM */
ma_aaudio_usage_notification, /* AAUDIO_USAGE_NOTIFICATION */
ma_aaudio_usage_notification_ringtone, /* AAUDIO_USAGE_NOTIFICATION_RINGTONE */
ma_aaudio_usage_notification_event, /* AAUDIO_USAGE_NOTIFICATION_EVENT */
ma_aaudio_usage_assistance_accessibility, /* AAUDIO_USAGE_ASSISTANCE_ACCESSIBILITY */ ma_aaudio_usage_assistance_accessibility, /* AAUDIO_USAGE_ASSISTANCE_ACCESSIBILITY */
ma_aaudio_usage_assistance_navigation_guidance, /* AAUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE */ ma_aaudio_usage_assistance_navigation_guidance, /* AAUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE */
ma_aaudio_usage_assistance_sonification, /* AAUDIO_USAGE_ASSISTANCE_SONIFICATION */ ma_aaudio_usage_assistance_sonification, /* AAUDIO_USAGE_ASSISTANCE_SONIFICATION */
ma_aaudio_usage_assitant, /* AAUDIO_USAGE_ASSISTANT */
ma_aaudio_usage_game, /* AAUDIO_USAGE_GAME */ ma_aaudio_usage_game, /* AAUDIO_USAGE_GAME */
ma_aaudio_usage_media, /* AAUDIO_USAGE_MEDIA */ ma_aaudio_usage_assitant, /* AAUDIO_USAGE_ASSISTANT */
ma_aaudio_usage_notification, /* AAUDIO_USAGE_NOTIFICATION */ ma_aaudio_usage_emergency, /* AAUDIO_SYSTEM_USAGE_EMERGENCY */
ma_aaudio_usage_notification_event, /* AAUDIO_USAGE_NOTIFICATION_EVENT */ ma_aaudio_usage_safety, /* AAUDIO_SYSTEM_USAGE_SAFETY */
ma_aaudio_usage_notification_ringtone, /* AAUDIO_USAGE_NOTIFICATION_RINGTONE */ ma_aaudio_usage_vehicle_status, /* AAUDIO_SYSTEM_USAGE_VEHICLE_STATUS */
ma_aaudio_usage_voice_communication, /* AAUDIO_USAGE_VOICE_COMMUNICATION */ ma_aaudio_usage_announcement /* AAUDIO_SYSTEM_USAGE_ANNOUNCEMENT */
ma_aaudio_usage_voice_communication_signalling /* AAUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING */
} ma_aaudio_usage; } ma_aaudio_usage;
/* AAudio content types. */ /* AAudio content types. */
typedef enum typedef enum
{ {
ma_aaudio_content_type_default = 0, /* Leaves the content type unset. */ ma_aaudio_content_type_default = 0, /* Leaves the content type unset. */
ma_aaudio_content_type_movie, /* AAUDIO_CONTENT_TYPE_MOVIE */ ma_aaudio_content_type_speech, /* AAUDIO_CONTENT_TYPE_SPEECH */
ma_aaudio_content_type_music, /* AAUDIO_CONTENT_TYPE_MUSIC */ ma_aaudio_content_type_music, /* AAUDIO_CONTENT_TYPE_MUSIC */
ma_aaudio_content_type_sonification, /* AAUDIO_CONTENT_TYPE_SONIFICATION */ ma_aaudio_content_type_movie, /* AAUDIO_CONTENT_TYPE_MOVIE */
ma_aaudio_content_type_speech /* AAUDIO_CONTENT_TYPE_SPEECH */ ma_aaudio_content_type_sonification /* AAUDIO_CONTENT_TYPE_SONIFICATION */
} ma_aaudio_content_type; } ma_aaudio_content_type;
/* AAudio input presets. */ /* AAudio input presets. */
...@@ -2875,9 +2907,9 @@ typedef enum ...@@ -2875,9 +2907,9 @@ typedef enum
ma_aaudio_input_preset_default = 0, /* Leaves the input preset unset. */ ma_aaudio_input_preset_default = 0, /* Leaves the input preset unset. */
ma_aaudio_input_preset_generic, /* AAUDIO_INPUT_PRESET_GENERIC */ ma_aaudio_input_preset_generic, /* AAUDIO_INPUT_PRESET_GENERIC */
ma_aaudio_input_preset_camcorder, /* AAUDIO_INPUT_PRESET_CAMCORDER */ ma_aaudio_input_preset_camcorder, /* AAUDIO_INPUT_PRESET_CAMCORDER */
ma_aaudio_input_preset_unprocessed, /* AAUDIO_INPUT_PRESET_UNPROCESSED */
ma_aaudio_input_preset_voice_recognition, /* AAUDIO_INPUT_PRESET_VOICE_RECOGNITION */ ma_aaudio_input_preset_voice_recognition, /* AAUDIO_INPUT_PRESET_VOICE_RECOGNITION */
ma_aaudio_input_preset_voice_communication, /* AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION */ ma_aaudio_input_preset_voice_communication, /* AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION */
ma_aaudio_input_preset_unprocessed, /* AAUDIO_INPUT_PRESET_UNPROCESSED */
ma_aaudio_input_preset_voice_performance /* AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE */ ma_aaudio_input_preset_voice_performance /* AAUDIO_INPUT_PRESET_VOICE_PERFORMANCE */
} ma_aaudio_input_preset; } ma_aaudio_input_preset;
...@@ -2964,6 +2996,7 @@ struct ma_device_config ...@@ -2964,6 +2996,7 @@ struct ma_device_config
ma_uint32 channels; ma_uint32 channels;
ma_channel* pChannelMap; ma_channel* pChannelMap;
ma_channel_mix_mode channelMixMode; ma_channel_mix_mode channelMixMode;
ma_bool32 calculateLFEFromSpatialChannels; /* When an output LFE channel is present, but no input LFE, set to true to set the output LFE to the average of all spatial channels (LR, FR, etc.). Ignored when an input LFE is present. */
ma_share_mode shareMode; ma_share_mode shareMode;
} playback; } playback;
struct struct
...@@ -2973,15 +3006,19 @@ struct ma_device_config ...@@ -2973,15 +3006,19 @@ struct ma_device_config
ma_uint32 channels; ma_uint32 channels;
ma_channel* pChannelMap; ma_channel* pChannelMap;
ma_channel_mix_mode channelMixMode; ma_channel_mix_mode channelMixMode;
ma_bool32 calculateLFEFromSpatialChannels; /* When an output LFE channel is present, but no input LFE, set to true to set the output LFE to the average of all spatial channels (LR, FR, etc.). Ignored when an input LFE is present. */
ma_share_mode shareMode; ma_share_mode shareMode;
} capture; } capture;
struct struct
{ {
ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */ ma_wasapi_usage usage; /* When configured, uses Avrt APIs to set the thread characteristics. */
ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */ ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
ma_bool8 noAutoStreamRouting; /* Disables automatic stream routing. */ ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
ma_bool8 noHardwareOffloading; /* Disables WASAPI's hardware offloading feature. */ ma_bool8 noAutoStreamRouting; /* Disables automatic stream routing. */
ma_bool8 noHardwareOffloading; /* Disables WASAPI's hardware offloading feature. */
ma_uint32 loopbackProcessID; /* The process ID to include or exclude for loopback mode. Set to 0 to capture audio from all processes. Ignored when an explicit device ID is specified. */
ma_bool8 loopbackProcessExclude; /* When set to true, excludes the process specified by loopbackProcessID. By default, the process will be included. */
} wasapi; } wasapi;
struct struct
{ {
...@@ -3094,7 +3131,7 @@ sample rate. For the channel map, the default should be used when `ma_channel_ma ...@@ -3094,7 +3131,7 @@ sample rate. For the channel map, the default should be used when `ma_channel_ma
`MA_CHANNEL_NONE`). On input, the `periodSizeInFrames` or `periodSizeInMilliseconds` option should always be set. The backend should `MA_CHANNEL_NONE`). On input, the `periodSizeInFrames` or `periodSizeInMilliseconds` option should always be set. The backend should
inspect both of these variables. If `periodSizeInFrames` is set, it should take priority, otherwise it needs to be derived from the period inspect both of these variables. If `periodSizeInFrames` is set, it should take priority, otherwise it needs to be derived from the period
size in milliseconds (`periodSizeInMilliseconds`) and the sample rate, keeping in mind that the sample rate may be 0, in which case the size in milliseconds (`periodSizeInMilliseconds`) and the sample rate, keeping in mind that the sample rate may be 0, in which case the
sample rate will need to be determined before calculating the period size in frames. On output, all members of the `ma_device_data_format` sample rate will need to be determined before calculating the period size in frames. On output, all members of the `ma_device_descriptor`
object should be set to a valid value, except for `periodSizeInMilliseconds` which is optional (`periodSizeInFrames` *must* be set). object should be set to a valid value, except for `periodSizeInMilliseconds` which is optional (`periodSizeInFrames` *must* be set).
Starting and stopping of the device is done with `onDeviceStart()` and `onDeviceStop()` and should be self-explanatory. If the backend uses Starting and stopping of the device is done with `onDeviceStart()` and `onDeviceStop()` and should be self-explanatory. If the backend uses
...@@ -3224,6 +3261,11 @@ struct ma_context ...@@ -3224,6 +3261,11 @@ struct ma_context
ma_uint32 commandIndex; ma_uint32 commandIndex;
ma_uint32 commandCount; ma_uint32 commandCount;
ma_context_command__wasapi commands[4]; ma_context_command__wasapi commands[4];
ma_handle hAvrt;
ma_proc AvSetMmThreadCharacteristicsW;
ma_proc AvRevertMmThreadcharacteristics;
ma_handle hMMDevapi;
ma_proc ActivateAudioInterfaceAsync;
} wasapi; } wasapi;
#endif #endif
#ifdef MA_SUPPORT_DSOUND #ifdef MA_SUPPORT_DSOUND
...@@ -3658,6 +3700,7 @@ struct ma_device ...@@ -3658,6 +3700,7 @@ struct ma_device
ma_uint32 internalPeriodSizeInFrames; ma_uint32 internalPeriodSizeInFrames;
ma_uint32 internalPeriods; ma_uint32 internalPeriods;
ma_channel_mix_mode channelMixMode; ma_channel_mix_mode channelMixMode;
ma_bool32 calculateLFEFromSpatialChannels;
ma_data_converter converter; ma_data_converter converter;
void* pIntermediaryBuffer; /* For implementing fixed sized buffer callbacks. Will be null if using variable sized callbacks. */ void* pIntermediaryBuffer; /* For implementing fixed sized buffer callbacks. Will be null if using variable sized callbacks. */
ma_uint32 intermediaryBufferCap; ma_uint32 intermediaryBufferCap;
...@@ -3683,6 +3726,7 @@ struct ma_device ...@@ -3683,6 +3726,7 @@ struct ma_device
ma_uint32 internalPeriodSizeInFrames; ma_uint32 internalPeriodSizeInFrames;
ma_uint32 internalPeriods; ma_uint32 internalPeriods;
ma_channel_mix_mode channelMixMode; ma_channel_mix_mode channelMixMode;
ma_bool32 calculateLFEFromSpatialChannels;
ma_data_converter converter; ma_data_converter converter;
void* pIntermediaryBuffer; /* For implementing fixed sized buffer callbacks. Will be null if using variable sized callbacks. */ void* pIntermediaryBuffer; /* For implementing fixed sized buffer callbacks. Will be null if using variable sized callbacks. */
ma_uint32 intermediaryBufferCap; ma_uint32 intermediaryBufferCap;
...@@ -3718,6 +3762,8 @@ struct ma_device ...@@ -3718,6 +3762,8 @@ struct ma_device
ma_uint32 mappedBufferPlaybackLen; ma_uint32 mappedBufferPlaybackLen;
MA_ATOMIC(4, ma_bool32) isStartedCapture; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */ MA_ATOMIC(4, ma_bool32) isStartedCapture; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */
MA_ATOMIC(4, ma_bool32) isStartedPlayback; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */ MA_ATOMIC(4, ma_bool32) isStartedPlayback; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */
ma_uint32 loopbackProcessID;
ma_bool8 loopbackProcessExclude;
ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */ ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */ ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
ma_bool8 noHardwareOffloading; ma_bool8 noHardwareOffloading;
...@@ -3725,6 +3771,8 @@ struct ma_device ...@@ -3725,6 +3771,8 @@ struct ma_device
ma_bool8 allowPlaybackAutoStreamRouting; ma_bool8 allowPlaybackAutoStreamRouting;
ma_bool8 isDetachedPlayback; ma_bool8 isDetachedPlayback;
ma_bool8 isDetachedCapture; ma_bool8 isDetachedCapture;
ma_wasapi_usage usage;
void *hAvrtHandle;
} wasapi; } wasapi;
#endif #endif
#ifdef MA_SUPPORT_DSOUND #ifdef MA_SUPPORT_DSOUND
...@@ -4526,9 +4574,9 @@ then be set directly on the structure. Below are the members of the `ma_device_c ...@@ -4526,9 +4574,9 @@ then be set directly on the structure. Below are the members of the `ma_device_c
By default, miniaudio will disable denormals when the data callback is called. Setting this to true will prevent the disabling of denormals. By default, miniaudio will disable denormals when the data callback is called. Setting this to true will prevent the disabling of denormals.
noFixedSizedCallback noFixedSizedCallback
Allows miniaudio to fire the data callback with any frame count. When this is set to true, the data callback will be fired with a consistent frame Allows miniaudio to fire the data callback with any frame count. When this is set to false (the default), the data callback will be fired with a
count as specified by `periodSizeInFrames` or `periodSizeInMilliseconds`. When set to false, miniaudio will fire the callback with whatever the consistent frame count as specified by `periodSizeInFrames` or `periodSizeInMilliseconds`. When set to true, miniaudio will fire the callback with
backend requests, which could be anything. whatever the backend requests, which could be anything.
dataCallback dataCallback
The callback to fire whenever data is ready to be delivered to or from the device. The callback to fire whenever data is ready to be delivered to or from the device.
...@@ -6821,6 +6869,7 @@ typedef struct ...@@ -6821,6 +6869,7 @@ typedef struct
{ {
ma_node_config nodeConfig; ma_node_config nodeConfig;
ma_uint32 channels; ma_uint32 channels;
ma_uint32 outputBusCount;
} ma_splitter_node_config; } ma_splitter_node_config;
MA_API ma_splitter_node_config ma_splitter_node_config_init(ma_uint32 channels); MA_API ma_splitter_node_config ma_splitter_node_config_init(ma_uint32 channels);
...@@ -7045,6 +7094,7 @@ MA_API float ma_delay_node_get_decay(const ma_delay_node* pDelayNode); ...@@ -7045,6 +7094,7 @@ MA_API float ma_delay_node_get_decay(const ma_delay_node* pDelayNode);
#endif /* MA_NO_NODE_GRAPH */ #endif /* MA_NO_NODE_GRAPH */
/* SECTION: miniaudio_engine.h */
/************************************************************************************************************************************************************ /************************************************************************************************************************************************************
Engine Engine
...@@ -7086,6 +7136,7 @@ typedef struct ...@@ -7086,6 +7136,7 @@ typedef struct
ma_uint32 channelsIn; ma_uint32 channelsIn;
ma_uint32 channelsOut; ma_uint32 channelsOut;
ma_uint32 sampleRate; /* Only used when the type is set to ma_engine_node_type_sound. */ ma_uint32 sampleRate; /* Only used when the type is set to ma_engine_node_type_sound. */
ma_mono_expansion_mode monoExpansionMode;
ma_bool8 isPitchDisabled; /* Pitching can be explicitly disable with MA_SOUND_FLAG_NO_PITCH to optimize processing. */ ma_bool8 isPitchDisabled; /* Pitching can be explicitly disable with MA_SOUND_FLAG_NO_PITCH to optimize processing. */
ma_bool8 isSpatializationDisabled; /* Spatialization can be explicitly disabled with MA_SOUND_FLAG_NO_SPATIALIZATION. */ ma_bool8 isSpatializationDisabled; /* Spatialization can be explicitly disabled with MA_SOUND_FLAG_NO_SPATIALIZATION. */
ma_uint8 pinnedListenerIndex; /* The index of the listener this node should always use for spatialization. If set to MA_LISTENER_INDEX_CLOSEST the engine will use the closest listener. */ ma_uint8 pinnedListenerIndex; /* The index of the listener this node should always use for spatialization. If set to MA_LISTENER_INDEX_CLOSEST the engine will use the closest listener. */
...@@ -7100,6 +7151,7 @@ typedef struct ...@@ -7100,6 +7151,7 @@ typedef struct
ma_node_base baseNode; /* Must be the first member for compatiblity with the ma_node API. */ ma_node_base baseNode; /* Must be the first member for compatiblity with the ma_node API. */
ma_engine* pEngine; /* A pointer to the engine. Set based on the value from the config. */ ma_engine* pEngine; /* A pointer to the engine. Set based on the value from the config. */
ma_uint32 sampleRate; /* The sample rate of the input data. For sounds backed by a data source, this will be the data source's sample rate. Otherwise it'll be the engine's sample rate. */ ma_uint32 sampleRate; /* The sample rate of the input data. For sounds backed by a data source, this will be the data source's sample rate. Otherwise it'll be the engine's sample rate. */
ma_mono_expansion_mode monoExpansionMode;
ma_fader fader; ma_fader fader;
ma_linear_resampler resampler; /* For pitch shift. */ ma_linear_resampler resampler; /* For pitch shift. */
ma_spatializer spatializer; ma_spatializer spatializer;
...@@ -7133,6 +7185,7 @@ typedef struct ...@@ -7133,6 +7185,7 @@ typedef struct
ma_uint32 initialAttachmentInputBusIndex; /* The index of the input bus of pInitialAttachment to attach the sound to. */ ma_uint32 initialAttachmentInputBusIndex; /* The index of the input bus of pInitialAttachment to attach the sound to. */
ma_uint32 channelsIn; /* Ignored if using a data source as input (the data source's channel count will be used always). Otherwise, setting to 0 will cause the engine's channel count to be used. */ ma_uint32 channelsIn; /* Ignored if using a data source as input (the data source's channel count will be used always). Otherwise, setting to 0 will cause the engine's channel count to be used. */
ma_uint32 channelsOut; /* Set this to 0 (default) to use the engine's channel count. Set to MA_SOUND_SOURCE_CHANNEL_COUNT to use the data source's channel count (only used if using a data source as input). */ ma_uint32 channelsOut; /* Set this to 0 (default) to use the engine's channel count. Set to MA_SOUND_SOURCE_CHANNEL_COUNT to use the data source's channel count (only used if using a data source as input). */
ma_mono_expansion_mode monoExpansionMode; /* Controls how the mono channel should be expanded to other channels when spatialization is disabled on a sound. */
ma_uint32 flags; /* A combination of MA_SOUND_FLAG_* flags. */ ma_uint32 flags; /* A combination of MA_SOUND_FLAG_* flags. */
ma_uint64 initialSeekPointInPCMFrames; /* Initializes the sound such that it's seeked to this location by default. */ ma_uint64 initialSeekPointInPCMFrames; /* Initializes the sound such that it's seeked to this location by default. */
ma_uint64 rangeBegInPCMFrames; ma_uint64 rangeBegInPCMFrames;
...@@ -7143,7 +7196,8 @@ typedef struct ...@@ -7143,7 +7196,8 @@ typedef struct
ma_fence* pDoneFence; /* Released when the resource manager has finished decoding the entire sound. Not used with streams. */ ma_fence* pDoneFence; /* Released when the resource manager has finished decoding the entire sound. Not used with streams. */
} ma_sound_config; } ma_sound_config;
MA_API ma_sound_config ma_sound_config_init(void); MA_API ma_sound_config ma_sound_config_init(void); /* Deprecated. Will be removed in version 0.12. Use ma_sound_config_2() instead. */
MA_API ma_sound_config ma_sound_config_init_2(ma_engine* pEngine); /* Will be renamed to ma_sound_config_init() in version 0.12. */
struct ma_sound struct ma_sound
{ {
...@@ -7175,8 +7229,8 @@ struct ma_sound_inlined ...@@ -7175,8 +7229,8 @@ struct ma_sound_inlined
typedef ma_sound_config ma_sound_group_config; typedef ma_sound_config ma_sound_group_config;
typedef ma_sound ma_sound_group; typedef ma_sound ma_sound_group;
MA_API ma_sound_group_config ma_sound_group_config_init(void); MA_API ma_sound_group_config ma_sound_group_config_init(void); /* Deprecated. Will be removed in version 0.12. Use ma_sound_config_2() instead. */
MA_API ma_sound_group_config ma_sound_group_config_init_2(ma_engine* pEngine); /* Will be renamed to ma_sound_config_init() in version 0.12. */
typedef struct typedef struct
{ {
...@@ -7187,6 +7241,7 @@ typedef struct ...@@ -7187,6 +7241,7 @@ typedef struct
ma_context* pContext; ma_context* pContext;
ma_device* pDevice; /* If set, the caller is responsible for calling ma_engine_data_callback() in the device's data callback. */ ma_device* pDevice; /* If set, the caller is responsible for calling ma_engine_data_callback() in the device's data callback. */
ma_device_id* pPlaybackDeviceID; /* The ID of the playback device to use with the default listener. */ ma_device_id* pPlaybackDeviceID; /* The ID of the playback device to use with the default listener. */
ma_device_notification_proc notificationCallback;
#endif #endif
ma_log* pLog; /* When set to NULL, will use the context's log. */ ma_log* pLog; /* When set to NULL, will use the context's log. */
ma_uint32 listenerCount; /* Must be between 1 and MA_ENGINE_MAX_LISTENERS. */ ma_uint32 listenerCount; /* Must be between 1 and MA_ENGINE_MAX_LISTENERS. */
...@@ -7396,6 +7451,7 @@ MA_API void ma_sound_group_set_stop_time_in_milliseconds(ma_sound_group* pGroup, ...@@ -7396,6 +7451,7 @@ MA_API void ma_sound_group_set_stop_time_in_milliseconds(ma_sound_group* pGroup,
MA_API ma_bool32 ma_sound_group_is_playing(const ma_sound_group* pGroup); MA_API ma_bool32 ma_sound_group_is_playing(const ma_sound_group* pGroup);
MA_API ma_uint64 ma_sound_group_get_time_in_pcm_frames(const ma_sound_group* pGroup); MA_API ma_uint64 ma_sound_group_get_time_in_pcm_frames(const ma_sound_group* pGroup);
#endif /* MA_NO_ENGINE */ #endif /* MA_NO_ENGINE */
/* END SECTION: miniaudio_engine.h */
#ifdef __cplusplus #ifdef __cplusplus
} }
......
/* /*
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file. Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
miniaudio - v0.11.10 - TBD miniaudio - v0.11.10 - 2022-10-20
David Reid - mackron@gmail.com David Reid - mackron@gmail.com
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