PianoRollSession

A live editing session over one MIDI clip. Owned by the model — obtain one with AppModel.openPianoRollSession and release it with AppModel.closePianoRollSession.

Inheritors

AndroidPianoRollSession
JsPianoRollSession
JvmPianoRollSession
NativePianoRollSession
WasmJsPianoRollSession

Properties

Link copied to clipboard
abstract val clipboardCount: Int
Link copied to clipboard
abstract val durationSeconds: Double
Link copied to clipboard
abstract val error: String

Empty when the last edit succeeded.

Link copied to clipboard
abstract var focusedNote: Int

The note the detail editor is on, or -1.

Link copied to clipboard
abstract val isDirty: Boolean
Link copied to clipboard
abstract val maxNote: Int
Link copied to clipboard
abstract val minNote: Int
Link copied to clipboard
abstract val notes: List<PianoRollNote>
Link copied to clipboard
abstract val selectedNoteCount: Int

Functions

Link copied to clipboard
abstract fun beginDrag()

A move drag works from the notes as they were when it began, so each update re-applies one delta rather than accumulating rounding. The session holds that snapshot: say when the drag starts, how far it has moved, and whether it ended or was cancelled.

Link copied to clipboard
abstract fun cancelDrag()
Link copied to clipboard
abstract fun commit(app: AppModel): Boolean

Writes the session back to the clip, through the undo history.

Link copied to clipboard
abstract fun createNote(startSeconds: Double, durationSeconds: Double, note: Int, velocity: Float)
Link copied to clipboard
abstract fun deleteNote(index: Int)
Link copied to clipboard
abstract fun finishDrag(index: Int, originalStart: Double, originalEnd: Double, originalNote: Int)
Link copied to clipboard
abstract fun isNoteSelected(index: Int): Boolean
Link copied to clipboard
abstract fun loadNotes(snapshot: PianoRollSnapshot?)
Link copied to clipboard
abstract fun matchesSource(snapshot: PianoRollSnapshot): Boolean

Whether this session was built from that snapshot's UMP stream. False means the clip changed underneath and the session must be reloaded — which is what stops an edit being applied to a clip it was not made against.

Link copied to clipboard
abstract fun moveSelection(timeDeltaSeconds: Double, pitchDelta: Int)
Link copied to clipboard
abstract fun performAction(action: PianoRollAction, pasteSeconds: Double = 0.0)
Link copied to clipboard
abstract fun resizeNote(index: Int, startSeconds: Double, durationSeconds: Double, note: Int)
Link copied to clipboard
abstract fun selectNote(index: Int, additive: Boolean = false, toggle: Boolean = false)

index -1 clears the selection.