Stuck with a SynthEdit project?

Category: Joystick

Joystick control using DAM modules.

How to create a “roll your own” customizable Joystick control prefab.

Note: This relies heavily on third party modules:
Davidson’s DAM modules;
DAM V XYo Circle,
DAM Rectangle.
Elena’s ED GUI Modules;
ED GUI Fixed In,
ED GUI Fixed Float,
ED GUI Timer.

Once again I’m going to stress that you should never convert from a GUI signal to DSP, perform a math or timing function, then convert this back to a GUI signal. It’s very wasteful on CPU resources, and can cause many problems.

GUI Container for the Joystick.

The Joystick control iteslf uses the DAM V XYo Circle module. This resturns the position of the circle, which can be extensively customized. Here I have pre-set it with a red theme. In the interests of simplicity I’m just connecting the following plugs to the IO Module;
1) Animation Position- The output value of this plug is 0 till the circle receives a click (Mouse Down), it then changes to 10.
2) Position X- The X co-ordinate (horizontal) of the circle (Normalized value of 0-1)
3) Position Y- The Y co-ordinate (vertical) of the circle (Normalized value of 0-1)
4) Circle Size- The size in px of the circle.

The settings in the properties panel are shown below. Make sure the Jump Back Position List is set as “None”, the Mouse Response is set to “Click”, and The Gradient Lock check boxes are ticked. These are the colour settings I used, but as always that’s your personal choice.
Mouse response- This selects various modes, the main ones are;
None- Nothing happens when you click on the circle, and it’s locked in position.
Click- Click on the circle and the Animation Position changes to 10, the circle assumes its “Alt” colour scheme, and can be moved.
Step- Click on the circle and the Animation Position changes to 10, the circle assumes its “Alt” colour scheme and the circle can be moved. The Animation Position value and “Alt” colours are held until a second mouse click is received.

Settings for the DAMV XYo Circle and DAM Rectangle modules.

I have shown these settings as screenshots.

The control section.

The x and y output values are passed as usual to PatchMemory Float3 modules. These then send the Float values to the output IO module as GUI Float, DSP Float and Volts. The Volts as usual is converted by the stock Float to Volts module.
Returning the Joystick to the centre position.
This is done with a pair of Spring 3 modules to send a value of 0.5 to the Position X and Position Y plugs. The ED GUI Timer is used to send a short (10 mS) pulse to the Spring 3 modules when the Centre On/Off plug is set to true. (I found that the Joystick wasn’t reliably setting to the centre when switched on otherwise).
Setting the Joystick’s output ranges.
As usual the ranges of the output values can be specified via the Patch Memories. To make this easier I recommend changing the Patch Memory names in the Properties panel to something like x-axis range, and y-axis range.

X and Y Value (GUI) containers.

These are just standard Float to Text conversion, both connected to the Value output of the PatchMemories to show the actual value being output by the joystick, rather than the Animation Position.

The control panel view.

Synthedit Sub Controls Part 4: The Joystick.

This is another good module to gain an understanding of how sub controls work, and how the various modules interact.

The Stock Joystick module

It’s all fairly standard stuff in this prefab, apart from introducing the Spring Module. The Joystick Image module reports both of the Joystick control image X and Y positions as floating point values in the normal default range of 0 to 1 (Position X and Position Y plugs).
A static Bitmap Image provides the background for the joystick control. Scaled from 0 to 1,
the X and Y Positions plugs are connected to the Animation Position input plugs of the respective PatchMemory Float 3 modules.
The PatchMemory Float3 Low Value and High Value are set to −5 and +5, respectively, which are set in the Properties panel.

The Joystick properties panel.

These modules scale the Animation Position to float values within this range, and the Floating Point values are then converted to Voltages by the Float to Volts modules, and the voltages are fed to the X and Y output plugs.
When the user releases the left mouse button after clicking or dragging the joystick knob, the Mouse Down value changes from True to False, this value is then input to both of the Spring Modules which sets the Animation Positions to the default value of 0.5, thereby centering the joystick knob as soon as the left mouse button is released.
The default return value is set in the Properties Panel (see below).
For the X axis: 0 = Left, 0.5 = Centre, 1.0 = Right.
For the X axis: 0 = Bottom, 0.5 = Centre, 1.0 = Top.

Reset value

Creating a custom slider control from a joystick control.

Its suggested in the SE help file that using the stock Joystick Image GUI control is a good place to start creating your own slider control.
You can, but I find a much better option is the third party ED Joystick Image control, as this allows you to “constrain” the movement of the control in the X or Y axis, whereas the native SE control doesn’t, meaning you can still move the control horizontally…not ideal. By constrain we mean that you can set limits on how far the joystick’s knob can be moved in the X or Y axis, so if we set a minimum of 0.5 and a maximum of 0.5 for the Constrain X Min, and Constrain X Max, and leave the Constrain Y values at their default of 0 for the Minimum, and 1.0 for the Maximum, then we will get a vertical slider control, with no possibility of horizontal movement.

The structure of our new slider control prefab.
There’s nothing too unusual in here, just a few things need explaining.
Module names:
Slider = ED Joystick Image.
Scale = Image2 (SE Sub-Controls)
Title = Text Entry4
Value = Text Entry4
I have just renamed these to make it easier to see what’s going on.
You won’t find the Slider knob image or the Scale image in SE, you would need to create these yourself. This can be done in Paintshop Pro, Photoshop or similar editing software by cropping the scale off the VSlider_Med.png image and saving the knob as Slider-Knob.png (for example)
and copying and pasting the scale into a new image V-Slider-Scale.png (for example). Don’t use the existing file names as this will mess up the SE controls! Don’t forget to save them as .png to preserve the transparency. You can now modify the new slider scale to the length you can require, and stretch your new slider control to fit.
Note: you cannot “stretch” or resize the images used by the SE Image2 Sub-control.
The Patch Memory modules on the Title and Decimal point are to enable you to set your values for the control without opening it, and editing, however the values you set will no show until you run the audio engine.
The CTRL Scaling Factor sets how finely you can control the slider when the CTRL key is held down. For most purposes the default of 0.1 is fine.

Our new slider control

The finished prefab control.
I have put in output plugs for GUI as well as DSP controls, including the animation position, whether you do so is entirely up to you.
As the DSP Float output is taken from the Patch Memory Float3 it’s already normalized, and suitable for DSP usage.