|
|
@@ -132,7 +132,6 @@ struct AudioInterface : Module { |
|
|
|
if (port.active && port.numInputs > 0) { |
|
|
|
// Wait until inputs are present |
|
|
|
// Give up after a timeout in case the audio device is being unresponsive. |
|
|
|
APP->engine->yieldWorkers(); |
|
|
|
std::unique_lock<std::mutex> lock(port.engineMutex); |
|
|
|
auto cond = [&] { |
|
|
|
return (!port.inputBuffer.empty()); |
|
|
@@ -182,11 +181,12 @@ struct AudioInterface : Module { |
|
|
|
if (outputBuffer.full()) { |
|
|
|
// Wait until enough outputs are consumed |
|
|
|
// Give up after a timeout in case the audio device is being unresponsive. |
|
|
|
APP->engine->yieldWorkers(); |
|
|
|
std::unique_lock<std::mutex> lock(port.engineMutex); |
|
|
|
auto cond = [&] { |
|
|
|
return (port.outputBuffer.size() < (size_t) port.blockSize); |
|
|
|
}; |
|
|
|
if (!cond()) |
|
|
|
APP->engine->yieldWorkers(); |
|
|
|
std::unique_lock<std::mutex> lock(port.engineMutex); |
|
|
|
auto timeout = std::chrono::milliseconds(200); |
|
|
|
if (port.engineCv.wait_for(lock, timeout, cond)) { |
|
|
|
// Push converted output |
|
|
|