From 4bdaf67d7bdfb07a81fd7be8babbc9caf166dd87 Mon Sep 17 00:00:00 2001 From: Nils <> Date: Mon, 28 Feb 2022 18:51:36 +0100 Subject: [PATCH] protect auditioner against unloaded keyswitches --- engine/auditioner.py | 4 ++-- engine/instrument.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engine/auditioner.py b/engine/auditioner.py index 8162001..5a3c622 100644 --- a/engine/auditioner.py +++ b/engine/auditioner.py @@ -165,11 +165,11 @@ class Auditioner(object): def triggerNoteOnCallback(self, timestamp, channel, pitch, velocity): """args are: timestamp, channel, note, velocity. consider to change eventloop.slowConnect to fastConnect. And also disconnect in self.disable()""" - if self.idKey: + if self.idKey and self.instrumentLayer: self.parentData.instrumentMidiNoteOnActivity(self.idKey, pitch, velocity) def triggerNoteOffCallback(self, timestamp, channel, pitch, velocity): """args are: timestamp, channel, note, velocity. consider to change eventloop.slowConnect to fastConnect. And also disconnect in self.disable()""" - if self.idKey: + if self.idKey and self.instrumentLayer: self.parentData.instrumentMidiNoteOffActivity(self.idKey, pitch, velocity) diff --git a/engine/instrument.py b/engine/instrument.py index f38bdfe..ea0b467 100644 --- a/engine/instrument.py +++ b/engine/instrument.py @@ -436,7 +436,7 @@ class Instrument(object): This is only for permanent sw_last, not momentary sw_up and sw_down """ - if not self.currentVariantKeySwitches: + if not self.currentVariantKeySwitches or not self.instrumentLayer: return #optimisation. if not force is None: