@@ -13973,9 +13977,9 @@ static ma_thread_result MA_THREADCALL ma_context_command_thread__wasapi(void* pU
case MA_CONTEXT_COMMAND_CREATE_IAUDIOCLIENT__WASAPI:
{
if (cmd.data.createAudioClient.deviceType == ma_device_type_playback) {
result = ma_result_from_HRESULT(ma_IAudioClient_GetService((ma_IAudioClient*)cmd.data.createAudioClient.pAudioClient, &MA_IID_IAudioRenderClient, cmd.data.createAudioClient.ppAudioClientService));
result = ma_result_from_HRESULT(ma_IAudioClient_GetService((ma_IAudioClient*)cmd.data.createAudioClient.pAudioClient, &MA_IID_IAudioCaptureClient, cmd.data.createAudioClient.ppAudioClientService));
cmd.data.createAudioClient.pResult = &cmdResult; /* Declared locally, but won't be dereferenced after this function returns since execution of the command will wait here. */
result = ma_context_post_command__wasapi(pContext, &cmd); /* This will not return until the command has actually been run. */
if (result != MA_SUCCESS) {
return result;
}
return cmd.data.createAudioClient.result;
return *cmd.data.createAudioClient.pResult;
}
#if 0 /* Not used at the moment, but leaving here for future use. */
...
...
@@ -64571,6 +64576,10 @@ The following miscellaneous changes have also been made.
/*
REVISION HISTORY
================
v0.10.34 - TBD
- WASAPI: Fix a bug where a result code is not getting checked at initialization time.
- Mark devices as default on the null backend.
v0.10.33 - 2021-04-04
- Core Audio: Fix a memory leak.
- Core Audio: Fix a bug where the performance profile is not being used by playback devices.
ma_async_notification*pInitNotification;/* Signalled when the data buffer has been initialized, but not necessarily fully decoded. */
ma_async_notification*pCompletedNotification;/* Signalled when the data buffer has been fully decoded. */
void*pData;
size_tdataSizeInBytes;
...
...
@@ -1413,9 +1440,8 @@ Within the world there is the concept of a "listener". Each `ma_engine` instance
if you need more than one listener. In this case you will want to share a resource manager which you can do by initializing one manually and passing it into
`ma_engine_config`. Using this method will require your application to manage groups and sounds on a per `ma_engine` basis.
*/
typedefstructma_enginema_engine;
typedefstructma_soundma_sound;
typedefstructma_sound_groupma_sound_group;
typedefstructma_enginema_engine;
typedefstructma_soundma_sound;
/* Stereo panner. */
...
...
@@ -1553,7 +1579,7 @@ typedef struct
ma_channelchannelMapIn[MA_MAX_CHANNELS];
ma_attenuation_modelattenuationModel;
ma_positioningpositioning;
ma_handednesshandedness;/* Defaults to right. Forward is -1 on the Z axis. In a left handed system, forward is +1 on the Z axis. */
ma_handednesshandedness;/* Defaults to right. Forward is -1 on the Z axis. In a left handed system, forward is +1 on the Z axis. */
floatminGain;
floatmaxGain;
floatminDistance;
...
...
@@ -1562,7 +1588,8 @@ typedef struct
floatconeInnerAngleInRadians;
floatconeOuterAngleInRadians;
floatconeOuterGain;
floatdopplerFactor;/* Set to 0 to disable doppler effect. This will run on a fast path. */
floatdopplerFactor;/* Set to 0 to disable doppler effect. This will run on a fast path. */
ma_uint32gainSmoothTimeInFrames;/* When the gain of a channel changes during spatialization, the transition will be linearly interpolated over this number of frames. */
floatdopplerPitch;/* Will be updated by ma_spatializer_process_pcm_frames() and can be used by higher level functions to apply a pitch shift for doppler effect. */
ma_gainergainer;/* For smooth gain transitions. */
/* Base node object for both ma_sound and ma_sound_group. */
typedefstruct
{
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_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_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_faderfader;
ma_resamplerresampler;/* For pitch shift. May change this to ma_linear_resampler later. */
ma_resamplerresampler;/* For pitch shift. May change this to ma_linear_resampler later. */
ma_spatializerspatializer;
ma_pannerpanner;
MA_ATOMICfloatpitch;
floatoldPitch;/* For determining whether or not the resampler needs to be updated to reflect the new pitch. The resampler will be updated on the mixing thread. */
floatoldDopplerPitch;/* For determining whether or not the resampler needs to be updated to take a new doppler pitch into account. */
MA_ATOMICma_bool8isPitchDisabled;/* When set to true, pitching will be disabled which will allow the resampler to be bypassed to save some computation. */
MA_ATOMICma_bool8isSpatializationDisabled;/* Set to false by default. When set to false, will not have spatialisation applied. */
MA_ATOMICma_uint8pinnedListenerIndex;/* The index of the listener this node should always use for spatialization. If set to (ma_uint8)-1 the engine will use the closest listener. */
floatoldPitch;/* For determining whether or not the resampler needs to be updated to reflect the new pitch. The resampler will be updated on the mixing thread. */
floatoldDopplerPitch;/* For determining whether or not the resampler needs to be updated to take a new doppler pitch into account. */
MA_ATOMICma_bool8isPitchDisabled;/* When set to true, pitching will be disabled which will allow the resampler to be bypassed to save some computation. */
MA_ATOMICma_bool8isSpatializationDisabled;/* Set to false by default. When set to false, will not have spatialisation applied. */
MA_ATOMICma_uint8pinnedListenerIndex;/* The index of the listener this node should always use for spatialization. If set to (ma_uint8)-1 the engine will use the closest listener. */
constchar*pFilePath;/* Set this to load from the resource manager. */
constwchar_t*pFilePathW;/* Set this to load from the resource manager. */
ma_data_source*pDataSource;/* Set this to load from an existing data source. */
ma_node*pInitialAttachment;/* If set, the sound will be attached to an input of this node. This can be set to a ma_sound. If set to NULL, the sound will be attached directly to the endpoint unless MA_SOUND_FLAG_NO_DEFAULT_ATTACHMENT is set in `flags`. */
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_uint32channelsOut;/* Set this to 0 (default) to use the engine's channel count. */
ma_uint32flags;/* A combination of MA_SOUND_FLAG_* flags. */
}ma_sound_config;
MA_APIma_sound_configma_sound_config_init(void);
structma_sound
{
ma_engine_nodeengineNode;/* Must be the first member for compatibility with the ma_node API. */
...
...
@@ -1677,7 +1721,7 @@ struct ma_sound
sound via the resource manager, which I *think* will be the most common scenario.
ma_uint32sampleRate;/* The sample rate. When set to 0 will use the native channel count of the device. */
ma_uint32periodSizeInFrames;/* If set to something other than 0, updates will always be exactly this size. The underlying device may be a different size, but from the perspective of the mixer that won't matter.*/
ma_uint32periodSizeInMilliseconds;/* Used if periodSizeInFrames is unset. */
ma_uint32gainSmoothTimeInFrames;/* The number of frames to interpolate the gain of spatialized sounds across. If set to 0, will use gainSmoothTimeInMilliseconds. */
ma_uint32gainSmoothTimeInMilliseconds;/* When set to 0, gainSmoothTimeInFrames will be used. If both are set to 0, a default value will be used. */
ma_device_id*pPlaybackDeviceID;/* The ID of the playback device to use with the default listener. */
ma_allocation_callbacksallocationCallbacks;
ma_bool32noAutoStart;/* When set to true, requires an explicit call to ma_engine_start(). This is false by default, meaning the engine will be started automatically in ma_engine_init(). */
...
...
@@ -1728,6 +1775,7 @@ struct ma_engine
ma_mutexinlinedSoundLock;/* For synchronizing access so the inlined sound list. */
ma_sound_inlined*pInlinedSoundHead;/* The first inlined sound. Inlined sounds are tracked in a linked list. */
MA_ATOMICma_uint32inlinedSoundCount;/* The total number of allocated inlined sound objects. Used for debugging. */
ma_uint32gainSmoothTimeInFrames;/* The number of frames to interpolate the gain of spatialized sounds across. */
pageDataBufferJob.pageDataBuffer.pInitNotification=NULL;/* <-- Clear this notification to NULL to ensure it's not signalled a second time at the end of decoding, which will be done for sounds of unknown length. */
pageDataBufferJob.pageDataBuffer.pInitNotification=pJob->loadDataBuffer.pInitNotification;/* <-- Set this to the init notification so that the PAGE_DATA_BUFFER job can signal it at the end of decoding. Only needed for sounds of unknown length. */
/*
These members are all set after the last page has been decoded. The reason for this is that the application should not be attempting to
/* If it was an unknown length, we can finally initialize the connector. For sounds of a known length, the connector was initialized when the first page was decoded in MA_JOB_LOAD_DATA_BUFFER. */
/* We need to set the status of the page so other things can know about it. We can only change the status away from MA_BUSY. If it's anything else it cannot be changed. */
...
...
@@ -9159,10 +9365,11 @@ MA_API ma_spatializer_config ma_spatializer_config_init(ma_uint32 channelsIn, ma
resamplerConfig.linear.lpfOrder=0;/* <-- Need to disable low-pass filtering for pitch shifting for now because there's cases where the biquads are becoming unstable. Need to figure out a better fix for this. */
/* A group is specified. Attach to it by default. The sound has only a single output bus, and the group has a single input bus which makes attachment trivial. */
/* An attachment is specified. Attach to it by default. The sound has only a single output bus, and the config will specify which input bus to attach to. */
/* Once the sound is detached from the group we can guarantee that it won't be referenced by the mixer thread which means it's safe for us to destroy the data source. */