Class LXMidiSurface

java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.midi.surface.LXMidiSurface
All Implemented Interfaces:
LXPath, LXSerializable, LXMidiListener, LXParameterListener
Direct Known Subclasses:
APC40, APC40Mk2, APCminiSurface, DJM900nxs2, DJMA9, DJMV10, MidiFighterTwister

public abstract class LXMidiSurface extends LXComponent implements LXMidiListener, LXSerializable, LXParameterListener
  • Field Details

  • Constructor Details

  • Method Details

    • setRememberFlag

      public LXMidiSurface setRememberFlag()
    • hasRememberFlag

      public boolean hasRememberFlag()
    • initializeDefaultIO

      public LXMidiSurface initializeDefaultIO()
    • onParameterChanged

      public void onParameterChanged(LXParameter p)
      Description copied from class: LXComponent
      Subclasses are free to override this if desired. It will automatically fire for any listenable parameter that is registered with this component.
      Specified by:
      onParameterChanged in interface LXParameterListener
      Overrides:
      onParameterChanged in class LXComponent
      Parameters:
      p - Parameter that has a value change
    • addSetting

      protected void addSetting(String key, LXListenableParameter setting)
    • addState

      protected void addState(String key, LXListenableParameter state)
    • getName

      @Deprecated public String getName()
      Deprecated.
      Replaced with the clearer getDeviceName()
      Do not use this method, replaced by getDeviceName() for clarity
      Returns:
      default MIDI device name for this surface
    • getDeviceName

      public String getDeviceName()
      Returns the default USB/MIDI driver name of the device for this surface
      Returns:
      Surface default USB/MIDI driver name
    • getDeviceName

      public static String getDeviceName(Class<? extends LXMidiSurface> surfaceClass)
    • getSurfaceName

      public String getSurfaceName()
      Gets the user-facing name of this surface class
      Returns:
      User-facing name of the MIDI surface
    • getSurfaceName

      public static String getSurfaceName(Class<? extends LXMidiSurface> clazz)
      Gets the name of a midi surface to be presented to the user
      Parameters:
      clazz - Midi surface class
      Returns:
      Name of this surface to be shown to the user
    • getInput

      public LXMidiInput getInput()
      Get the current MIDI input for this service
      Returns:
      MIDI input (or null)
    • getOutput

      public LXMidiOutput getOutput()
      Get the current MIDI output for this service
      Returns:
      MIDI output (or null if not found)
    • onEnable

      protected void onEnable(boolean isOn)
      Subclasses may override, invoked automatically when surface is enabled/disabled. This is the typical place to send MIDI messages that configure the state and behavior of a MIDI control surface that has different modes or customization available
      Parameters:
      isOn - Whether surface is enabled
    • onReconnect

      protected void onReconnect()
      Subclasses may override, invoked when the control surface was disconnected but has now reconnected, while still being in the enabled state.
    • sendNoteOn

      protected void sendNoteOn(int channel, int note, int velocity)
    • sendControlChange

      protected void sendControlChange(int channel, int cc, int value)
    • sendSysex

      protected void sendSysex(byte[] sysex)
    • getRemoteControlStart

      public int getRemoteControlStart()
    • getRemoteControlLength

      public int getRemoteControlLength()
    • isRemoteControlAux

      public boolean isRemoteControlAux()
    • load

      public void load(LX lx, JsonObject obj)
      Description copied from class: LXComponent
      Loads the LX component. Restores the ID of the component, as well as its internal and user-facing parameters. Any explicitly registered children will be automatically loaded, so long as they are direct descendants. Dynamic arrays will not be automatically loaded, this is left to subclasses to implement.
      Specified by:
      load in interface LXSerializable
      Overrides:
      load in class LXComponent
      Parameters:
      lx - LX instance
      obj - Object to deserialize
    • save

      public void save(LX lx, JsonObject obj)
      Description copied from class: LXComponent
      Serializes the LX component. By default, all internal and user-facing parameters are serialized, as well as any explicitly registered child components. Note that child arrays are not serialized, or any other dynamic components. Subclasses may override to perform more saving, and are expected to call super.save(lx, obj) at the appropriate time.
      Specified by:
      save in interface LXSerializable
      Overrides:
      save in class LXComponent
      Parameters:
      lx - LX instance
      obj - Object to serialize into
    • matches

      public boolean matches(JsonObject surface)
    • noteOnReceived

      public void noteOnReceived(MidiNoteOn note)
      Specified by:
      noteOnReceived in interface LXMidiListener
    • noteOffReceived

      public void noteOffReceived(MidiNote note)
      Specified by:
      noteOffReceived in interface LXMidiListener
    • controlChangeReceived

      public void controlChangeReceived(MidiControlChange cc)
      Specified by:
      controlChangeReceived in interface LXMidiListener
    • programChangeReceived

      public void programChangeReceived(MidiProgramChange pc)
      Specified by:
      programChangeReceived in interface LXMidiListener
    • pitchBendReceived

      public void pitchBendReceived(MidiPitchBend pitchBend)
      Specified by:
      pitchBendReceived in interface LXMidiListener
    • aftertouchReceived

      public void aftertouchReceived(MidiAftertouch aftertouch)
      Specified by:
      aftertouchReceived in interface LXMidiListener
    • sysexReceived

      public void sysexReceived(LXSysexMessage sysex)
      Specified by:
      sysexReceived in interface LXMidiListener
    • dispose

      public void dispose()
      Description copied from class: LXComponent
      Invoked when a component is being removed from the system and will no longer be used at all. This unregisters the component and should free up any resources and parameter listeners. Ideally after this method is called the object should be eligible for garbage collection. Subclasses are generally expected to override this method to handle their particular cleanup work. They should also generally call super.dispose() at the appropriate time to perform the basic cleanup, which may need to happen either before or after cleaning up other objects.
      Overrides:
      dispose in class LXComponent