Package heronarts.lx.midi.surface
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceMarker interface for Midi Surface implementations which require an output to be functional.static @interfacestatic @interfaceNested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Description, LXComponent.Hidden, LXComponent.Placeholder, LXComponent.PluginRequired, LXComponent.RenamableNested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BooleanParameterfinal BooleanParameterstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final LXprotected final LXParameter.Collectionprotected final LXParameter.Collectionfinal Map<String, LXParameter> final Map<String, LXParameter> Fields inherited from class heronarts.lx.LXComponent
childArrays, children, internalParameters, KEY_CHILDREN, KEY_COMPONENT_ID, KEY_ID, KEY_INTERNAL, KEY_PARAMETER_PATH, KEY_PARAMETERS, KEY_PATH, KEY_RESET, label, legacyInternalParameters, legacyParameters, modulationColor, modulationControlsExpanded, modulationsExpanded, parameters, presetFileFields inherited from interface heronarts.lx.LXPath
DEFAULT_SEPARATOR, ROOT, ROOT_PREFIX, ROOT_SLASH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLXMidiSurface(LX lx, LXMidiInput input, LXMidiOutput output) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddSetting(String key, LXListenableParameter setting) protected voidaddState(String key, LXListenableParameter state) voidaftertouchReceived(MidiAftertouch aftertouch) voidvoiddispose()Invoked when a component is being removed from the system and will no longer be used at all.Returns the default USB/MIDI driver name of the device for this surfacestatic StringgetDeviceName(Class<? extends LXMidiSurface> surfaceClass) getInput()Get the current MIDI input for this servicegetName()Deprecated.Replaced with the clearer getDeviceName()Get the current MIDI output for this serviceintintGets the user-facing name of this surface classstatic StringgetSurfaceName(Class<? extends LXMidiSurface> clazz) Gets the name of a midi surface to be presented to the userbooleanbooleanvoidload(LX lx, JsonObject obj) Loads the LX component.booleanmatches(JsonObject surface) voidnoteOffReceived(MidiNote note) voidnoteOnReceived(MidiNoteOn note) protected voidonEnable(boolean isOn) Subclasses may override, invoked automatically when surface is enabled/disabled.voidSubclasses are free to override this if desired.protected voidSubclasses may override, invoked when the control surface was disconnected but has now reconnected, while still being in the enabled state.voidpitchBendReceived(MidiPitchBend pitchBend) voidvoidsave(LX lx, JsonObject obj) Serializes the LX component.protected voidsendControlChange(int channel, int cc, int value) protected voidsendNoteOn(int channel, int note, int velocity) protected voidsendSysex(byte[] sysex) voidsysexReceived(LXSysexMessage sysex) Methods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, assertDisposed, contains, copyParameters, getCategory, getChild, getComponentDescription, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, getPath, handleOscMessage, hasParameter, isValidOscParameter, loadParameters, loadPreset, removeParameter, removeParameter, removeParameter, removeParameter, savePreset, setDescription, setParent, toOscQuery, toOscQuery, toOscQuery, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface heronarts.lx.midi.LXMidiListener
midiPanicReceivedMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
lx
-
sourceDevice
-
destinationDevice
-
enabled
-
connected
-
mutableSettings
-
settings
-
mutableState
-
state
-
KEY_CLASS
- See Also:
-
KEY_NAME
- See Also:
-
KEY_SETTINGS
- See Also:
-
KEY_STATE
- See Also:
-
-
Constructor Details
-
LXMidiSurface
-
-
Method Details
-
setRememberFlag
-
hasRememberFlag
public boolean hasRememberFlag() -
initializeDefaultIO
-
onParameterChanged
Description copied from class:LXComponentSubclasses are free to override this if desired. It will automatically fire for any listenable parameter that is registered with this component.- Specified by:
onParameterChangedin interfaceLXParameterListener- Overrides:
onParameterChangedin classLXComponent- Parameters:
p- Parameter that has a value change
-
addSetting
-
addState
-
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
Returns the default USB/MIDI driver name of the device for this surface- Returns:
- Surface default USB/MIDI driver name
-
getDeviceName
-
getSurfaceName
Gets the user-facing name of this surface class- Returns:
- User-facing name of the MIDI surface
-
getSurfaceName
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
Get the current MIDI input for this service- Returns:
- MIDI input (or null)
-
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
Description copied from class:LXComponentLoads 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:
loadin interfaceLXSerializable- Overrides:
loadin classLXComponent- Parameters:
lx- LX instanceobj- Object to deserialize
-
save
Description copied from class:LXComponentSerializes 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 callsuper.save(lx, obj)at the appropriate time.- Specified by:
savein interfaceLXSerializable- Overrides:
savein classLXComponent- Parameters:
lx- LX instanceobj- Object to serialize into
-
matches
-
noteOnReceived
- Specified by:
noteOnReceivedin interfaceLXMidiListener
-
noteOffReceived
- Specified by:
noteOffReceivedin interfaceLXMidiListener
-
controlChangeReceived
- Specified by:
controlChangeReceivedin interfaceLXMidiListener
-
programChangeReceived
- Specified by:
programChangeReceivedin interfaceLXMidiListener
-
pitchBendReceived
- Specified by:
pitchBendReceivedin interfaceLXMidiListener
-
aftertouchReceived
- Specified by:
aftertouchReceivedin interfaceLXMidiListener
-
sysexReceived
- Specified by:
sysexReceivedin interfaceLXMidiListener
-
dispose
public void dispose()Description copied from class:LXComponentInvoked 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 callsuper.dispose()at the appropriate time to perform the basic cleanup, which may need to happen either before or after cleaning up other objects.- Overrides:
disposein classLXComponent
-