summaryrefslogtreecommitdiff
path: root/drumgizmo/drumgizmoc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'drumgizmo/drumgizmoc.cc')
-rw-r--r--drumgizmo/drumgizmoc.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc
index c6b43f0..cec96f7 100644
--- a/drumgizmo/drumgizmoc.cc
+++ b/drumgizmo/drumgizmoc.cc
@@ -326,6 +326,7 @@ int main(int argc, char* argv[])
}
oe = factory.createOutput(engine);
if(ie == NULL)
+ if(oe == NULL)
{
std::cerr << "Invalid output engine: " << engine << std::endl;
return 1;
@@ -700,6 +701,34 @@ int main(int argc, char* argv[])
}
std::cout << "\ndone" << std::endl;
}
+ else
+ {
+ // Async loading in progress
+
+ // Wait until the loader has passed the kit parsing step before proceeding.
+ bool parsing_done{false};
+ while(!parsing_done)
+ {
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
+
+ switch(settings.drumkit_load_status.load())
+ {
+ case LoadStatus::Idle:
+ case LoadStatus::Parsing:
+ // Not yet past the parsing step
+ break;
+ case LoadStatus::Loading:
+ case LoadStatus::Done:
+ // Past parsing step
+ parsing_done = true;
+ break;
+ case LoadStatus::Error:
+ // Kit parser error?
+ std::cout << "\nFailed to load " << kitfile << std::endl;
+ return 1;
+ }
+ }
+ }
gizmo.setSamplerate(oe->getSamplerate());
oe->onLatencyChange(gizmo.getLatency());