CControl

A holder for basic information about a MIDI controller: controller number (or \pb for the pitch bend wheel), button number, and controller type.

I use SuperCollider with a Novation ReMOTE 25 controller, which features three types of controls (knobs, encoders and sliders) and an x/y touchpad in addition to the standard pitch bend and modulation wheels. The knobs, encoders and sliders have buttons attached to them. CControl keeps both the controller number and button number so that the button and controller are always linked.

Type is used so that you can ask CCAllocator for a specific type of controller.

*new(ccnum, type)

ccnum: the controller number (or \pb). If this controller has a button, ccnum should be an array: [controller number, button number].

type: a symbol representing the type.

CControl.new([5, 2], \knob).dump;

Instance of CControl { (0247B6A0, gc=A4, fmt=00, flg=00, set=02)

instance variables [3]

ccnum : Integer 5

type : Symbol 'knob'

buttonnum : Integer 2

}

*newArray(ccnums, types)

Make an array of CControls.

ccnums: an array of controller numbers. Controllers with buttons should be represented as an array within this array: [[5, 2], [6, 3]...].

types: an array of controller types. If you have several controllers of the same type, you can list the type followed by as many nils as you need to fill up the rest.

a = CControl.newArray([[5, 2], [6, 3], [9, 122], \pb], [\knob, nil, \slider, \pb]);

[ a CControl, a CControl, a CControl, a CControl ]

a.do({ arg c; [c.asString, c.buttonnum].postln });

[ [ 5, knob ], 2 ]

[ [ 6, knob ], 3 ] // note that type was nil for this entry; it picks up \knob from #5

[ [ 9, slider ], 122 ]

[ [ pb, pb ], nil ] // no button for the pb wheel

value

Returns the controller number. This allows raw numbers as well as CControls to be used as arguments to MIDI control objects: whether it's a CControl or an integer, cc.value always returns the controller number.