mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Rearrange some code.
This commit is contained in:
@@ -9630,7 +9630,13 @@ mal_result mal_device_main_loop__dsound(mal_device* pDevice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Getting here means the device is being stopped. */
|
/* Getting here means the device is being stopped. */
|
||||||
|
if (pDevice->type == mal_device_type_capture || pDevice->type == mal_device_type_duplex) {
|
||||||
|
if (FAILED(mal_IDirectSoundCaptureBuffer_Stop((mal_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer))) {
|
||||||
|
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[DirectSound] IDirectSoundCaptureBuffer_Stop() failed.", MAL_FAILED_TO_STOP_BACKEND_DEVICE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pDevice->type == mal_device_type_playback || pDevice->type == mal_device_type_duplex) {
|
||||||
/* The playback device should be drained before stopping. All we do is wait until the available bytes is equal to the size of the buffer. */
|
/* The playback device should be drained before stopping. All we do is wait until the available bytes is equal to the size of the buffer. */
|
||||||
if (isPlaybackDeviceStarted) {
|
if (isPlaybackDeviceStarted) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -9671,12 +9677,6 @@ mal_result mal_device_main_loop__dsound(mal_device* pDevice)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDevice->type == mal_device_type_capture || pDevice->type == mal_device_type_duplex) {
|
|
||||||
if (FAILED(mal_IDirectSoundCaptureBuffer_Stop((mal_IDirectSoundCaptureBuffer*)pDevice->dsound.pCaptureBuffer))) {
|
|
||||||
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[DirectSound] IDirectSoundCaptureBuffer_Stop() failed.", MAL_FAILED_TO_STOP_BACKEND_DEVICE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pDevice->type == mal_device_type_playback || pDevice->type == mal_device_type_duplex) {
|
|
||||||
if (FAILED(mal_IDirectSoundBuffer_Stop((mal_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer))) {
|
if (FAILED(mal_IDirectSoundBuffer_Stop((mal_IDirectSoundBuffer*)pDevice->dsound.pPlaybackBuffer))) {
|
||||||
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[DirectSound] IDirectSoundBuffer_Stop() failed.", MAL_FAILED_TO_STOP_BACKEND_DEVICE);
|
return mal_post_error(pDevice, MAL_LOG_LEVEL_ERROR, "[DirectSound] IDirectSoundBuffer_Stop() failed.", MAL_FAILED_TO_STOP_BACKEND_DEVICE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user