mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-09 16:52:28 +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,7 +503,13 @@ public:
|
|||
}
|
||||
|
||||
if (message->message == WM_DEVICECHANGE) {
|
||||
Midi::USBchanged(); // re-scan the MIDI bus
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue