Use shut down hook to destroy() midi

This commit is contained in:
Abe Pazos
2020-03-20 16:57:17 +01:00
parent 2ca78df17f
commit 32a82bb37f

View File

@@ -106,6 +106,13 @@ class MidiTransceiver(val receiverDevice: MidiDevice, val transmitterDevicer: Mi
override fun close() {
}
}
// shut down midi if user calls `exitProcess(0)`
Runtime.getRuntime().addShutdownHook(object : Thread() {
override fun run() {
destroy()
}
})
}
val controlChanged = Event<MidiEvent>("midi-transceiver::controller-changed").signature(MidiEvent::class.java)