Package heronarts.lx.clip
Class LXClip
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.LXRunnableComponent
heronarts.lx.clip.LXClip
- All Implemented Interfaces:
LXComponent.Renamable,LXLoopTask,LXPath,LXSerializable,LXBus.Listener,LXOscComponent,LXParameterListener
- Direct Known Subclasses:
LXAbstractChannelClip,LXMasterClip
public abstract class LXClip
extends LXRunnableComponent
implements LXOscComponent, LXComponent.Renamable, LXBus.Listener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumclassstatic 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 BooleanParameterfinal LXBusfinal EnumParameter<LXClip.ClipView> final CursorCurrent playback/recording cursor for the clipfinal BooleanParameterstatic final Stringfinal List<LXClipLane<?>> Launches the clip, including both snapshot recall and automation playbackLaunches the clip's automation playback, if there is anyfinal CursorCursor holding position next launch operation, if a custom launch position was setfinal LXClip.CursorParameterfinal BooleanParameterfinal LXClip.CursorParameterfinal LXClip.CursorParameterfinal LXClip.CursorParameterprotected final List<LXClipLane<?>> final LXClip.CursorParameterfinal LXClip.CursorParameterfinal BoundedParameterfinal LXClipSnapshotfinal BooleanParameterfinal BooleanParameterStop playback of the clipfinal EnumParameter<Cursor.TimeBase> final MutableParameterFields inherited from class heronarts.lx.LXRunnableComponent
runMs, running, triggerFields 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 TypeMethodDescriptionaddListener(LXClip.Listener listener) addParameterLane(LX lx, JsonObject laneObj, int index) constructAbsoluteCursor(double millis) Constructs a cursor using absolute-timing, with the beat fields computed using the clip's reference BPMconstructTempoCursor(int beatCount, double beatBasis) Constructs a cursor using tempo-based timing with the millisecond value computed using the clip's reference BPMconstructTempoCursor(Tempo.Division division) Constructs a cursor using a tempo-division reference, with millisecond value computed using this clip's reference BPMConstructs a cursor from the global transport playback position, with millis computed using this clip's reference BPMfinal Cursor.OperatorCursorOp()voiddispose()Invoked when a component is being removed from the system and will no longer be used at all.voideffectAdded(LXBus channel, LXEffect effect) voideffectMoved(LXBus channel, LXEffect effect) voideffectRemoved(LXBus channel, LXEffect effect) findClipLanes(LXComponent component) intgetIndex()doublegetPath()Accessor for the path of this object.booleanisArmed()Whether the clip is armed for recordingbooleanbooleanbooleanWhether the clip is actively recording.launch()Launches the clip, subject to global launch quantization, which will also trigger recall of a snapshot if enabledLaunches clip automation playback, subject to global launch quantizationlaunchAutomationFrom(Cursor cursor) Launches the clip from a specified start position, subject to global launch quantization.Launches the clip from the current cursor positionvoidload(LX lx, JsonObject obj) Loads the LX component.protected voidloadLane(LX lx, String laneType, JsonObject laneObj) moveClipLane(LXClipLane<?> lane, int index) voidSubclasses are free to override this if desired.protected final voidonStart()Start from a stopped state, e.g.protected voidonStartRecording(boolean isOverdub) Subclasses may overrideprotected final voidonStop()Stop from a rec/play state, fires when this.running has transitioned true -> falseprotected voidSubclasses may overrideprotected voidSubclasses may overrideprotected final voidOptional subclass method when trigger is fired, called before onReset and onStartPlay clip from cursor position without quantization delay.Play clip from cursor position without quantization delay.protected voidregisterComponent(LXComponent component) protected voidremoveListener(LXClip.Listener listener) protected voidrun(double deltaMs) voidsave(LX lx, JsonObject obj) Serializes the LX component.protected voidMove the cursor and notify listenersprotected voidsetCursor(LXClip.CursorParameter timestamp) setIndex(int index) setLoopBrace(Cursor loopBrace) Safely set the loop brace to a position on the timeline (in time units)setLoopEnd(Cursor loopEnd) Safely set the loop end marker to a specific value (in time units)setLoopLength(Cursor loopLength) Set the loop lengthsetLoopStart(Cursor loopStart) Safely set the loop start marker to a specific value (in time units)setPlayEnd(Cursor playEnd) Safely set the play end marker to a specific value (in time units)setPlayStart(Cursor playStart) Safely set the play start marker to a specific value (in time units)snapLaunchQuantization(Cursor cursor) Snap a value to the global quantization settingsnapTempo(Cursor cursor, Tempo.Division division) Snap a value to a tempo divisiontriggerAction(boolean focus) Trigger the clip, whether from control surface or UItriggerAction(boolean focus, boolean fromGrid) Trigger the clip, whether from control surface or UIprotected voidunregisterComponent(LXComponent component) protected voidMethods inherited from class heronarts.lx.LXRunnableComponent
isRunning, loop, onReset, postRun, reset, start, stop, toggle, triggerMethods 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, 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.osc.LXOscComponent
getOscAddress, handleOscMessageMethods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
cursor
Current playback/recording cursor for the clip -
launchFromCursor
Cursor holding position next launch operation, if a custom launch position was set -
timeBase
-
length
-
loop
-
loopStart
-
loopEnd
-
loopLength
-
playStart
-
playEnd
-
launch
Launches the clip, including both snapshot recall and automation playback -
launchAutomation
Launches the clip's automation playback, if there is any -
stop
Stop playback of the clip -
mutableLanes
-
lanes
-
snapshotEnabled
-
snapshotTransitionEnabled
-
automationEnabled
-
customSnapshotTransition
-
referenceBpm
-
clipView
-
zoom
-
bus
-
snapshot
-
KEY_INDEX
- See Also:
-
-
Constructor Details
-
LXClip
-
LXClip
-
-
Method Details
-
CursorOp
-
getTimeBase
-
isPending
public boolean isPending() -
launch
Launches the clip, subject to global launch quantization, which will also trigger recall of a snapshot if enabled- Returns:
- this
-
launchAutomation
Launches clip automation playback, subject to global launch quantization- Returns:
- this
-
launchAutomationFrom
Launches the clip from a specified start position, subject to global launch quantization.- Parameters:
cursor- Position to launch from- Returns:
- this
-
launchAutomationFromCursor
Launches the clip from the current cursor position- Returns:
- this
-
playFrom
Play clip from cursor position without quantization delay. Does nothing if the clip is already running or if it has not been initialized.- Parameters:
cursor-- Returns:
- this
-
playFromCursor
Play clip from cursor position without quantization delay. Does nothing unless clip is not running.- Returns:
- this
-
triggerAction
Trigger the clip, whether from control surface or UI- Parameters:
focus- Whether to focus the clip- Returns:
- this
-
triggerAction
Trigger the clip, whether from control surface or UI- Parameters:
focus- Whether to focus the clipfromGrid- Whether this is a quantized grid launch- Returns:
- this
-
getPath
Description copied from class:LXComponentAccessor for the path of this object. Returns the path this component was registered with. Some subclasses may override this if path structure is dynamic.- Specified by:
getPathin interfaceLXPath- Overrides:
getPathin classLXComponent- Returns:
- path of this component relative to its parent
-
onTrigger
protected final void onTrigger()Description copied from class:LXRunnableComponentOptional subclass method when trigger is fired, called before onReset and onStart- Overrides:
onTriggerin classLXRunnableComponent
-
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
-
getLength
public double getLength() -
removeParameterLane
-
moveClipLane
-
addListener
-
removeListener
-
setCursor
-
setCursor
Move the cursor and notify listeners -
getCursor
-
isArmed
public boolean isArmed()Whether the clip is armed for recording -
isRecording
public boolean isRecording()Whether the clip is actively recording. -
isOverdub
public boolean isOverdub() -
setLoopStart
Safely set the loop start marker to a specific value (in time units)- Parameters:
loopStart- Cursor position on the timeline
-
setLoopBrace
Safely set the loop brace to a position on the timeline (in time units)- Parameters:
loopBrace- Cursor position on the timeline
-
setLoopEnd
Safely set the loop end marker to a specific value (in time units)- Parameters:
loopEnd- Cursor position on the timeline- Returns:
- this
-
setLoopLength
Set the loop length- Parameters:
loopLength- Loop length- Returns:
- this
-
setPlayStart
Safely set the play start marker to a specific value (in time units)- Parameters:
playStart- Cursor position on the timeline
-
setPlayEnd
Safely set the play end marker to a specific value (in time units)- Parameters:
playEnd- Cursor position on the timeline
-
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 classLXRunnableComponent- Parameters:
p- Parameter that has a value change
-
onStart
protected final void onStart()Start from a stopped state, e.g. this.running has transitioned false -> true- Overrides:
onStartin classLXRunnableComponent
-
onStop
protected final void onStop()Stop from a rec/play state, fires when this.running has transitioned true -> false- Overrides:
onStopin classLXRunnableComponent
-
onStartRecording
protected void onStartRecording(boolean isOverdub) Subclasses may override- Parameters:
isOverdub- Whether this was overdub recording
-
onStopRecording
protected void onStopRecording()Subclasses may override -
onStopPlayback
protected void onStopPlayback()Subclasses may override -
registerParameter
-
unregisterParameter
-
registerComponent
-
findClipLanes
-
unregisterComponent
-
getIndex
public int getIndex() -
setIndex
-
run
protected void run(double deltaMs) - Specified by:
runin classLXRunnableComponent
-
effectAdded
- Specified by:
effectAddedin interfaceLXBus.Listener
-
effectRemoved
- Specified by:
effectRemovedin interfaceLXBus.Listener
-
effectMoved
- Specified by:
effectMovedin interfaceLXBus.Listener
-
constructTransportCursor
Constructs a cursor from the global transport playback position, with millis computed using this clip's reference BPM- Returns:
- Cursor for given time division using clip's reference BPM
-
constructTempoCursor
Constructs a cursor using a tempo-division reference, with millisecond value computed using this clip's reference BPM- Parameters:
division- Tempo division- Returns:
- Cursor for given time division using clip's reference BPM
-
constructTempoCursor
Constructs a cursor using tempo-based timing with the millisecond value computed using the clip's reference BPM- Parameters:
beatCount- Beat countbeatBasis- Beat basis- Returns:
- Cursor for given time using clip's reference BPM
-
constructAbsoluteCursor
Constructs a cursor using absolute-timing, with the beat fields computed using the clip's reference BPM- Parameters:
millis- Absolute cursor time- Returns:
- Cursor for given time using clip's reference BPM
-
snapLaunchQuantization
Snap a value to the global quantization setting- Parameters:
cursor- Cursor to snap- Returns:
- Cursor with snapping applied
-
snapTempo
Snap a value to a tempo division- Parameters:
cursor- Value to snapdivision- Value will be rounded to the nearest multiple of this tempo division- Returns:
- Cursor with snapping applied
-
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
-
addParameterLane
-
loadLane
-
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
-