XY Pad

xypad is an x/y controller that sends data to Csound on two named channels. The first channel transmits the current position of the ball on the X axis, while the second transmits the position of the ball on the Y axis. The XY pad can function in two unique modes of automation, free and path based. The two modes can be toggled by clicking on the corresponding icon on the bottom left of the xypad control. With either mode selected you can right-click the xypad and create a trajectory or path for the circle's movement. Release the mouse and the circle will start moving. Once the ball is in full flight you can control the speed of the ball using the XY pad slider that will appear once you hover over it with the mouse. To stop the ball simple left click anywhere on the xy pad canvas with the left mouse button.

xypad channel("chan1", "chan2"), text("name"), textcolour("colour"), bounds(x, y, width, height), value(val), identchannel("channel"), visible(val), active(val), colour("colour"), fontcolour("colour"), alpha(val), tofront(), widgetarray("chan", number),

Specific Identifiers

channel("chan1", "chan2") "chan1" is the name of the X-axis channel in which to communicate with Csound, and "chan2" is the Y-axis channel in which to communicate with Csound.

text("name") "name" will be the text that appears on the top right hand side of the XYpad surface.

rangex(min, max, value) sets the range of the X axis. The first 2 parameters are required. The third is optional. The first two parameters let you set the minimum value and the maximum value. The next parameter determines the initial value.

rangey(min, max, value) sets the range of the Y axis. The first 2 parameters are required. The third is optional. The first two parameters let you set the minimum value and the maximum value. The next parameter determines the initial value.

textcolour("colour") This set the colour of the text passed to text(). If you wish to change the colour of the numbers being displayed use fontcolour(). See below. See above for details on valid colours.

Common Identifiers

bounds(x, y, width, height) integer values that set position and size on screen(in pixels).

value(val) value sets the initial state of the widget.

identchannel("channel") Sets the channel which data is sent and retrieved from Csound. When used with a chnset opcode users can override widget attributes. See Identifier channels

visible(val) A value of 0 will cause the widget to become invisible. Widgets have their visibility set to 1 by default.

active(val) Will deactivate a control if 0 is passed. Controls which are deactivate can still be updated from Csound.

colour("colour") This sets the main colour. Any CSS or HTML colour string can be passed to this identifier. The colour identifier can also be passed an RBG, or RGBA value. All channel values must be between 0 and 255. For instance colour(0, 0, 255) will create a blue, while colour(0, 255, 0, 255) will create a green with an alpha channel set to full.

fontcolour("colour") Sets the colour of the font. In the case of slider this sets teh colour of the font in the value textbox if it is shown.

alpha(val) A value between 0 and 1 will set the alpha blend value for the entire component. Can be useful if you need to fade widgets in and out.

tofront() Brings a widget to the front of the z order. This identifier takses no arguments and is only intended for use with identifier channels.

widgetarray("chan", number) Creates a number of widgets in a single pass. See Widget arrays

XY pads range identifiers do not permit the setting of skew factors, or increments. If you wish to set a custom skew factor, or increment value, you will need to do so using Csound code.


form caption("XY-Pad Example") size(400, 300), colour(220, 220, 220), pluginID("def1")
xypad bounds(10, 10, 380, 280), channel("xChannel", "yChannel"), rangex(0, 1000, 100), rangey(0, 1000, 100), textcolour("yellow"), text("XY-PAD")
-n -d -+rtmidi=NULL -M0 -m0d 
; Initialize the global variables. 
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

seed 0 
;basic usage
instr 1
kXVal chnget "xChannel"
kYVal chnget "yChannel"
a1 oscili 1, kXVal
a2 oscili a1, kYVal
outs a2, a2

;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 z