mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
WASAPI: Remove some unnecessary variables.
This commit is contained in:
+1
-15
@@ -22147,8 +22147,6 @@ typedef struct ma_device_state_wasapi
|
||||
ma_uint32 originalPeriods;
|
||||
ma_uint32 periodSizeInFramesPlayback;
|
||||
ma_uint32 periodSizeInFramesCapture;
|
||||
ma_atomic_bool32 isStartedCapture; /* Can be read and written simultaneously across different threads. Must be used atomically, and must be 32-bit. */
|
||||
ma_atomic_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. */
|
||||
@@ -24525,9 +24523,6 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const void* pDeviceB
|
||||
}
|
||||
#endif
|
||||
|
||||
ma_atomic_bool32_set(&pDeviceStateWASAPI->isStartedCapture, MA_FALSE);
|
||||
ma_atomic_bool32_set(&pDeviceStateWASAPI->isStartedPlayback, MA_FALSE);
|
||||
|
||||
*ppDeviceState = pDeviceStateWASAPI;
|
||||
|
||||
return MA_SUCCESS;
|
||||
@@ -24675,8 +24670,6 @@ static ma_result ma_device_start__wasapi_nolock(ma_device* pDevice)
|
||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to start internal capture device. HRESULT = %d.", (int)hr);
|
||||
return ma_result_from_HRESULT(hr);
|
||||
}
|
||||
|
||||
ma_atomic_bool32_set(&pDeviceStateWASAPI->isStartedCapture, MA_TRUE);
|
||||
}
|
||||
|
||||
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
|
||||
@@ -24685,8 +24678,6 @@ static ma_result ma_device_start__wasapi_nolock(ma_device* pDevice)
|
||||
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to start internal playback device. HRESULT = %d.", (int)hr);
|
||||
return ma_result_from_HRESULT(hr);
|
||||
}
|
||||
|
||||
ma_atomic_bool32_set(&pDeviceStateWASAPI->isStartedPlayback, MA_TRUE);
|
||||
}
|
||||
|
||||
return MA_SUCCESS;
|
||||
@@ -24736,8 +24727,6 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice)
|
||||
ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to reset internal capture device.");
|
||||
return ma_result_from_HRESULT(hr);
|
||||
}
|
||||
|
||||
ma_atomic_bool32_set(&pDeviceStateWASAPI->isStartedCapture, MA_FALSE);
|
||||
}
|
||||
|
||||
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
|
||||
@@ -24745,7 +24734,7 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice)
|
||||
The buffer needs to be drained before stopping the device. Not doing this will result in the last few frames not getting output to
|
||||
the speakers. This is a problem for very short sounds because it'll result in a significant portion of it not getting played.
|
||||
*/
|
||||
if (ma_atomic_bool32_get(&pDeviceStateWASAPI->isStartedPlayback)) {
|
||||
|
||||
/* We need to make sure we put a timeout here or else we'll risk getting stuck in a deadlock in some cases. */
|
||||
DWORD waitTime = (pDeviceStateWASAPI->actualBufferSizeInFramesPlayback * 1000) / pDevice->playback.internalSampleRate;
|
||||
|
||||
@@ -24777,7 +24766,6 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice)
|
||||
WaitForSingleObject(pDeviceStateWASAPI->hEventPlayback, waitTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr = ma_IAudioClient_Stop(pDeviceStateWASAPI->pAudioClientPlayback);
|
||||
if (FAILED(hr)) {
|
||||
@@ -24799,8 +24787,6 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice)
|
||||
ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to reset internal playback device.");
|
||||
return ma_result_from_HRESULT(hr);
|
||||
}
|
||||
|
||||
ma_atomic_bool32_set(&pDeviceStateWASAPI->isStartedPlayback, MA_FALSE);
|
||||
}
|
||||
|
||||
return MA_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user