mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Don't trigger an assert when starting/stopping the device.
This commit is contained in:
@@ -24501,6 +24501,10 @@ ma_result ma_device_start(ma_device* pDevice)
|
||||
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "ma_device_start() called for an uninitialized device.", MA_DEVICE_NOT_INITIALIZED);
|
||||
}
|
||||
|
||||
if (ma_device__get_state(pDevice) == MA_STATE_STARTED) {
|
||||
return ma_post_error(pDevice, MA_LOG_LEVEL_WARNING, "ma_device_start() called when the device is already started.", MA_INVALID_OPERATION); /* Already started. Returning an error to let the application know because it probably means they're doing something wrong. */
|
||||
}
|
||||
|
||||
result = MA_ERROR;
|
||||
ma_mutex_lock(&pDevice->lock);
|
||||
{
|
||||
@@ -24547,6 +24551,10 @@ ma_result ma_device_stop(ma_device* pDevice)
|
||||
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "ma_device_stop() called for an uninitialized device.", MA_DEVICE_NOT_INITIALIZED);
|
||||
}
|
||||
|
||||
if (ma_device__get_state(pDevice) == MA_STATE_STOPPED) {
|
||||
return ma_post_error(pDevice, MA_LOG_LEVEL_WARNING, "ma_device_stop() called when the device is already stopped.", MA_INVALID_OPERATION); /* Already stopped. Returning an error to let the application know because it probably means they're doing something wrong. */
|
||||
}
|
||||
|
||||
result = MA_ERROR;
|
||||
ma_mutex_lock(&pDevice->lock);
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user