mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
Force a minimum of two periods for duplex mode.
Not all backends have the notion of a period, but for those that do this can make it a bit more reliable.
This commit is contained in:
@@ -44987,6 +44987,9 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC
|
|||||||
if (descriptorPlayback.periodCount == 0) {
|
if (descriptorPlayback.periodCount == 0) {
|
||||||
descriptorPlayback.periodCount = MA_DEFAULT_PERIODS;
|
descriptorPlayback.periodCount = MA_DEFAULT_PERIODS;
|
||||||
}
|
}
|
||||||
|
if (descriptorPlayback.periodCount < 2 && pConfig->deviceType == ma_device_type_duplex) {
|
||||||
|
descriptorPlayback.periodCount = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MA_ZERO_OBJECT(&descriptorCapture);
|
MA_ZERO_OBJECT(&descriptorCapture);
|
||||||
@@ -45003,6 +45006,9 @@ MA_API ma_result ma_device_init(ma_context* pContext, const ma_device_config* pC
|
|||||||
if (descriptorCapture.periodCount == 0) {
|
if (descriptorCapture.periodCount == 0) {
|
||||||
descriptorCapture.periodCount = MA_DEFAULT_PERIODS;
|
descriptorCapture.periodCount = MA_DEFAULT_PERIODS;
|
||||||
}
|
}
|
||||||
|
if (descriptorCapture.periodCount < 2 && pConfig->deviceType == ma_device_type_duplex) {
|
||||||
|
descriptorCapture.periodCount = 2;
|
||||||
|
}
|
||||||
|
|
||||||
/* Starting and stopping must be mutually exclusive. We just use a mutex for this. */
|
/* Starting and stopping must be mutually exclusive. We just use a mutex for this. */
|
||||||
#ifndef MA_NO_THREADING
|
#ifndef MA_NO_THREADING
|
||||||
|
|||||||
Reference in New Issue
Block a user