Skip to content

Commit

Permalink
AudioUnitManifest: Use wait condition to await initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Nov 17, 2024
1 parent 4a4358c commit 6d9d281
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/effects/backends/audiounit/audiounitmanifest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,12 @@

const int TIMEOUT_MS = 2000;

QElapsedTimer timer;
timer.start();

while (manager.getAudioUnit() == nil) {
if (timer.elapsed() > TIMEOUT_MS) {
qWarning() << name() << "took more than" << TIMEOUT_MS
<< "ms to initialize, skipping manifest initialization "
"for this effect. This means this effect will not "
"display any parameters and likely not be useful!";
return;
}
QThread::msleep(10);
if (!manager.waitForAudioUnit(TIMEOUT_MS)) {
qWarning() << name() << "took more than" << TIMEOUT_MS
<< "ms to initialize, skipping manifest initialization "
"for this effect. This means this effect will not "
"display any parameters and likely not be useful!";
return;
}

AudioUnit audioUnit = manager.getAudioUnit();
Expand Down

0 comments on commit 6d9d281

Please sign in to comment.