Package heronarts.lx.midi
Class LXMidiEngine
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.midi.LXMidiEngine
- All Implemented Interfaces:
LXPath
,LXSerializable
,LXOscComponent
,LXParameterListener
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static interface
static interface
Nested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Hidden, LXComponent.Placeholder, LXComponent.Renamable
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
Modifier and TypeFieldDescriptionfinal BooleanParameter
final DiscreteParameter
final ObjectParameter<Integer>
final List<LXMidiInput>
final List<LXMidiMapping>
final List<LXMidiOutput>
final List<LXMidiSurface>
Fields inherited from class heronarts.lx.LXComponent
children, internalParameters, KEY_CHILDREN, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_INTERNAL, KEY_PARAMETER_PATH, KEY_PARAMETERS, KEY_PATH, KEY_RESET, label, legacyInternalParameters, legacyParameters, lx, modulationColor, modulationControlsExpanded, modulationsExpanded, parameters, presetFile
Fields inherited from interface heronarts.lx.LXPath
ROOT, ROOT_PREFIX, ROOT_SLASH
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDeviceListener
(LXMidiEngine.DeviceListener listener) addListener
(LXMidiListener listener) addMapping
(LXMidiMapping mapping) void
dispatch()
Invoked by the main engine to dispatch all midi messages on the input queue.void
dispatch
(LXShortMessage message) void
dispose()
Invoked when a component is being removed from the system and will no longer be used at all.void
static final void
static final void
findInput
(MidiDevice device) findMappings
(LXComponent component) findOutput
(String name) findOutput
(MidiDevice device) findSurface
(LXMidiInput input) findSurface
(String name) findSurface
(String name, int index) static String
getDeviceName
(MidiDevice.Info deviceInfo) boolean
handleOscMessage
(OscMessage message, String[] parts, int index) Handles an OSC message sent to this component.void
void
load
(LX lx, JsonObject object) Loads the LX component.static final void
matchInput
(String name) matchInput
(String[] names) matchOutput
(String name) matchOutput
(String[] names) registerSurface
(String deviceName, Class<? extends LXMidiSurface> surfaceClass) removeListener
(LXMidiListener listener) removeMapping
(LXMidiMapping mapping) Removes a midi mappingremoveMappings
(LXComponent component) Called when a component is disposed.removeParameterMappings
(LXParameter parameter) Called when an individual parameter is disposed.void
save
(LX lx, JsonObject object) Serializes the LX component.void
Executes the given code only after the MIDI engine initialization is done.Methods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, contains, copyParameters, getCategory, getChild, getComponentName, getComponentName, getComponentName, getDescription, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, getPath, hasParameter, isValidOscParameter, loadParameters, loadPreset, onParameterChanged, 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.osc.LXOscComponent
getOscAddress
Methods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
inputs
-
outputs
-
surfaces
-
mappings
-
computerKeyboardEnabled
-
computerKeyboardOctave
-
computerKeyboardVelocity
-
-
Constructor Details
-
LXMidiEngine
-
-
Method Details
-
registerSurface
-
initialize
public void initialize() -
disposeSurfaces
public void disposeSurfaces() -
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
-
getDeviceName
-
whenReady
Executes the given code only after the MIDI engine initialization is done. If it's done, then this will be run immediately on the thread that called it. If it is not done, then this will be run later on the LX engine thread in the sequential order of all calls made to whenReady- Parameters:
runnable
- Code to run when MIDI engine is ready
-
getInputs
-
getOutputs
-
matchInput
-
matchInput
-
matchOutput
-
matchOutput
-
findSurface
-
findSurface
-
findSurface
-
findOutput
-
findOutput
-
findInput
-
findInput
-
addListener
-
removeListener
-
addDeviceListener
-
removeDeviceListener
-
addMappingListener
-
removeMappingListener
-
handleOscMessage
Description copied from class:LXComponent
Handles an OSC message sent to this component. By default this method handles registered components and parameters, but subclasses may override this method to handle different types of OSC messages.- Specified by:
handleOscMessage
in interfaceLXOscComponent
- Overrides:
handleOscMessage
in classLXComponent
- Parameters:
message
- Full OSC message objectparts
- The OSC address pattern, broken into an array of partsindex
- Which index into the parts array corresponds to this component's children- Returns:
true
if the OSC message was handled and should be considered consumed,false
otherwise
-
addMapping
-
removeMapping
Removes a midi mapping- Parameters:
mapping
- The mapping to remove- Returns:
- this
-
findMappings
-
removeParameterMappings
Called when an individual parameter is disposed. Remove any midi mappings pointing to the now-nonexistent parameter.- Parameters:
parameter
- Parameter that doesn't exist anymore- Returns:
- this
-
removeMappings
Called when a component is disposed. Remove any midi mappings pointing to the now-nonexistent component.- Parameters:
component
- Component to remove any midi mappings from- Returns:
- this
-
dispatch
public void dispatch()Invoked by the main engine to dispatch all midi messages on the input queue. -
dispatch
-
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 instanceobject
- Object to serialize into
-
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 instanceobject
- Object to deserialize
-
log
-
error
-
error
-