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
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic interfacestatic interfacestatic interfaceNested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Description, LXComponent.Hidden, LXComponent.Name, LXComponent.Placeholder, LXComponent.PluginRequired, LXComponent.RenamableNested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal DiscreteParameterfinal BooleanParameterfinal DiscreteParameterfinal ObjectParameter<Integer> final List<LXMidiInput> final List<LXMidiMapping> final List<LXMidiOutput> final List<LXMidiSurface> static final Stringfinal List<LXMidiTemplate> Fields inherited from class heronarts.lx.LXComponent
childArrays, 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, presetFileFields inherited from interface heronarts.lx.LXPath
DEFAULT_SEPARATOR, ROOT, ROOT_PREFIX, ROOT_SLASH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDeviceListener(LXMidiEngine.DeviceListener listener) addListener(LXMidiListener listener) addMapping(LXMidiMapping mapping) addSurface(LXMidiSurface surface) addSurface(Class<? extends LXMidiSurface> surfaceClass) Add an instance of the given midi surface class typevoidaddTemplate(LXMidiTemplate template) voiddispatch()Invoked by the main engine to dispatch all midi messages on the input queue.voiddispatch(LXShortMessage message) voiddispose()Invoked when a component is being removed from the system and will no longer be used at all.voidstatic final voidstatic final voidvoidexportMappings(File file) findInput(MidiDevice device) findMappings(LXComponent component) findOutput(String name) findOutput(MidiDevice device) findSurface(LXMidiInput input) findSurface(String deviceName) findSurface(String deviceName, int index) findSurfaceClass(String className, int index) static StringgetDeviceName(MidiDevice.Info deviceInfo) List<Class<? extends LXMidiSurface>> List<Class<? extends LXMidiTemplate>> booleanhandleOscMessage(OscMessage message, String[] parts, int index) Handles an OSC message sent to this component.importMappings(File file) void<T extends LXMidiSurface>
TinstantiateSurface(Class<T> surfaceClass, LXMidiInput input, LXMidiOutput output) Instantiate a MIDI surface of the given classvoidload(LX lx, JsonObject object) Loads the LX component.voidloadMappings(LX lx, JsonObject obj) static final voidmatchInput(String name) matchInput(String[] names) matchOutput(String name) matchOutput(String[] names) voidmoveTemplate(LXMidiTemplate template, int index) voidpanic()registerSurface(Class<? extends LXMidiSurface> surfaceClass) Registers a new MIDI surface implementation with the MIDI engineregisterSurface(String deviceName, Class<? extends LXMidiSurface> surfaceClass) Deprecated.voidregisterTemplate(Class<? extends LXMidiTemplate> templateClass) removeListener(LXMidiListener listener) removeMapping(LXMidiMapping mapping) Removes a midi mappingvoidremoveMappings(LXComponent component) Called when a component is disposed.removeParameterMappings(LXParameter parameter) Called when an individual parameter is disposed.removeSurface(LXMidiSurface surface) voidremoveTemplate(LXMidiTemplate template) voidsave(LX lx, JsonObject object) Serializes the LX component.voidvoidExecutes 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, assertDisposed, contains, copyParameters, getCategory, getChild, getComponentDescription, 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface heronarts.lx.osc.LXOscComponent
getOscAddressMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
TEMPLATE_PATH
- See Also:
-
inputs
-
outputs
-
surfaces
-
templates
-
mappings
-
computerKeyboardEnabled
-
computerKeyboardOctave
-
computerKeyboardVelocity
-
computerKeyboardChannel
-
-
Constructor Details
-
LXMidiEngine
-
-
Method Details
-
registerTemplate
-
getRegisteredTemplateClasses
-
registerSurface
@Deprecated public LXMidiEngine registerSurface(String deviceName, Class<? extends LXMidiSurface> surfaceClass) Deprecated. -
registerSurface
Registers a new MIDI surface implementation with the MIDI engine- Parameters:
surfaceClass- MIDI surface class name- Returns:
- this
-
getRegisteredSurfaceClasses
-
initialize
public void initialize() -
disposeSurfaces
public void disposeSurfaces() -
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
-
getDeviceName
-
addSurface
-
removeSurface
-
instantiateSurface
public <T extends LXMidiSurface> T instantiateSurface(Class<T> surfaceClass, LXMidiInput input, LXMidiOutput output) Instantiate a MIDI surface of the given class- Type Parameters:
T- MIDI surface class type- Parameters:
surfaceClass- Class- Returns:
- Surface instance
-
addSurface
Add an instance of the given midi surface class type- Parameters:
surfaceClass- Midi surface class- Returns:
- this
-
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
-
findSurfaceClass
-
findOutput
-
findOutput
-
findInput
-
findInput
-
findInput
-
addListener
-
removeListener
-
addDeviceListener
-
removeDeviceListener
-
addTemplateListener
-
removeTemplateListener
-
addMappingListener
-
removeMappingListener
-
handleOscMessage
Description copied from class:LXComponentHandles 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:
handleOscMessagein interfaceLXOscComponent- Overrides:
handleOscMessagein 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:
trueif the OSC message was handled and should be considered consumed,falseotherwise
-
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
-
addTemplate
-
removeTemplate
-
moveTemplate
-
panic
public void panic() -
saveDevices
public void saveDevices() -
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 instanceobject- Object to serialize into
-
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 instanceobject- Object to deserialize
-
loadMappings
-
removeMappings
public void removeMappings() -
exportMappings
-
importMappings
-
log
-
error
-
error
-