Package heronarts.lx.clip
Class LXClipLane<T extends LXClipEvent<?>>
java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.clip.LXClipLane<T>
- All Implemented Interfaces:
LXPath
,LXSerializable
,LXParameterListener
- Direct Known Subclasses:
MidiNoteClipLane
,ParameterClipLane
,PatternClipLane
-
Nested Class Summary
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 LXClip
protected static final String
protected final LXEngineThreadArrayList
<T> final MutableParameter
protected boolean
final BooleanParameter
final MutableParameter
final BooleanParameter
protected static final String
protected static final String
protected static final String
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 TypeMethodDescriptionprotected void
_insertEvent
(T event) protected void
beginLoadEvents
(List<T> loadEvents) protected int
cursorInsertIndex
(Cursor cursor) protected int
cursorInsertIndex
(List<T> events, Cursor cursor) protected Cursor.Operator
CursorOp()
protected int
cursorPlayIndex
(Cursor cursor) protected int
cursorPlayIndex
(List<T> events, Cursor cursor) protected void
endLoadEvents
(List<T> loadEvents) int
eventIndex
(List<T> events, Cursor fromCursor, boolean inclusive) int
eventIndex
(List<T> events, Cursor fromCursor, boolean inclusive, int offset) eventIterator
(Cursor fromCursor) Gets an iterator over this clip lane's events, starting from the position specified by the cursor.eventIterator
(Cursor fromCursor, int offset) Gets an iterator over this clip lane's events, starting from the position specified by the cursor.eventIterator
(List<T> events, Cursor fromCursor, boolean inclusive) Gets an iterator over the the events beginning at a given cursor positioneventIterator
(List<T> events, Cursor fromCursor, int offset) Gets an iterator over this clip lane's events, starting from the position specified by the cursor.int
getIndex()
abstract String
getLabel()
Accessor for the user-facing label of this component.protected T
Gets the last event in the lane occurring at or before the time value of the current cursor position.protected T
getPreviousEvent
(Cursor cursor) Gets the last event occurring before this cursor insert position, if any.protected T
getPreviousEvent
(List<T> events, Cursor cursor) Gets the last event occurring before this cursor insert position, if any.insertEvent
(T event) void
load
(LX lx, JsonObject obj) Loads the LX component.protected abstract T
loadEvent
(LX lx, JsonObject eventObj) protected final LXClipLane
<T> recordEvent
(T event) removeEvent
(T event) Remove the given event from this clip laneremoveEvents
(List<Integer> eventIndices) Remove events at the given indices, which must be sorted ascendingboolean
removeRange
(Cursor from, Cursor to) protected boolean
removeRange
(Cursor from, Cursor to, boolean notify) protected void
reverseEvents
(List<T> events) void
save
(LX lx, JsonObject obj) Serializes the LX component.protected void
setEventNormalized
(T event, double value) void
setEventsCursors
(ArrayList<T> originalEvents, Cursor fromSelectionMin, Cursor fromSelectionMax, Cursor toSelectionMin, Cursor toSelectionMax, Map<T, Double> fromValues, Map<T, Cursor> fromCursors, Map<T, Cursor> toCursors, LXCommand.Clip.Event.SetCursors.Operation operation) Set the cursors for a set of events in a range.protected T
stitchInner
(List<T> events, Cursor cursor, int rightIndex, boolean isMin, boolean force) protected int
stitchInsertIfNeeded
(List<T> events, T stitch, boolean after) protected T
stitchOuter
(List<T> events, Cursor cursor, int rightIndex) protected boolean
stitchRemoveIfRedundant
(List<T> events, T stitch, int index) protected T
stitchSelectionMax
(List<T> originalEvents, List<T> modifiedEvents, Cursor selectionMax, int stitchIndex, boolean force) protected T
stitchSelectionMin
(List<T> originalEvents, List<T> modifiedEvents, Cursor selectionMin, int stitchIndex, boolean force) Methods inherited from class heronarts.lx.LXComponent
addArray, addChild, addInternalParameter, addLegacyInternalParameter, addLegacyParameter, addParameter, addParameter, addParameters, assertDisposed, contains, copyParameters, dispose, getCategory, getChild, getComponentDescription, getComponentName, getComponentName, getComponentName, getDescription, getId, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, getPath, handleOscMessage, 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.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
uiHeight
-
uiExpanded
-
uiMaximized
-
onChange
-
clip
-
overdubActive
protected boolean overdubActive -
mutableEvents
-
events
-
KEY_LANE_TYPE
- See Also:
-
VALUE_LANE_TYPE_PARAMETER
- See Also:
-
VALUE_LANE_TYPE_PATTERN
- See Also:
-
VALUE_LANE_TYPE_MIDI_NOTE
- See Also:
-
-
Constructor Details
-
LXClipLane
-
-
Method Details
-
CursorOp
-
getIndex
public int getIndex() -
recordEvent
-
getUIThreadEvents
-
eventIterator
Gets an iterator over this clip lane's events, starting from the position specified by the cursor. The iterator will start at the first event with time equal to or after that cursor.- Parameters:
fromCursor
- Cursor to begin iteration from (inclusive)- Returns:
- Iterator over events equal to or after the cursor
-
eventIterator
Gets an iterator over this clip lane's events, starting from the position specified by the cursor. The iterator will start at the first event with time equal to or after that cursor, with an offset specified in # of events- Parameters:
fromCursor
- Cursor to begin iteration from (inclusive)offset
- Offset the iterator by a number of events from the cursor- Returns:
- Iterator over events equal to or after the cursor, plus offset
-
eventIterator
Gets an iterator over this clip lane's events, starting from the position specified by the cursor. The iterator will start at the first event with time equal to or after that cursor, with an offset specified in # of events- Parameters:
events
- Event listfromCursor
- Cursor to begin iteration from (inclusive)offset
- Offset the iterator by a number of events from the cursor- Returns:
- Iterator over events equal to or after the cursor, plus offset
-
eventIterator
Gets an iterator over the the events beginning at a given cursor position- Parameters:
events
- Events to get an iterator forfromCursor
- Cursor to iterate frominclusive
- Whether to include events strictly at fromCursor- Returns:
- Iterator beginning at fromCursor
-
eventIndex
-
eventIndex
-
cursorPlayIndex
-
cursorInsertIndex
-
cursorPlayIndex
-
cursorInsertIndex
-
_insertEvent
-
insertEvent
-
moveEvent
-
getPreviousEvent
Gets the last event occurring before this cursor insert position, if any. Events already in the array with a cursor exactly equal to this cursor are considered to all be previous.- Parameters:
events
- List of eventscursor
- Cursor position- Returns:
- Last event with time equal to or less than this cursor
-
getPreviousEvent
Gets the last event occurring before this cursor insert position, if any. Events already in the array with a cursor exactly equal to this cursor are considered to all be previous.- Parameters:
cursor
- Cursor position- Returns:
- Last event with time equal to or less than this cursor
-
getPreviousEvent
Gets the last event in the lane occurring at or before the time value of the current cursor position.- Returns:
- Last event equal to or before this cursor position
-
setEventsCursors
public void setEventsCursors(ArrayList<T> originalEvents, Cursor fromSelectionMin, Cursor fromSelectionMax, Cursor toSelectionMin, Cursor toSelectionMax, Map<T, Double> fromValues, Map<T, Cursor> fromCursors, Map<T, Cursor> toCursors, LXCommand.Clip.Event.SetCursors.Operation operation) Set the cursors for a set of events in a range. This event will also destructively clobber any events that the new stretched selection range overlaps with (other than those strictly contained in the set of modified cursors).- Parameters:
originalEvents
- The original reference event list to modifyfromSelectionMin
- Original lower bound on selection rangefromSelectionMax
- Original upper bound on selection rangetoSelectionMin
- New lower bound on selection rangetoSelectionMax
- New upper bound on selection rangefromValues
- Ordered map of original event values, pre-modificationfromCursors
- Ordered map of original position of events pre-modificationtoCursors
- Ordered map of events to re-position from within the original rangeoperation
- What kind of modification operation this is
-
reverseEvents
-
setEventNormalized
-
stitchSelectionMin
-
stitchSelectionMax
-
stitchInner
-
stitchOuter
-
stitchInsertIfNeeded
-
stitchRemoveIfRedundant
-
getLabel
Description copied from class:LXComponent
Accessor for the user-facing label of this component. Objects that implement theLXComponent.Renamable
interface may allow the user to change this value.- Specified by:
getLabel
in interfaceLXPath
- Overrides:
getLabel
in classLXComponent
- Returns:
- Label for this component
-
removeRange
-
removeRange
-
removeEvent
Remove the given event from this clip lane- Parameters:
event
- Event to remove- Returns:
- this
-
removeEvents
Remove events at the given indices, which must be sorted ascending- Parameters:
eventIndices
- List of event indices to remove, sorted ascending- Returns:
- this
-
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
-
beginLoadEvents
-
endLoadEvents
-
loadEvent
-
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
-