II.3.4. Adding Parameter Control

To add parameter controls, we can setup one or more of control array element. Each element (control[0], control[1],..,control[5]) has mode which is set to default value CM_DISABLED by the system’s setup.

  • Setup the control name (control[n].name) to a self-descriptive name for the control function, such as “Out Level”, “Gain”, “Distortion Level”, etc.
  • The control mode (control[n].mode) can be set to one of the following values to enable the port: CM_POT, CM_SELECTOR, CM_TOGGLE, CM_MOMENTARY, CM_TAPTEMPO, and CM_MULTIBUTTON.
  • Setting up control[n].mode to CM_POT setup the port for reading analog potentiometer, analog expression pedal, or analog control voltage (CV) inputs. The default resolution of the reading is 128 steps (0-127), to change the resolution you can set control[n].levelCount to an integer value between 2-256.
  • Setting up control[n].mode to CM_SELECTOR will setup the port for reading a selector switch. Set the control[n].levelCount value to an integer ranging for 2 – 12, which setup the position count of the selector switch. If you use a potentiometer instead of selector switch, it would work but note that the reading won’t apply any hysteresis between adjacent level so it could be triggered back and fort when taper is positioned between two levels.
  • The inverted property will setup the turning-direction of the potentiometer and the selector switch.
  • For CM_TOGGLE, CM_MOMENTARY, and CM_TAPTEMPO modes, the setting for the other properties is similar with button control (section II.3.1.2.)
  • The CM_MULTIBUTTON mode is not yet implemented in the current version library.

Example Codes

Let’s suppose to have a knob at H1 port for output level control and a 3-position switch at H2 port for gain range control. The knob would control the output level in 128 steps from silent (0) to the maximum (127), while the switch will set the gain range so that at the maximum level the gain will be selectable as 0.5, 1.0, and 2.0. Here is the initialization code:

After setting up the control inside the init() function, we can directly access the value (control[n].value) inside our processing function and we can also write the event handler that perform some task whenever the value changes (see section II.3.1.5.).

Back to Table of ContentsBuy Blackstomp PCBBuy Blackstomp ModuleBuy Blackstomp Pedal