API - VissionNZ/node-xtouch GitHub Wiki

x_touch_events.js

Exports: EventEmitter midiEvents

Events

  • rotary_press
    • Description: Rotary knob pressed/released.
    • Payload: strip number (1-8), 'on'/'off', time delta
  • rotary_turn
    • Description: Rotary knob turned.
    • Payload: strip number (1-8), value (0-127), time delta
  • strip_button
    • Description: Strip button pressed/released.
    • Payload: strip number (1-8), button name ('rec', 'solo', 'mute', 'select'), 'on'/'off', time delta
  • fader_touch
    • Description: Fader touched/released.
    • Payload: strip number (1-8), 'on'/'off', time delta
    • NOTE: The unit has a built in 'debounce' so the 'off' status fires approx 0.3s after actual release.
  • fader_move
    • Description: Rotary knob turned.
    • Payload: strip number (1-8), value (0-127), time delta

x_touch_setters.js

Exports: Object{method1: method1, ...}

Example use:

const setters = require('./x_touch_setters.js');

midi_interface.sendMessage(setters.setRotaryLevelLed(2, 10));

Methods Exposed

  • setRotaryLevelLed(strip, level)
    • Returns: array - Midi message to send to unit.
    • Where: strip = 1-8, level = 0-12
    • Note: Internally, it uses levels 0-127, but this is a convenience method to enable direct setting of which of the 13 LEDs.
    • Note: Only one LED on at a time each strip due to equipment limitations.
    • Note: A 'level' of 0 means the first LED is lit. You cannot turn these off completely.
  • setAudioLevelLed(strip, level)
    • Returns: array - Midi message to send to unit.
    • Where: strip = 1-8, level = 0-8
    • Note: Internally, it uses levels 0-127, but this is a convenience method to enable direct setting of which of the 8 LEDs.
    • Note: Only one LED on at a time each strip due to equipment limitations.
    • Note: A 'level' of 0 means no LEDs are lit.
  • setStripLight(strip, button, state)
    • Returns: array - Midi message to send to unit.
    • Where: strip = 1-8, button = 'rec'/'solo'/'mute'/'select', state = 'on'/'off'/'flash'
  • setFader(strip, level)
    • Returns: array - Midi message to send to unit.
    • Where: strip = 1-8, level = 0-127
    • Note: A level of 100 corresponds to 0dB on the slider.
    • Note: The slider is moved using an internal feedback, so if you say 120 as a level, you can be sure the slider will stop at 120.
    • Note: Setting 0 or 127, the slider will set a value of 0 or 127, but there will still be a tiny amount of downward/upward movement possible, just owing to the nature of the hardware.
  • setLcdColor(strip, color)
    • Returns: array - Full midi LCD SysEx message to send to unit.
    • Where: strip = 1-8, color = 'red'/'green'/'yellow'/'blue'/'magenta'/'cyan'/'white'/'off'.
    • Note: A color of "off" renders any text set on the screen unreadable.
  • setLcdTopLine(strip, message, invert)
    • Sets the upper line of text on the appropriate LCD panel.
    • Returns: array - Full midi LCD SysEx message to send to unit.
    • Where: strip = 1-8, message = a string of text to display, invert = true/false.
    • Note: If the message is longer than 7 characters, you will need to call the LcdState.advance()/advanceTop()/advanceBottom() methods at intervals to cycle through the text.
    • Note: If invert = true, it will render light text on dark background. false is dark text on light background.
  • setLcdBottomLine(strip, message, invert)
    • Same as setLcdTopLine
  • updateLcdWithState(state)
    • Returns: array - Full midi LCD SysEx message to send to unit.
    • Where: state = LcdState object.
    • Note: Recommended to set LCD's using the 3 set methods above rather than directly through the state object.
    • Note: Use the states to advance the lines of text appropriately using the advance methods.

Properties Exposed

  • lcdStates
    • An object of type {1: LcdState, 2: LcdState, 3: ...} where the key corresponds to the strip on the unit (so 1-8).

LcdState.js

Exports: LcdState class

Example use: let lcdState = new LcdState('red', 'upper', 'This is a test', 'Hello world');

Constructor

  • LcdState(color, invert, topFullText, bottomFullText)
    • Where:
      • color = 'red'/'green'/'yellow'/'blue'/'magenta'/'cyan'/'white'/'off'
      • invert = 'upper', 'lower', 'both', 'none'
      • topFullText = Full string to display on upper half.
      • bottomFullText = Full string to display on lower half.

Methods

  • advanceTop(forwards)
    • Advances the top line of text by 1 character forwards or backwards.
    • Returns: null
    • Where: forwards = true/false. If false, will scroll a step backwards.
    • Note: On reaching the end of the string, there is a 3 space gap between the message being repeated again.
    • Note: If the string is 7 characters or less, this will have no effect.
  • advanceBottom(forwards)
    • Same as advanceTop()
  • advance()
    • Returns: null
    • Note: Really only meant for testing, just calls both advanceTop(true) and advanceBottom(true).

Properties/Getters

  • topSevenChars
    • A getter, which returns the current 7 character string for the top line of the LCD panel.
    • This takes into account the state of advancement set by calling advanceTop/Bottom methods.
  • bottomSevenChars
    • Same as topSevenChars... But for bottom line obviously...