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 interface
Marker interface for Midi Surface implementations which require an output to be functional.static @interface
static @interface
Nested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Description, LXComponent.Hidden, LXComponent.Placeholder, LXComponent.PluginRequired, LXComponent.Renamable
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BooleanParameter
final BooleanParameter
static final String
static final String
static final String
static final String
protected final LX
protected final LXParameter.Collection
protected final LXParameter.Collection
final 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, presetFile
Fields inherited from interface heronarts.lx.LXPath
DEFAULT_SEPARATOR, ROOT, ROOT_PREFIX, ROOT_SLASH
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LXMidiSurface
(LX lx, LXMidiInput input, LXMidiOutput output) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addSetting
(String key, LXListenableParameter setting) protected void
addState
(String key, LXListenableParameter state) void
aftertouchReceived
(MidiAftertouch aftertouch) void
void
dispose()
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 String
getDeviceName
(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 serviceint
int
Gets the user-facing name of this surface classstatic String
getSurfaceName
(Class<? extends LXMidiSurface> clazz) Gets the name of a midi surface to be presented to the userboolean
boolean
void
load
(LX lx, JsonObject obj) Loads the LX component.boolean
matches
(JsonObject surface) void
noteOffReceived
(MidiNote note) void
noteOnReceived
(MidiNoteOn note) protected void
onEnable
(boolean isOn) Subclasses may override, invoked automatically when surface is enabled/disabled.void
Subclasses are free to override this if desired.protected void
Subclasses may override, invoked when the control surface was disconnected but has now reconnected, while still being in the enabled state.void
pitchBendReceived
(MidiPitchBend pitchBend) void
void
save
(LX lx, JsonObject obj) Serializes the LX component.protected void
sendControlChange
(int channel, int cc, int value) protected void
sendNoteOn
(int channel, int note, int velocity) protected void
sendSysex
(byte[] sysex) void
sysexReceived
(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, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface heronarts.lx.midi.LXMidiListener
midiPanicReceived
Methods 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: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 interfaceLXParameterListener
- Overrides:
onParameterChanged
in 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: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 interfaceLXSerializable
- Overrides:
load
in classLXComponent
- Parameters:
lx
- LX instanceobj
- Object to deserialize
-
save
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 callsuper.save(lx, obj)
at the appropriate time.- Specified by:
save
in interfaceLXSerializable
- Overrides:
save
in classLXComponent
- Parameters:
lx
- LX instanceobj
- Object to serialize into
-
matches
-
noteOnReceived
- Specified by:
noteOnReceived
in interfaceLXMidiListener
-
noteOffReceived
- Specified by:
noteOffReceived
in interfaceLXMidiListener
-
controlChangeReceived
- Specified by:
controlChangeReceived
in interfaceLXMidiListener
-
programChangeReceived
- Specified by:
programChangeReceived
in interfaceLXMidiListener
-
pitchBendReceived
- Specified by:
pitchBendReceived
in interfaceLXMidiListener
-
aftertouchReceived
- Specified by:
aftertouchReceived
in interfaceLXMidiListener
-
sysexReceived
- Specified by:
sysexReceived
in interfaceLXMidiListener
-
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 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:
dispose
in classLXComponent
-