Setup MIDI device observers in parallel to avoid blocking OBS startup
Some checks failed
debian-build / build (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled

This commit is contained in:
WarmUpTill 2025-06-24 20:40:49 +02:00 committed by WarmUpTill
parent 40c62ba700
commit 0cd7004f6a

View File

@ -17,7 +17,7 @@ namespace advss {
std::map<std::pair<MidiDeviceType, std::string>, MidiDeviceInstance *>
MidiDeviceInstance::devices = {};
static bool setupDeviceObservers()
static bool setupMidiDeviceObservers()
{
static std::vector<libremidi::observer> observers;
try {
@ -74,10 +74,18 @@ static bool setupDeviceObservers()
blog(LOG_WARNING, "Failed to setup midi device observers: %s",
error.what());
}
blog(LOG_INFO, "%s complete", __func__);
return true;
}
static bool deviceObserversAreSetup = setupDeviceObservers();
static bool setup()
{
std::thread t([]() { setupMidiDeviceObservers(); });
t.detach();
return true;
}
static bool setupDone = setup();
void MidiDeviceInstance::ResetAllDevices()
{