KeyKit :: Special Variables
Below are descriptions of the global variables that have special meanings within KeyKit. Most of these are built-in to KeyKit, but some are implemented with code in the user-defined library.

Abortonerr
When set to 1, KeyKit will abort when an error occurs. The default is 0.
Abortonint
When set to 1, KeyKit will abort when an interrupt is received. The default is 1.
Arraysort
When set to 1, the index values in the "for ( i in arr )" statement will be processed in sorted order. The default is 0, so that the order of index values is not sorted.
Autoresize
When set to 1, resizing the main KeyKit window will result in the proportionate resizing of all the individual tool windows. Default is 0, so that making the main window bigger will get you more space for new tools rather than just making the existing tools bigger.
Clicks
The number of clicks per beat. Default is 96.
Clicksperclock
When Sync!=0, this is the number of KeyKit clicks per MIDI clock. Default is 1.
Clocksperclick
When Sync!=0, this is the number of MIDI clocks per KeyKit click. Default is 1. To avoid confusion when adjusting Clicksperclock and Clocksperclick, you should ensure that at least one of those two variables has a value of 1.
Consolefifo
The automatically-opened fifo that can be used to read characters from the console.
Current
This phrase contains all currently-depressed notes.
Defpriority
This is the default priority of new tasks (though normally, tasks inherit the priority of the task that spawns them).
Dirseparator
This string is the machine-dependent value that separates directory entries within a pathname. For example, on Unix, it is "/".
Dragquant
This number is used to quantize the dragging of notes with the Group tool.
Eof
This value is returned when you do a get() on a closed (or nonexistent) fifo.
Errorfunc
The function specified by this pointer is automatically called when a non-fatal execution error occurs.
Filter
The value of this variable is a collection of bitflags that determines what MIDI messages are filtered out of received MIDI input. Macros for the bit values that can be set in the value of Filter are: CHANPRESSURE, CONTROLLER, PROGRAM, PRESSURE, PITCHBEND, SYSEX, POSITION, SONG, STARTSTOPCONT, and CLOCK. Default value is 0, i.e. nothing is filtered.
Keypath
This string is the list of directories in which to search for KeyKit function libraries. Default is machine-dependent, usually computed on the fly by the executable, though you can override it by defining a KEYPATH environment variable. Note: if you change Keypath after KeyKit has started executing, you need to call the rekeylib() function in order to rescan all the directories for their keylib.k files - otherwise the change will be ineffective.
Loadverbose
If non-zero, the dynamic loading of each KeyKit function is announced. Default is 0.
Lowcore
When the amount of free memory falls below this number, warnings begin to be issued to encourage exiting. Default is 50000.
Machine
This string holds the machine type (e.g. "win", "unix", "amiga").
Maxatonce
This controls how many simultaneously-depressed notes can be handled on MIDI input. Default value is 256.
Merge
If non-zero, MIDI input is merged into MIDI output. Default is 1.
Mergefilter
If non-zero (and if Merge is non-zero), this value is a bitmask used to determine which channels are not merged from MIDI input to MIDI output. For example, if the value of Mergefilter is 41<<4, then channel 5 will not be merged. Any number of bits in Mergefilter can be set.
Mfformat
The value of this variable is the type (0,1,2) of the last MIDI file read with midifile().
Midififo
The automatically-opened fifo that can be used to read notes from MIDI input.
Mousefifo
The automatically-opened fifo that can be used to read events from the mouse. The items read from this fifo are arrays - the index values are "button", "x", and "y".
Now
The current time, in clicks.
Offsetfilter
If non-zero (and if Offsetpitch is non-zero), this value is a bitmask used to determine which channels are not pitch-shifted. For example, if the value of Offsetfilter is 1<<9, then channel 10 will not be affected. (And, in fact, 1<<9 is the default value of Offsetfilter.) Any number of bits in Offsetfilter can be set.
Offsetpitch
If non-zero, all scheduled MIDI output will be pitch-shifted by the value of Offsetpitch.
Pathseparator
This string is the character that separates the components of Keypath. Default is ":".
Phraseflashnotes
If this value is non-zero, notes within phrase windows are flashed as they are played. Default is 1. If your CPU is too busy, setting this to 0 can help a bit.
Printsplit
When long phrase values are printed, they are broken up on separate lines (each line terminated with a backslash), and Printsplit is the number of characters on each line. The default value is 77. To disable splitting of lines entirely, set Printsplit to 0.
Record
When non-zero, recording of MIDI input is enabled. Default is 1.
Recorded
This phrase collects all MIDI input (when Record is non-zero).
Recsched
When non-zero, scheduled MIDI output is included in the Recorded phrase. Default is 0.
Sync
If non-zero, time is advanced from clocks on MIDI input instead of being driven by the computer's clock. This allows synchronization with other MIDI devices (e.g. a drum machine or sequencer). Default is 0.
Throttle
This determins how many KeyKit instructions (internal interpreted instructions, not KeyKit statements) are executed per each check for realtime activity. Default value is 100.
Version
This string is the KeyKit version number (e.g. "6.0a").

Variables used in Graphics

Bendrange
This number controls the relative size of pitch-bend controller lines in the Misc window. Default is 16384.
Bendoffset
This number controls the vertical offset of the beginning of pitch-bend controller lines in the Misc window. Default is 64.
Checkcount
This controls the frequency of garbage collection activities. Default is 20.
Colors
This is the number of colors (including black and white) available.
Font
This string is the name of the font to be used. Default is machine-dependent, and some machines may completely ignore it.
Graphics
This number is non-zero whenever graphics mode is enabled.
Menujump
If non-zero, moving the mouse into a menu's scroll bar will cause the menu to immediately jump to that position. Otherwise, scroll bar movement is only relative. Default is 0. If you have trouble interacting with the scroll bar, try setting this to 1.
Menuscrollwidth
This number controls the width of the scroll bar in scrolling menus. Default is 20. If you have trouble getting on the scroll bar, increase this value.
Menusize
This is the default maximum number of items in a pop-up menu. When a menu becomes larger than this, it will display a scroll bar. Default is 12.
Musicpath
This string is the list of directories in which to search for music files. Default is machine-dependent.
Showbar
The number of clicks between vertical measure bars. Default is 4b.
Sweepquant
This number is used to quantize the sweeping of areas with sweep() and gridsweep().
Volstem
If non-zero, ``volume stems'' are displayed on notes. Default is 0.
Volstemsize
This number controls the relative scale of volume stems. Default is 4.