* 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.
ma_uint32cursor;/* Feedback is written to this cursor. Always equal or in front of the read cursor. */
ma_uint32cursor;/* Feedback is written to this cursor. Always equal or in front of the read cursor. */
ma_uint32bufferSizeInFrames;/* The maximum of config.startDelayInFrames and config.feedbackDelayInFrames. */
ma_uint32bufferSizeInFrames;
float*pBuffer;
float*pBuffer;
}ma_delay;
}ma_delay;
...
@@ -1644,6 +1644,7 @@ typedef struct
...
@@ -1644,6 +1644,7 @@ typedef struct
constma_channel*pChannelMapIn;
constma_channel*pChannelMapIn;
constma_channel*pChannelMapOut;
constma_channel*pChannelMapOut;
ma_channel_mix_modemixingMode;
ma_channel_mix_modemixingMode;
ma_bool32calculateLFEFromSpatialChannels;/* 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_modeditherMode;
ma_dither_modeditherMode;
ma_channel_mix_modechannelMixMode;
ma_channel_mix_modechannelMixMode;
ma_bool32calculateLFEFromSpatialChannels;/* 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_bool32allowDynamicSampleRate;
ma_bool32allowDynamicSampleRate;
ma_resampler_configresampling;
ma_resampler_configresampling;
...
@@ -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_bool32calculateLFEFromSpatialChannels;/* 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_modeshareMode;
ma_share_modeshareMode;
}playback;
}playback;
struct
struct
...
@@ -2973,15 +3006,19 @@ struct ma_device_config
...
@@ -2973,15 +3006,19 @@ struct ma_device_config
ma_uint32channels;
ma_uint32channels;
ma_channel*pChannelMap;
ma_channel*pChannelMap;
ma_channel_mix_modechannelMixMode;
ma_channel_mix_modechannelMixMode;
ma_bool32calculateLFEFromSpatialChannels;/* 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_modeshareMode;
ma_share_modeshareMode;
}capture;
}capture;
struct
struct
{
{
ma_bool8noAutoConvertSRC;/* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
ma_wasapi_usageusage;/* When configured, uses Avrt APIs to set the thread characteristics. */
ma_bool8noDefaultQualitySRC;/* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
ma_bool8noAutoConvertSRC;/* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
ma_uint32loopbackProcessID;/* 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_bool8loopbackProcessExclude;/* 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_uint32commandIndex;
ma_uint32commandIndex;
ma_uint32commandCount;
ma_uint32commandCount;
ma_context_command__wasapicommands[4];
ma_context_command__wasapicommands[4];
ma_handlehAvrt;
ma_procAvSetMmThreadCharacteristicsW;
ma_procAvRevertMmThreadcharacteristics;
ma_handlehMMDevapi;
ma_procActivateAudioInterfaceAsync;
}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_uint32internalPeriodSizeInFrames;
ma_uint32internalPeriodSizeInFrames;
ma_uint32internalPeriods;
ma_uint32internalPeriods;
ma_channel_mix_modechannelMixMode;
ma_channel_mix_modechannelMixMode;
ma_bool32calculateLFEFromSpatialChannels;
ma_data_converterconverter;
ma_data_converterconverter;
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_uint32intermediaryBufferCap;
ma_uint32intermediaryBufferCap;
...
@@ -3683,6 +3726,7 @@ struct ma_device
...
@@ -3683,6 +3726,7 @@ struct ma_device
ma_uint32internalPeriodSizeInFrames;
ma_uint32internalPeriodSizeInFrames;
ma_uint32internalPeriods;
ma_uint32internalPeriods;
ma_channel_mix_modechannelMixMode;
ma_channel_mix_modechannelMixMode;
ma_bool32calculateLFEFromSpatialChannels;
ma_data_converterconverter;
ma_data_converterconverter;
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_uint32intermediaryBufferCap;
ma_uint32intermediaryBufferCap;
...
@@ -3718,6 +3762,8 @@ struct ma_device
...
@@ -3718,6 +3762,8 @@ struct ma_device
ma_uint32mappedBufferPlaybackLen;
ma_uint32mappedBufferPlaybackLen;
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_uint32loopbackProcessID;
ma_bool8loopbackProcessExclude;
ma_bool8noAutoConvertSRC;/* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
ma_bool8noAutoConvertSRC;/* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
ma_bool8noDefaultQualitySRC;/* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
ma_bool8noDefaultQualitySRC;/* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
ma_bool8noHardwareOffloading;
ma_bool8noHardwareOffloading;
...
@@ -3725,6 +3771,8 @@ struct ma_device
...
@@ -3725,6 +3771,8 @@ struct ma_device
ma_bool8allowPlaybackAutoStreamRouting;
ma_bool8allowPlaybackAutoStreamRouting;
ma_bool8isDetachedPlayback;
ma_bool8isDetachedPlayback;
ma_bool8isDetachedCapture;
ma_bool8isDetachedCapture;
ma_wasapi_usageusage;
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.
ma_uint32sampleRate;/* Only used when the type is set to ma_engine_node_type_sound. */
ma_uint32sampleRate;/* Only used when the type is set to ma_engine_node_type_sound. */
ma_mono_expansion_modemonoExpansionMode;
ma_bool8isPitchDisabled;/* Pitching can be explicitly disable with MA_SOUND_FLAG_NO_PITCH to optimize processing. */
ma_bool8isPitchDisabled;/* Pitching can be explicitly disable with MA_SOUND_FLAG_NO_PITCH to optimize processing. */
ma_bool8isSpatializationDisabled;/* Spatialization can be explicitly disabled with MA_SOUND_FLAG_NO_SPATIALIZATION. */
ma_bool8isSpatializationDisabled;/* Spatialization can be explicitly disabled with MA_SOUND_FLAG_NO_SPATIALIZATION. */
ma_uint8pinnedListenerIndex;/* 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_uint8pinnedListenerIndex;/* 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_basebaseNode;/* Must be the first member for compatiblity with the ma_node API. */
ma_node_basebaseNode;/* 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_uint32sampleRate;/* 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_uint32sampleRate;/* 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_modemonoExpansionMode;
ma_faderfader;
ma_faderfader;
ma_linear_resamplerresampler;/* For pitch shift. */
ma_linear_resamplerresampler;/* For pitch shift. */
ma_spatializerspatializer;
ma_spatializerspatializer;
...
@@ -7133,6 +7185,7 @@ typedef struct
...
@@ -7133,6 +7185,7 @@ typedef struct
ma_uint32initialAttachmentInputBusIndex;/* The index of the input bus of pInitialAttachment to attach the sound to. */
ma_uint32initialAttachmentInputBusIndex;/* The index of the input bus of pInitialAttachment to attach the sound to. */
ma_uint32channelsIn;/* 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_uint32channelsIn;/* 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_uint32channelsOut;/* 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_uint32channelsOut;/* 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_modemonoExpansionMode;/* Controls how the mono channel should be expanded to other channels when spatialization is disabled on a sound. */
ma_uint32flags;/* A combination of MA_SOUND_FLAG_* flags. */
ma_uint32flags;/* A combination of MA_SOUND_FLAG_* flags. */
ma_uint64initialSeekPointInPCMFrames;/* Initializes the sound such that it's seeked to this location by default. */
ma_uint64initialSeekPointInPCMFrames;/* Initializes the sound such that it's seeked to this location by default. */
ma_uint64rangeBegInPCMFrames;
ma_uint64rangeBegInPCMFrames;
...
@@ -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_APIma_sound_configma_sound_config_init(void);
MA_APIma_sound_configma_sound_config_init(void);/* Deprecated. Will be removed in version 0.12. Use ma_sound_config_2() instead. */
MA_APIma_sound_configma_sound_config_init_2(ma_engine*pEngine);/* Will be renamed to ma_sound_config_init() in version 0.12. */