Shuttle Dial Arrow Keys

The goal of this example is to demonstrate how to configure the shuttle dial on the X-keys Jog & Shuttle Pro to generate left and right keyboard arrow keys. This assumes that the reader is familiar with the basics of creating Building Blocks as shown in the Detailed Tutorial.

The shuttle dial on the X-keys Jog & Shuttle Pro is a continuously turning wheel that generates a value in the range 0 — 255. Turning the wheel clockwise causes the value to increase, turning the wheel counter-clockwise causes the value to decrease. The amount by which the value changes depends on how fast it is turning.

To determine how fast the shuttle dial is turning and in which direction, the Delta (Number) building block can be used. The Delta (Number) compares a control's current value to its previous value and calculates the difference. For this task, the default settings of the Delta (Number) building block are sufficient. When setup as shown to the right, the Delta (Number) will report repeated values of "1" when the shuttle dial is turned slowly clockwise and "-1" when turned slowly counter-clockwise. If the shuttle dial is turned faster, the Delta (Number) block will report larger values.


Although the shuttle dial turns continuously in either direction, its value is limited to the range 0 — 255. When the value reaches one limit, it "rolls over" to the opposite limit. For example, as the shuttle dial is turned clockwise, it will report values of ... 253, 254, 255, 0, 1, 2 ... The Delta (Number) building block will report the jump from the maximum value to the minimum value as "-255". To create a continuous sequence of values as the shuttle dial is turned, the large jumps must be replaced with values that represent the actual dial movement:

Delta (Number)Replacement Value
-2551
-2542
-2533
-2524
-2515
251-5
252-4
253-3
254-2
255-1

To replace these large jumps, a Number Exchange building block is used. This block is configured to replace the large jumps with values that indicate the shuttle dial's actual movement:


To generate keystrokes based on the shuttle dial's direction and speed, Value Selector building blocks are used to detect specific values from the Number Exchange block. Each Value Selector block triggers a different Keystrokes building block.


Each Keystrokes building blocks is configured to generate a certain number of arrow keystrokes. Value Selector building blocks that detect negative values trigger Keystrokes blocks configured with Left Arrow key presses, Value Selector blocks that detect positive values trigger Keystrokes blocks configured with Right Arrow key presses. Value Selector blocks that detect larger values trigger Keystrokes blocks with a higher number of arrow key presses.


To handle a shuttle dial that is turning very quickly, a Range building block is used to detect large values. In this example, any value from the shuttle dial that is "5" or larger will generate five arrow key presses.


The entire configuration is shown below. With this setup, up to five keystrokes will be generated each time the value of the shuttle dial changes. If needed, this configuration can be modified by adding additional Value Selector and Keystrokes building blocks to generate more key presses. In that case, the values that the Range building blocks detect would then need to be adjusted.