Created
May 18, 2019 12:29
-
-
Save rrc2soft/72188e8b48b4cfee077e75ee54a20bae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OnLoad | |
// Assign CC's used by knobs. You can change this in another page | |
// to change the CC's that the XY pad will affect | |
if Unassigned listCC | |
listCC[0] = 1 | |
listCC[1] = 2 | |
listCC[2] = 7 | |
listCC[3] = 71 | |
listCC[4] = 74 | |
endif | |
// Assign the scaling that will be used for the corresponding CC | |
if Unassigned listScale | |
for it = 0 to 4 | |
listScale[it] = 32 | |
endfor | |
endif | |
// Show CC used at the lower row | |
for it = 5 to 9 | |
LabelKnob it, {CC#}, listCC[it - 5] | |
endfor | |
// Show Scaling on the higher row | |
for it = 0 to 4 | |
SetKnobValue it, listScale[it] * 2 | |
LabelKnob it, {+/- }, listScale[it] | |
endfor | |
@End | |
@OnKnobChange | |
// Scale knobs - Change array and label | |
if LastKnob < 5 | |
listScale[LastKnob] = RoundUp (GetKnobValue LastKnob) / 2 | |
LabelKnob LastKnob, {+/- }, listScale[LastKnob] | |
endif | |
@End | |
// Right now, only the Y value of the XY pad is used to send CC | |
// X could be used for another task :-) | |
@OnXYChange | |
// For all 5 knobs | |
for it = 0 to 4 | |
chan = 0 // Right now we send everything to channel zero | |
cc = listCC[it] // We get the CC that we are going to send | |
factor = listScale[it] / 64 // Implements scaling | |
value = (GetKnobValue it + 5) + ((GetYValue - 64) * factor) | |
value = Clip value, 0, 127 // Final Value | |
SendMIDICC chan, cc, value | |
Log {Send MIDI value }, value, { to CC }, CC | |
endfor | |
@End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment