Commit Graph

268 Commits

Author SHA1 Message Date
3dtours ef891e9e04 fix: set selectionFollowsTempo based on which ruler is clicked
- Time Ruler click → setSelectionFollowsTempo(false) → time-based
- Tempo Track Lane click → setSelectionFollowsTempo(true) → tempo-based
- Also handles sub-tab ruler (EDITOR tabs)
- Manual toggle button ♪T/⏱T still works for override
2026-07-27 08:59:50 +07:00
3dtours 06480516eb fix: equal bar widths + selection tempo/time toggle
- WaveformLane bar grid: integer beat loop (bn*beatDuration) instead
  of accumulating t += beatDuration — no floating point drift
- Add selectionFollowsTempo toggle button (♪T/⏱T) in transport bar
- ♪T (tempo): selection recalculates with BPM
- ⏱T (time): selection fixed in seconds regardless of BPM
2026-07-27 08:53:42 +07:00
3dtours af6c77b9ee fix: add bar markers to TimelineRuler aligned with TempoTrackLane
- TimelineRuler draws bar lines at bn * barDuration positions
- Same integer beat loop as TempoTrackLane (bn from firstBarNum)
- Bar number labels at center of ruler
- Time markers still shown below bar markers
- All use same bpm prop → always aligned with tempo track
2026-07-27 08:41:36 +07:00
3dtours 3a84323dd8 fix: force canvas redraw after BPM duration recalculation 2026-07-27 08:36:14 +07:00
3dtours 3c12ce2a22 fix: range loop selection maintains bar count on BPM change
- Add prevBpmRef to track previous BPM
- BPM effect recalculates selectionStart/End using bar count
- startBar = oldStart / oldSecondsPerBar
- newStart = startBar * newSecondsPerBar (same for end)
2026-07-27 08:31:12 +07:00
3dtours f59cc304d4 fix: TempoTrackLane bar spacing drift with floating-point BPM
- Replace t += beatDuration loop (floating accumulation drifts)
- Iterate by integer beat number: t = bn * beatDuration
- Each bar position computed independently, no cumulative error
- Same fix for snapInterval loop
- Fixes unequal bar widths for BPM like 77, 81
2026-07-27 08:25:47 +07:00
3dtours cde29386d2 fix: TempoTrackLane bar spacing by removing broken DOM scrollLeft lookup
- DOM traversal for scrollLeft stops at sticky wrapper (scrollLeft=0)
- Use scrollLeft prop directly instead of traversing parent DOM
- Affects both TimelineRuler and TempoTrackLane canvas effects
- Bars now correctly space when BPM changes
2026-07-27 08:21:16 +07:00
3dtours ea5043c981 fix: auto-compute length_bars for legacy items on BPM change
- Items without length_bars: compute bars from duration/secondsPerBar
- Round to nearest quarter bar for musical accuracy
- Recalculate duration = bars * new secondsPerBar for all items
- Maintains correct bar count for both legacy and new items
2026-07-27 08:10:05 +07:00
3dtours d97f82e93f fix: maintain item duration in bars when BPM changes
- Add length_bars field to midiItems and sections at creation
- useEffect on bpm recalculates duration = length_bars * secondsPerBar
- Fix section creation: use secondsPerBar instead of hardcoded 4s
- Handle existing items without length_bars (no-op)
2026-07-27 08:03:02 +07:00
3dtours f98ade5d58 fix: context menu flips upward when near viewport bottom
- If click.y + 260 > window.innerHeight: position bottom instead of top
- Also clamp left to prevent right-edge overflow
- Menu now appears above the click point when there's no room below
2026-07-27 07:46:06 +07:00
3dtours 993610ca37 fix: AI items at playhead + context menu scrollable within viewport
- Revert AI item startTime to currentTime (playhead position)
- Context menu: maxHeight 60vh + overflow-y-auto, top clamped to
  window.innerHeight - 200 to prevent bottom clipping
