Skip to content

Instantly share code, notes, and snippets.

@rgarner
Created January 26, 2021 09:02
Show Gist options
  • Save rgarner/be028637b651d0cc19d01d38aa6aca4a to your computer and use it in GitHub Desktop.
Save rgarner/be028637b651d0cc19d01d38aa6aca4a to your computer and use it in GitHub Desktop.
/*
Reference - not used directly, see PluginParameters, each of
which has a sendCC property
const PortamentoON_OFF=65;
const PortamentoValue=5;
const ArpON_OFF=117;
const ArpType=119;
const LegatoControl=118;
const MIDI_A_Channel=102;
const MIDI_B_Channel=103;
const MIDI_CH_A_CV=104;
const MIDI_CH_B_CV=105;
const MIDI_CH_A_Gate=106;
const MIDI_CH_B_Gate=107;
const PitchBendScale_CH_A=108;
const PitchBendScale_CH_B=109;
const AfterScale_CH_A=110;
const AfterScale_CH_B=111;
const VelScale_CH_A=112;
const VelScale_CH_B=113;
const MIDIClk=114;
const TEMPO_IN_Div=116;
*/
const valueStringsMIDI = [
'Note',
'Velocity',
'Mod',
'LFO'
];
var PluginParameters = [
{
name: 'Portamento On/Off',
type: 'checkbox',
defaultValue: 0,
sendCC: 65
},
{
name: 'Portamento',
type: 'log',
defaultValue: 0,
numberOfSteps:126,
minValue: 0,
maxValue: 127,
sendCC: 5
},
{
name: 'Clock Div',
type: 'lin',
defaultValue: 0,
numberOfSteps:126,
minValue: 0,
maxValue: 127,
sendCC: 116
},
{
name: 'MIDI A CV',
type: 'menu',
defaultValue: 0,
valueStrings: valueStringsMIDI,
sendCC: 104
},
{
name: 'MIDI A Gate',
type: 'menu',
defaultValue: 0,
valueStrings: valueStringsMIDI,
sendCC: 106
},
{
name: 'MIDI B CV',
type: 'menu',
defaultValue: 0,
valueStrings: valueStringsMIDI,
sendCC: 105
},
{
name: 'MIDI B Gate',
type: 'menu',
defaultValue: 0,
valueStrings: valueStringsMIDI,
sendCC: 107
},
{
name: 'Legato',
type: 'checkbox',
defaultValue: 0,
sendCC: 118
},
{
name: 'MIDI Clock On/Off',
type: 'checkbox',
defaultValue: 0,
sendCC: 114
},
{
name: 'Arp On/Off',
type: 'checkbox',
defaultValue: 0,
sendCC: 117
},
{
name: 'Arp Type',
type: 'menu',
valueStrings: ['Traditional', 'Latch & Shift'],
defaultValue: 0,
sendCC: 119
},
];
function Reset() {
SetParameter('Portamento On/Off', 0);
SetParameter('Portamento', 3);
}
function ParameterChanged(param, value) {
let par = PluginParameters[param];
if(par === undefined) {
throw `param ${param} not found`;
}
if(par.sendCC === undefined) {
throw `param ${par.name} has no sendCC value`;
}
sendCC(par.sendCC, value);
}
function sendCC(number, value) {
var cc = new ControlChange;
cc.number = number;
cc.value = value;
cc.send();
cc.trace();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment