I understand your code a bit more now. Thank you. Should this VST be created as an instrument or an effect? As an instrument, even when I simplified the criteria to generate a sound, I was unable to get a sound out of the code below. However, I am able to attach my MIDI device (Novation Launch Control XL) and play the synths that come with Cabbage.
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginID("def1")
keyboard bounds(8, 158, 381, 95)
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
; Initialize the global variables.
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1
gkNotes init 128 ; notes status array, 1=held 0=off
instr 1 ; trigger by midi
kRelFlag release ; 0 when note is held, 1 when released
kRelFlag = 1 - kRelFlag ; invert logic
iNum notnum ; number of MIDI note played
gkNotes[iNum] = kRelFlag ; write flag to array location of note number
if ((gkNotes)==1) then
;causes Csound to run for about 7000 years...