- Same fix for both main session and sub-tab context menus
2026-07-27 07:42:01 +07:00
3dtours 1764fc29b5 fix: AI tracks auto-align to end of last existing item
- Replace currentTime with auto-calculated maxEnd from existing items
- Each AI generation starts right after the previous one
- Ensures tracks from different generations align in bar columns
2026-07-26 22:14:02 +07:00
3dtours 0f5f494173 fix: AI-generated tracks save synth_engine + pass to applyAITrackInstrument
- Build synth_engine object with type, plugin_id, soundfont_bank,
  soundfont_program, soundfont_id
- Save to targetTrack.synth_engine so schedulePianoRollMidi reads it
- Pass synthEngine as 3rd arg to applyAITrackInstrument (was missing)
- Remove redundant separate loadSoundFont call (applyAITrackInstrument
  chains to selectInstrument which already calls loadSoundFont)
2026-07-26 21:55:47 +07:00
3dtours 7bbe1f3be0 feat: sticky time ruler + tempo lane when scrolling tracks
- Wrap TimelineRuler + TempoTrackLane in sticky-top div
- Same sticky pattern for both main session and sub-tab views
- TCP column already has sticky header (top-0) and tempo row (top-10)
- Background color hides tracks scrolling behind ruler
2026-07-26 21:32:08 +07:00
3dtours bdaa5594bd feat: sync loop button with sub-tab + auto-derive loop boundaries
- Transport Loop button now syncs isLooping with active sub-tab
- Auto-computes loopEnd from midi notes, section clips, or audio duration
- Sub-tab selectionStart=0, selectionEnd=computed boundary on loop enable
- Main timeline also auto-derives loop end from track items/clips
- All three tab types: MAIN SESSION, SECTION-TAB, PIANO ROLL
2026-07-26 21:03:17 +07:00
3dtours 91e228ad6a fix: sfBank/sfProg ReferenceError — move declarations outside closure 2026-07-26 19:41:49 +07:00
3dtours 09231d9b21 fix: explicit selectInstrument for SpessaSynth bank+program routing
Per md/37_FIXVST3_SUGGEST.md:
- Add SonicSF.selectInstrument(channel, bank, program, sfId) method
- Always sends controllerChange(CC0, bank) + programChange(prog) to SpessaSynth
- _playNoteSpessa also sends CC32 (bank LSB) before programChange
- Remove default bank auto-load from init (cleaner startup)
- Fix syntax error (double }} from previous edit)
- playNote Spessa: use program arg + synthEngine bank/program properly
2026-07-26 19:37:29 +07:00
3dtours e843f55483 fix: strip null synth_engine from project JSON
- Frontend serialize: use undefined instead of null for synth_engine
- Backend validate: strip None synth_engine from tracks before schema validation
- Prevents 'None is not of type object' schema error
2026-07-26 18:22:35 +07:00
3dtours 23601007bf fix: SpessaSynth init retry + default SF3 auto-load
- getAudioContext() calls SonicSF.init on every call (not just first)
- soundfontPlayer.init retries after 1s if SpessaSynth module not loaded yet
- Auto-loads sgm_v2.01 SF3 on successful init
- Fixes race condition: module script loads after regular scripts
2026-07-26 17:59:15 +07:00
3dtours 29c4c45791 chore: rebuild precompiled JS bundle after app.jsx changes 2026-07-26 17:56:32 +07:00
3dtours 44e0a6d736 feat: sử dụng synth cho MIDI KEys 2026-07-26 17:36:36 +07:00
3dtours 2ab989132b fix(ui): wire Synth button to VST3 selection and render engine
- UI: setTrackInstrumentWithProgram stores instrumentId + enables MIDI type
- UI: SoundFont preset selection now passes soundfont_bank to server
- Server: render_engine reads instrument_id field (fallback instrument)
- Serialize/deserialize: soundfont_bank, soundfont_program preserved
- Rebuilt app.precompiled.js from app.jsx
2026-07-26 16:25:26 +07:00
3dtours 3e805179c2 feat: sử dụng VST3, Soundfont, pianobook 2026-07-26 16:21:32 +07:00
3dtours b1bbf567ab fix(piano-roll): seek-to-start restarts playback
- Add seekPlaybackTo(time) that stops, updates refs, reschedules
  MIDI, and restarts playback for both sub-tab and main timeline
