6.2.2. VSig Beginner Tutorial #2 - Simple Gain with UI

../../../_images/simplegainui.png

Fig. 6.13 Simple gain algorithm, with the addition of a knob and menupage to allow for user control

The above patch is an expansion upon Beginner Tutorial #1, adding a knob to control the gain, and a menupage which displays the knob to the user. The addition of interface objects demonstrates how to properly use control and user connections.

Download the sigfile here: Simple Gain with UI.

6.2.2.1. Gain Module pt.2

Signal connections are unchanged from Beginner Tutorial #1, but control inputs are now being utilized. Instead of a predetermined gain value, a knob now sends a variable value to the gain module via the control input.

6.2.2.2. Knob Module

The knob module contains one control output, which is used to control the gain modules.

../../../_images/gain1.png

Fig. 6.14 Module editor for knob module, controlling gain

The above photo shows the minimum and maximum values accessible by the knob. These values correspond directly to the min and max values specified by the gain module itself, although this is not a requirement.

../../../_images/gain2.png

Fig. 6.15 Minimum and maximum values accessible by gain module, viewable in the module editor

Additionally, the res value determines the increment by which the gain will increase or decrease when interacting with the knob.

The “%…f” syntax is used to display changing numerical values to the user, and is described in more detail in Vsig Beginner Tutorial #4 - Intermediate Menu Design.

The menupage module contains a user input and output. The knob is connected to the user input, and the user output is connected to adc-kids, both of which are required to display the knob as a UI object in Emote.

Upon exporting the algorithm to Emote, a single knob will be displayed to the user labeled “Gain,” allowing users to manually control gain between –144 and 96 dB. The numerical value which corresponds to the knob’s position is also displayed to the user, showing exactly how much gain is being provided at a given moment.