
data sent from gui

float           value       (mandatory)
unsigned char   type        (mandatory)
unsigned char   controller  (mandatory)
unsigned char   part        (mandatory)
unsigned char   kit
unsigned char   engine
unsigned char   insert
unsigned char   parameter
unsigned char   par2

string          name - handled via simple message system.


Type bits
0 \
1 /  event (see below)
2   source is return from synth
3   source is MIDI
4   source is CLI
5   source is GUI
6   write data value (read othewise)
7   round to int (will be sent as float)

bits 0 + 1 = 0 from anything other than synth = set default.
bits 0 + 1 = 1 temporarily just echo byte stream - no action.
bits 0 + 1 = 3 from anything other than synth = MIDI learn request.

On return from synth
0   success if zero
1   undefined
2   always 1
3-7 as sent

If both bits 4 & 5 are set it indicates a GUI source that needs a redraw *after* the command has been executed.

Within the GUI when sending, bits 0 + 1 = 3 is used to indicate that a particular control is MIDI-learnable. This will eventually be replaced by a new general limits/defaults test that is under development.

There is a special case where all bits are set (0xff). Anything seeing this will then silently ignore the entire command. It is used internally.

Elsewhere, unused chars are set to 0xff as a general test.

e.g.
If 'part' is 0xf0 (main) and 'kit' is 0xff you're there and it is main volume, key shift etc.

If part is < 0x40 and kit is 0xff it's the general part level controls.

If part is < 0x40 and insert = 0x20 it's the kit engine enable controls.

Microtonal (scales)
This uses part number 0xe8

Midi Learn
This uses part number 0xd8

Vector Control
This uses part number 0xc0

Effects and effect sources.
In 'part' we use 0xf1 for system effects and 0xf2 for insertion effects. For these and normal part effects, 'kit' ORed with 0x80 is used to denote the effect type (reverb echo etc.) and 'engine' is used to denote the number of the effect being worked on (the limit depends on the effect source). As 'kit' and 'engine' are not relevant for effects it is safe to use them here.

Effects 'kit' numbers offset by 0x80.

0   None
1   Reverb
2   Echo
3   Chorus
4   Phaser
5   Alienwah
6   Distorsion
7   EQ
8   Dynfilter

These can't be inserts, as Dynfilter has Filter as an insert!


engine
0       addsynth
1       subsynth
2       padsynth
>= 0xC0 adsynth voice modulator
>= 0x80 addsynth voice


inserts
0   lfo
1   filter
        Use engine number 0x88 To access the filter component of the
        DyneFilter effect
2   envelope base
3   envelope freemode graph point add/delete
4   envelope freemode graph X/Y

5   oscillator (for add voice & pad harmonics)
6   oscillator harmonic amplitude (for add voice & pad)
    harmonic amplitude (sub)

7   oscillator harmonic phase (add, pad)
    harmonc bandwidth (sub)

8   resonance base (for add & pad harmonics)
9   resonance graph

16  System effect sends

parameter
    type
        lfo
            0 = Amplitude
            1 = Frequency
            2 = Filter

        envelope
            0 = Amplitude
            1 = Frequency
            2 = Filter
            3 = Bandwidth (SubSynth only)

       envelope free mode
            0 to 39 = point number

        formant filter
            for controls 18 - 20
                formant number
                par2 for vowel number
            for control 37
                filter sequence position

If parameter has bit 7 set (0x80) the command will internally divert to low priority thread actions then loop round to update the CLI and GUI.

If bit 6 is also set (0x40) it will first perform the actual command via the audio thread, then loop for updates.

par2
    used for offsets to some parameters, and for text messge ID numbers