- 'Quay lại đầu' and 'Đầu vùng chọn' buttons use seekPlaybackTo
2026-07-26 12:22:51 +07:00
3dtours b0d7f35a1e fix(piano-roll): loop only on btn + instant stop
- Sub-tab selection loop only active when st.isLooping is true
- End-of-playback loop uses st.isLooping, not global isLoopingSelection
- SonicSF.stopAll() sets gain 0 and stops oscillators immediately
2026-07-26 12:16:01 +07:00
3dtours 4e880850f5 fix(piano-roll): playhead seek + sound cracking
- Piano roll ruler click during playback now seeks and continues playing
- ADSR envelope uses linearRampToValueAtTime for crack-free release
- stopAll ramps gain to 0 in 20ms before stopping oscillators
2026-07-26 12:03:29 +07:00
3dtours 1ffdec68c6 fix: ruler click 200ms timeout + default instrument attackTime 0.03 + safe ramp 2026-07-26 11:51:50 +07:00
3dtours 523a754949 fix: remove grab handle e.stopPropagation blocking ruler clicks 2026-07-26 11:48:21 +07:00
3dtours 79999065a7 fix: ruler click moves playhead, drag moves range 2026-07-26 11:45:47 +07:00
3dtours e18b261943 fix: ruler range drag/move, default cursor, SonicSF smooth stopAll 2026-07-26 11:42:06 +07:00
3dtours 7601cc72c9 fix: ruler click playhead update using available props onStop+onPlayPause 2026-07-26 11:36:55 +07:00
3dtours 5e096b5594 fix: remove range auto-loop + gain fade-out for reschedule crackling 2026-07-26 11:34:02 +07:00
3dtours d3a3adca8a fix: realtime velocity with updatedNotes + ruler restart without onStop 2026-07-26 11:28:47 +07:00
3dtours b6b1faf083 feat: realtime velocity, ruler play click, export MIDI button 2026-07-26 11:20:19 +07:00
3dtours 90ca8f484b fix: restore isPlaying after stopAllPlayback on instrument change 2026-07-26 11:13:50 +07:00
3dtours 9717470bb6 fix: instrument change keeps loop playback alive 2026-07-26 11:10:31 +07:00
3dtours e57f6d96d9 fix: MIDI tab real-time instrument change - restart playback 2026-07-26 11:07:37 +07:00
3dtours 5b500ebdf3 fix: remove MIDI tab loop button + Ctrl+click clear range 2026-07-26 11:03:51 +07:00
3dtours 9438f44052 fix: CC note detection with Y-aware stem matching 2026-07-26 10:59:33 +07:00
3dtours 27d9556a9d fix: brush draw pitch revisit by comparing lastDrawnPitch 2026-07-26 10:55:21 +07:00
3dtours 034455598d fix: brush draw per-note duration with noteStartBeats tracking 2026-07-26 10:50:45 +07:00
3dtours 8450bd6de4 fix: brush draw only pitch change + CC velocity skip unchanged 2026-07-26 10:48:16 +07:00
3dtours d2993eee69 fix: brush drawing smooth - track pitch + beat delta 2026-07-26 10:44:37 +07:00
3dtours fe379c45e2 fix: brush shape draw + remove transport + loop repeat sound 2026-07-26 10:41:31 +07:00
3dtours d20fafb75e fix: velocity flicker - grid canvas useLayoutEffect sync 2026-07-26 10:29:23 +07:00
3dtours 0b7dd82407 fix: scroll speed matches mouse + CC flicker useLayoutEffect 2026-07-26 10:26:00 +07:00
3dtours 7107a0cc14 fix: brush scroll speed + CC snap + non-selected flicker 2026-07-26 10:21:31 +07:00
3dtours 8ec4b05e21 fix: brush pitch-based scroll + CC velocity per-note paint 2026-07-26 10:14:40 +07:00
3dtours 9237d01f35 fix: auto-scroll continuous + batch CC velocity for selected notes 2026-07-26 10:09:55 +07:00
3dtours a7417b9bfa fix: đã sửa lỗi bị mất không hiển thị midi piano grid 2026-07-26 10:05:23 +07:00