Phase 34: add snap grids, MIDI velocity editing and track instrument menus

This commit is contained in:
Johannes Findeisen 2026-10-28 10:08:13 +01:00
commit 4873b70672
14 changed files with 481 additions and 29 deletions

View file

@ -167,3 +167,15 @@ Do not unload/replace modules during playback; candidate plans are prepared off
the callback and old instances are reclaimed on the control thread. Missing
references remain inspectable without loading; failed GUI preparation retains
the current project. Save a backup for applications limited to v11 or earlier.
## Phase 34 note dynamics and clip editing
Double-click a MIDI clip to open its piano roll. The Note velocity slider and
fixed Velocity lane edit individual notes from 1 to 127, preserving timing,
pitch and channel. Chord notes at the same start can be selected individually in
the keys before editing their highlighted bar. Completed gestures are undoable
and save in the existing note velocity field. Velocity is not a separate dB
volume stage: the built-in sine scales amplitude, while plugins choose their
own patch-dependent response. The track header instrument dropdown reuses saved
project instruments or opens explicit loading; bus tracks cannot host instruments.
See WORKSPACE.md for grid/snap divisions, filters and control behavior.

View file

@ -68,3 +68,9 @@ previews. New MIDI/audio track commands are undoable and prepare candidates
before adoption. The default window is 1280 × 800, minimum 1220 × 720.
No dependency or project-format change. See WORKSPACE.md and the new
`modern-session.xtc` example; existing engine/plugin limitations still apply.
Phase 34 adds a sequencer grid/Snap dropdown, absolute grid snapping for moves
and trims, MIDI double-click editing, a piano velocity lane/slider and per-track
instrument dropdowns. Snap preferences are UI state; velocity and instrument
bindings use the existing v12 format. No new dependency or engine feature is
required. See WORKSPACE.md for supported divisions, controller semantics and limits.

View file

@ -960,6 +960,35 @@ See WORKSPACE.md for the workflow, tests and limits.
---
## Phase 34 — Grid, Clip Editing and Track Instrument Controls
### Goal
Expose common DAW editing actions directly in the flat workspace: selectable
snap, MIDI clip double-click, individual note velocity and track instruments.
### Tasks and acceptance criteria
- [x] Draw bar/beat/subdivision grid lines and expose a sequencer Snap dropdown.
- [x] Offer Off, straight, triplet, half-note and bar divisions; synchronize the existing snap menu.
- [x] Snap clip moves and both trim edges to absolute grid positions, including off-grid clips.
- [x] Open the selected MIDI clip's piano roll on left-button double-click without moving it.
- [x] Add a fixed velocity lane and selected-note slider with 1..127 validation and one undo step per edit.
- [x] Keep coincident chord notes individually editable and preserve timing/pitch/channel.
- [x] Add a dropdown to every non-bus track for built-in sine, project instruments and explicit plugin loading.
- [x] Preserve track identity through reorder, undo, clear and project reload; retain candidate failure rollback.
- [x] Keep controls flat, retain current project format and verify builds, GUI regressions and releases.
### Implementation status
Implemented in the C++ GUI over existing C model APIs. Snap preferences are
session UI state; note velocity and track instruments already persist in v12.
The project instrument list is built from existing assignments, with Load plugin
for other trusted binaries; automatic disk scanning is not introduced.
At low zoom the visual grid coarsens for readability while snap remains exact to
the selected tick division. Off uses pointer/model tick precision. MIDI velocity
is a performance value, not a per-note dB gain stage; third-party instrument
patches control its audible response. See WORKSPACE.md and MIDI.md.
---
## Recommended Execution Order
Reorder the phases when the audit reveals a blocking dependency. Do not mark a phase complete merely because code exists: its acceptance criteria must be demonstrated by builds, tests, or documented manual verification.

View file

@ -206,3 +206,8 @@ The flat workspace puts New MIDI/audio track, WAV import and instrument loading
in a persistent sidebar, with a musical transport display and selected-track
overview. See [WORKSPACE.md](WORKSPACE.md) for shortcuts and workflow. Open
`modern-session.xtc` in the installed examples for an original four-track arrangement.
Phase 34: use the sequencer Snap dropdown for straight/triplet/bar grids or Off.
Double-click MIDI clips to edit notes, then use the Velocity lane or selected-note
slider for dynamics. Each non-bus track header has an instrument dropdown offering
built-in sine, project instruments and explicit plugin loading. See WORKSPACE.md.

View file

@ -55,3 +55,47 @@ and workflow tests cover the retained commands. A modern presentation does not
add commercial-DAW features: detachable/resizable docks, mixer channel strips,
automatic plugin scanning, custom plugin editors and new audio/MIDI features
remain outside this phase. Existing plugin and engine limits still apply.
## Phase 34 editing controls
The **Snap** dropdown above the sequencer selects Off, 1/32, 1/16 triplet,
1/16, 1/8 triplet, 1/8, 1/4, 1/2 or one bar. Existing View/Snap commands update
the same preference. Bar lines are strongest, beats medium, subdivisions subtle.
At low zoom closely spaced lines are coarsened to at least six pixels; snapping
still uses the selected division. Clip moves and trim boundaries snap to the
nearest absolute grid position (halfway rounds forward), including clips that
start off the grid. Off removes musical quantization; pointer resolution and
integer model ticks still apply. Invalid trims retain the original clip.
Snap is a UI preference, not a project edit or a saved project setting.
Double-click a MIDI clip with the left mouse button to open its piano roll.
The clip is selected and the click does not move/trim it. Audio/silent clips
retain their existing selection/drag behavior. The piano roll also has a Snap
dropdown for its existing note grid; sequencer and piano snap remain independent.
The piano roll has a fixed **Velocity** lane beneath the keys and a **Note
velocity** slider. Select a note, then drag its bar vertically or release the
slider at a value from 1 to 127. Only that note changes; pitch, timing, length,
channel and other notes stay intact. One completed drag/slider edit is one undo
step; Escape cancels a lane drag. For chord notes sharing a start time, select
the desired note in the keys first; its highlighted velocity bar and slider
remain individually editable. Horizontal scrolling aligns the lane with note
starts; vertical scrolling moves the keys while the lane stays available.
Filters apply to lane visibility and selection. Values save with existing note
metadata and affect built-in synthesis; plugin patches determine velocity response.
This is MIDI velocity, not a per-note audio gain or loudness meter.
Every ordinary track header has an instrument dropdown. Choose **Built-in sine**,
an instrument already assigned elsewhere in the project, or **Load plugin...**
for a trusted CLAP/VST2/VST3 binary. Entries show the format and plugin label.
Each assignment creates an independent track instance, selects that track for
live MIDI and remains undoable; clear/reorder/reopen use stable track IDs. Bus
tracks show their bus label instead. Cancel or failed preparation restores the
model's selection in the dropdown. The list is project-local, not a scanner or
installed-plugin database. Existing mono/default-configuration host limits apply.
Instrument changes stop/reprepare playback and are refused while recording.
Verification includes off-grid move/trim, snap Off, dropdown labels, double-click,
coincident notes, per-note slider/lane edits, invalid velocities, undo/reload and
instrument reuse/clear/reorder for all three fixture formats. Manual checks use
the original modern-session example and the flat sequencer/piano windows.