From b6bf3afa8177c22dc9d00e07f1f5be9f05b8beb3 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 6 Apr 2020 00:17:19 +0100 Subject: [PATCH 1/3] check 'note' as well as 'n' when looking for MIDI notes, fixes #186 --- classes/DirtEventTypes.sc | 3 ++- classes/DirtOrbit.sc | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/DirtEventTypes.sc b/classes/DirtEventTypes.sc index d83745e7..934fd7c2 100644 --- a/classes/DirtEventTypes.sc +++ b/classes/DirtEventTypes.sc @@ -42,7 +42,8 @@ DirtEventTypes { var freq, lag, sustain; var args, midiout, hasGate, midicmd, latency, chan; var sendNRPN, schedmidi, schedmidicmd, donecmd; - var hasNote = ~n != \none, midiCommandPending = ~midicmd.notNil; + var hasNote = not (~n == \none and: {~note == \none}); + var midiCommandPending = ~midicmd.notNil; var nrpnMSB, nrpnLSB, valMSB, valLSB; var ctlNum, control, num, val, note; diff --git a/classes/DirtOrbit.sc b/classes/DirtOrbit.sc index 5b29b709..6426bbf1 100644 --- a/classes/DirtOrbit.sc +++ b/classes/DirtOrbit.sc @@ -186,6 +186,7 @@ DirtOrbit { ~cut = 0.0; ~unit = \r; ~n = \none; // sample number or note + ~note = \none; // sample pitch or note ~octave = 5; ~midinote = #{ ~note ? ~n + (~octave * 12) }; ~freq = #{ ~midinote.value.midicps }; From 17c728aec994cd896f5d1c62fa4a73c1a75cc25c Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 7 Apr 2020 15:36:13 +0100 Subject: [PATCH 2/3] detect the presence of note properly --- classes/DirtEventTypes.sc | 2 +- classes/DirtOrbit.sc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/DirtEventTypes.sc b/classes/DirtEventTypes.sc index 934fd7c2..d1067b8a 100644 --- a/classes/DirtEventTypes.sc +++ b/classes/DirtEventTypes.sc @@ -42,7 +42,7 @@ DirtEventTypes { var freq, lag, sustain; var args, midiout, hasGate, midicmd, latency, chan; var sendNRPN, schedmidi, schedmidicmd, donecmd; - var hasNote = not (~n == \none and: {~note == \none}); + var hasNote = (~n != \none or: {~note != nil}); var midiCommandPending = ~midicmd.notNil; var nrpnMSB, nrpnLSB, valMSB, valLSB; var ctlNum, control, num, val, note; diff --git a/classes/DirtOrbit.sc b/classes/DirtOrbit.sc index 6426bbf1..5b29b709 100644 --- a/classes/DirtOrbit.sc +++ b/classes/DirtOrbit.sc @@ -186,7 +186,6 @@ DirtOrbit { ~cut = 0.0; ~unit = \r; ~n = \none; // sample number or note - ~note = \none; // sample pitch or note ~octave = 5; ~midinote = #{ ~note ? ~n + (~octave * 12) }; ~freq = #{ ~midinote.value.midicps }; From d5888931ee9a14dea85e3fb8fca3894d7bb150be Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 7 Apr 2020 20:48:32 +0100 Subject: [PATCH 3/3] != nil -> .notNil --- classes/DirtEventTypes.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/DirtEventTypes.sc b/classes/DirtEventTypes.sc index d1067b8a..4f3aa86a 100644 --- a/classes/DirtEventTypes.sc +++ b/classes/DirtEventTypes.sc @@ -42,7 +42,7 @@ DirtEventTypes { var freq, lag, sustain; var args, midiout, hasGate, midicmd, latency, chan; var sendNRPN, schedmidi, schedmidicmd, donecmd; - var hasNote = (~n != \none or: {~note != nil}); + var hasNote = (~n != \none or: {~note.notNil}); var midiCommandPending = ~midicmd.notNil; var nrpnMSB, nrpnLSB, valMSB, valLSB; var ctlNum, control, num, val, note;