Skip to content

feat(player): exact timestamp input for loop start/end (#246) - #252

Merged
thcp merged 2 commits into
mainfrom
feat/loop-timestamp-input
Jul 10, 2026
Merged

feat(player): exact timestamp input for loop start/end (#246)#252
thcp merged 2 commits into
mainfrom
feat/loop-timestamp-input

Conversation

@thcp

@thcp thcp commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Closes #246.

What

Two editable timestamp fields in the transport footer (right of the loop button) for setting the loop region precisely, additive to the existing drag/click select. Fields display mm:ss.mmm and accept either mm:ss.mmm or plain decimal seconds.

Changes

  • utils.js: fmtTimeMs (integer-ms math, no rounding carry) + parseTimecode (mm:ss.mmm or plain seconds, null on invalid).
  • index.html / daw.css: the two inputs inline in .footer-transport, styled to match the footer.
  • state.js: element refs.
  • transport.js: syncLoopInputs keeps the fields live on drag/toggle (never clobbering a field being edited, disabled when no track loaded); commitLoopInput parses, clamps to [0, totalDuration], enforces MIN_LOOP_SEC ordering, then updates the loop via the existing setters + updateLoopRegionVisual. Enter/blur commit, Escape reverts, invalid reverts in place.
  • player.js: refresh loop UI on track load so the inputs enable + reset once duration is known.

Values flow through the existing setLoopStart/setLoopEnd + audioEngine.setLoop, so the loop model and engine are unchanged.

Testing

  • node --check on all edited JS: pass.
  • Pure-helper sanity checks (formatting carry, negatives/Infinity, all parse forms + invalids): pass.
  • Headless-Chrome load: app renders with the inputs present (module graph loads without error).
  • Interactive behavior (type -> region moves + audio loops; drag updates fields; clamping/ordering rejection; Escape revert) still needs a manual pass in-app with a loaded track.

Known limitation (unchanged from today)

Looping is a no-op on the streaming chunkedAudioEngine (LAN path): fields + visual region update, but audio won't audibly loop there, same as drag-select today.

thcp added 2 commits July 6, 2026 23:56
Add two editable timestamp fields in the transport footer for setting the
loop region precisely, alongside the existing drag/click select. Fields
display mm:ss.mmm and accept either mm:ss.mmm or plain decimal seconds.

- utils.js: fmtTimeMs (integer-ms math, no rounding carry) and parseTimecode
  (mm:ss.mmm or plain seconds, null on invalid).
- transport.js: syncLoopInputs keeps the fields in sync on drag/toggle
  (never clobbering a field being edited, disabled when no track loaded);
  commitLoopInput parses, clamps to [0, totalDuration], enforces the
  MIN_LOOP_SEC ordering, then updates the loop via the existing setters +
  updateLoopRegionVisual. Enter/blur commit, Escape reverts. Invalid input
  reverts the field in place (showError belongs to the import form).
- player.js: refresh loop UI on track load so the inputs enable + reset once
  the duration is known.

Values flow through the existing loopStart/loopEnd setters and
audioEngine.setLoop, so the model and engine are unchanged.
Move the exact loop start/end fields inline into .footer-transport, directly
after the loop button, instead of a separate row below the time readout.
Drop the redundant LOOP label now that the fields sit next to the loop control.
@thcp
thcp marked this pull request as ready for review July 10, 2026 19:40
@thcp
thcp merged commit 2ea6748 into main Jul 10, 2026
8 checks passed
@thcp
thcp deleted the feat/loop-timestamp-input branch July 28, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Exact timestamp input for loop start/end (manual seconds/milliseconds entry)

1 participant