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 enum
class
static interface
Nested classes/interfaces inherited from class heronarts.lx.LXComponent
LXComponent.Description, LXComponent.Hidden, LXComponent.Name, LXComponent.Placeholder, LXComponent.PluginRequired, LXComponent.Renamable
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal BooleanParameter
final LXBus
final EnumParameter
<LXClip.ClipView> final Cursor
Current playback/recording cursor for the clipfinal BooleanParameter
static final String
final List
<LXClipLane<?>> Launches the clip, including both snapshot recall and automation playbackLaunches the clip's automation playback, if there is anyfinal Cursor
Cursor holding position next launch operation, if a custom launch position was setfinal LXClip.CursorParameter
final BooleanParameter
final LXClip.CursorParameter
final LXClip.CursorParameter
final LXClip.CursorParameter
protected final List
<LXClipLane<?>> final LXClip.CursorParameter
final LXClip.CursorParameter
final BoundedParameter
final LXClipSnapshot
final BooleanParameter
final BooleanParameter
Stop playback of the clipfinal EnumParameter
<Cursor.TimeBase> final MutableParameter
Fields inherited from class heronarts.lx.LXRunnableComponent
runMs, running, trigger
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, presetFile
Fields 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.Operator
CursorOp()
void
dispose()
Invoked when a component is being removed from the system and will no longer be used at all.void
effectAdded
(LXBus channel, LXEffect effect) void
effectMoved
(LXBus channel, LXEffect effect) void
effectRemoved
(LXBus channel, LXEffect effect) findClipLanes
(LXComponent component) int
getIndex()
double
getPath()
Accessor for the path of this object.boolean
isArmed()
Whether the clip is armed for recordingboolean
boolean
boolean
Whether 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 positionvoid
load
(LX lx, JsonObject obj) Loads the LX component.protected void
loadLane
(LX lx, String laneType, JsonObject laneObj) moveClipLane
(LXClipLane<?> lane, int index) void
Subclasses are free to override this if desired.protected final void
onStart()
Start from a stopped state, e.g.protected void
onStartRecording
(boolean isOverdub) Subclasses may overrideprotected final void
onStop()
Stop from a rec/play state, fires when this.running has transitioned true -> falseprotected void
Subclasses may overrideprotected void
Subclasses may overrideprotected final void
Optional 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 void
registerComponent
(LXComponent component) protected void
removeListener
(LXClip.Listener listener) protected void
run
(double deltaMs) void
save
(LX lx, JsonObject obj) Serializes the LX component.protected void
Move the cursor and notify listenersprotected void
setCursor
(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 void
unregisterComponent
(LXComponent component) protected void
Methods inherited from class heronarts.lx.LXRunnableComponent
isRunning, loop, onReset, postRun, reset, start, stop, toggle, trigger
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, 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.osc.LXOscComponent
getOscAddress, handleOscMessage
Methods 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:LXComponent
Accessor 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:
getPath
in interfaceLXPath
- Overrides:
getPath
in classLXComponent
- Returns:
- path of this component relative to its parent
-
onTrigger
protected final void onTrigger()Description copied from class:LXRunnableComponent
Optional subclass method when trigger is fired, called before onReset and onStart- Overrides:
onTrigger
in classLXRunnableComponent
-
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
-
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: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 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:
onStart
in classLXRunnableComponent
-
onStop
protected final void onStop()Stop from a rec/play state, fires when this.running has transitioned true -> false- Overrides:
onStop
in 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:
run
in classLXRunnableComponent
-
effectAdded
- Specified by:
effectAdded
in interfaceLXBus.Listener
-
effectRemoved
- Specified by:
effectRemoved
in interfaceLXBus.Listener
-
effectMoved
- Specified by:
effectMoved
in 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: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
-
addParameterLane
-
loadLane
-
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
-