mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 22:13:12 +02:00
de-bounce Midi::USBchanged signal.
Debounced USBchanged signal to prevent pauses.
This commit is contained in:
parent
cbc8698e9a
commit
f7caba5295
1 changed files with 7 additions and 1 deletions
|
@ -503,9 +503,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message->message == WM_DEVICECHANGE) {
|
if (message->message == WM_DEVICECHANGE) {
|
||||||
|
const float MIN_DELTA_SECONDS = 2.0f; // de-bounce signal
|
||||||
|
static float lastTriggerTime = 0.0f;
|
||||||
|
const float deltaSeconds = secTimestampNow() - lastTriggerTime;
|
||||||
|
lastTriggerTime = secTimestampNow();
|
||||||
|
if (deltaSeconds > MIN_DELTA_SECONDS) {
|
||||||
Midi::USBchanged(); // re-scan the MIDI bus
|
Midi::USBchanged(); // re-scan the MIDI bus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue