Commit Graph

489 Commits

Author SHA1 Message Date
3dtours 0d763c5a0b fix: targetTrackId undefined outside updateActiveTracks closure
Move track Y-position computation before updateActiveTracks so
targetTrackId is accessible for setDraggedSectionItem update.
2026-07-29 11:09:05 +07:00
3dtours ad6fa1feb9 fix: auto-add tracks when drag exceeds track count
Compute maxTargetIdx across all multiIds items. Prepend new
tracks to prev array before mapping if needed.
2026-07-29 11:08:11 +07:00
3dtours 9abb0e6a50 fix: cross-track drag computes target from mouse Y position
Replace hoveredTrackIdRef with Y-position calculation through
track heights from prev state. Works reliably during drag.
2026-07-29 11:03:30 +07:00
3dtours 6c6a326b7d fix: single-item cross-track drag
Each track filters the item independently. Only target track
receives the inserted item. Removes duplicate state update.
2026-07-29 11:02:03 +07:00
3dtours 8e8fc58082 fix: group drag uses original trackId for offset math
Store trackId in multiIds at drag start. Each item computes
target from original track + crossOffset, immune to stale state
from previous drag events. Track 1 item drags n tracks -> track
1+n, track 2 item -> track 2+n, etc.
2026-07-29 11:00:51 +07:00
3dtours ec355da58d fix: group drag cross-track uses live prev state for index mapping
Build trkIds from prev (updateActiveTracks callback) instead of
stale activeTracksRef. Fix srcItem lookup with proper for loop.
2026-07-29 10:55:39 +07:00
3dtours 9c3a435f26 fix: group drag cross-track maintains relative track offsets
Each item computes its own target track as srcIdx + crossOffset.
Items from different source tracks land on different target tracks,
preserving the group's vertical layout shape.
2026-07-29 10:52:50 +07:00
3dtours 12d2639455 fix: group drag keeps items on their original tracks
Remove all cross-track logic in multiIds path. Each item only
updates its time position (delta) on its current track. No
merging or track reassignment.
2026-07-29 10:50:37 +07:00
3dtours e99bc8624f fix: group drag moves all items, clamp to track 0, auto-add track
Restore multiIds cross-track move for all selected items.
Clamp targetTrackId to first track. Auto-add new track via
addNewTrack() when dragging below the last track.
2026-07-29 10:47:53 +07:00
3dtours 9869566d3e fix: multi-item drag no longer merges all items into target track
Only the dragged item (drag.itemId) crosses tracks. Other selected
items stay on their original tracks and only move horizontally.
2026-07-29 10:42:42 +07:00
3dtours 0f99788d21 FIX: sửa lỗi hiển thị AI suggestion 2026-07-29 10:39:06 +07:00
3dtours e544d5e694 fix: show all presets always, no filter by selection
Remove selection-based filter entirely. Suggestions list stays
stable across select/deselect — no preset appears at top when
deselecting.
2026-07-29 10:18:47 +07:00
3dtours 614d83b971 fix: filter excludes non-rearrange presets in AI suggestion list
Remove || p.is_favorite from filter when MIDI item selected.
Only presets with category === 'Rearrange / Variation' appear.
2026-07-29 10:17:36 +07:00
3dtours 895ad0b7d9 fix: restore AI suggestion filter by selection, cache PromptTemplateManager
Cache PromptTemplateManager in ref to prevent new instance per
render. Filter: show only Rearrange/favorites when MIDI item
selected, all presets otherwise. Root cause of 'suggestion added
at top' was stale array reference from new instance every render.
2026-07-29 10:11:10 +07:00
3dtours 98ca21bd9a fix: AI Suggestion list changing on item select/deselect
Always show full preset list instead of filtering to rearrange/
favorites when item selected. Prevents suggestion list from
visually changing during selection/deselection.
2026-07-29 10:08:05 +07:00
3dtours c3d87562e9 FIX: sửa lỗi khi bật tắt ARM thì âm thanh bị stuck 2026-07-29 10:05:48 +07:00
3dtours 5ed943b3d6 fix: stuck MIDI notes when ARM toggled off mid-note
Remove !st.isArmed guard in note-off handler. Stop note on ALL
tracks regardless of ARM state — FluidSynth stopNote on inactive
channel/pitch is a no-op, so this is safe.
2026-07-29 10:02:30 +07:00
3dtours fa7815bb53 FIX: cho phép thay đổi chiều cao slider Mixer Panel display 2026-07-29 09:58:18 +07:00
3dtours caa95177ef FEAT: thêm Mixer Panel display 2026-07-29 09:54:21 +07:00
3dtours b00f0cff95 feat: mixer VU meter, fader scaling, track name color
- Master strip: add fader placeholder + VU meter bar
- MixerStrip: items-end -> items-stretch so fader + VU fill height
- VU meter: bar height maps volumeDb, color green/amber/red
- Track name uses track.color instead of fixed text-zinc-400
2026-07-29 09:54:18 +07:00
3dtours 2187440681 feat: Mixer Panel display-only with F7 toggle
Add MixerStrip component for display-only track strips (no audio
routing). Mixer panel at bottom with drag resize handle (80-400px).
F7 keyboard shortcut, status bar toggle button, View menu item.
onUpdateTrack handles mute/solo/volume changes directly on tracks.
2026-07-29 09:49:47 +07:00
3dtours 33cf804c88 fix: AI Suggestion for MIDI Item rearrange 2026-07-28 21:08:03 +07:00
3dtours a68bebac2a fix: AI Suggestion for MIDI Item rearrange 2026-07-28 21:04:32 +07:00
3dtours 35fb29201d fix: AI Suggestion shows only Rearrange presets when MIDI item selected
When hasSelItem is true, suggestions filtered to only
Rearrange / Variation category + favorites.
2026-07-28 21:04:19 +07:00
3dtours 393dd7190f fix: rearrangeMidiMelody newId not defined
newId was defined inside updateActiveTracks callback but
referenced outside (line 15002 return). Moved declaration
before the callback as rearrangeNewId, accessible in both
the callback body and the outer return statement.
2026-07-28 20:58:44 +07:00
3dtours fc81f19b1c fix: MIDI rearrange tool spec double-wrapped, AI returns _unknown
REARRANGE_TOOL_SPEC already has {type:'function', function:{...}}
wrapper. callLLM's tools.map(t => ({type:'function', function:t}))
added ANOTHER wrapper, creating nested:
  {type:'function', function:{type:'function', function:{name}}}
which AI models couldn't parse -> function name became _unknown.
Fix: pass .function (inner spec) instead of the outer wrapper.
2026-07-28 20:51:27 +07:00
3dtours 61f4b90af0 feat: Action Log hidden by default, click header to toggle
- showAIActionLog state defaults to false
- Action Log header clickable (cursor-pointer), shows '-' when
  visible, '+' when hidden
- Body always rendered with CSS class 'hidden' toggled, avoids
  deep ternary nesting that exceeded Babel 8 maxTargets limit
2026-07-28 20:43:08 +07:00
3dtours a56c616817 fix: AI Panel list show 2026-07-28 20:38:53 +07:00
3dtours 9cbf5940f4 chore: Copilot prompt textarea 8 rows 2026-07-28 20:27:58 +07:00
3dtours 4c3d649506 fix: remove preset auto-optimization from AI send paths
matchPreset was replacing systemInstruction with the preset's
template on keyword match. Typing 'epic orchestra' would
auto-apply 'Epic Orchestra Intro (8 Bars)' restrictive template.

Removed both override blocks (Piano Roll MIDI gen + DAW
rearrange). System instruction stays as generic default.
User can still fill prompt via suggestion click without
forced template override.
2026-07-28 20:26:03 +07:00
3dtours 0dc3f10406 fix: AI Copilot shows all presets in suggestion list
Change suggestions from getContextualSuggestions (filtered)
to promptMgr.presets (all). MIDI item name still shown in
header when hasSelItem is true.
2026-07-28 20:20:22 +07:00
3dtours 6a46b1ffe4 fix: AIPresetModal merge backend presets instead of overwrite
Backend sync effect (useEffect mount) was unconditionally
replacing mgr.presets with data.presets, destroying:
- Frontend-only default presets (12 vs backend's 7)
- User-defined presets in localStorage not yet synced to backend

Fix: merge backend presets by id — keep all local presets,
append any backend presets whose id doesn't exist locally.
User presets + frontend defaults are never lost.
2026-07-28 20:17:52 +07:00
3dtours 71edf7ffb3 feat: AIPresetModal - 'Người dùng' filter for user-defined presets
Add 'Người dùng' category to filter dropdown. Filter logic
checks p.is_user_defined when this category is selected.
Shows only presets the user has created/added.
2026-07-28 20:15:11 +07:00
3dtours c09ad7f48d feat: AI Copilot suggestion toggle button
Add showAISuggestions state + 'Sug' toggle button in Copilot
Prompt header. When hidden, suggestion list is unmounted
(showAISuggestions ? ... : null). Button styling: visible
state = bg-zinc-800/zinc-400, hidden = indigo-950/indigo-400.
2026-07-28 20:11:23 +07:00
3dtours ad29df46d2 fix: AI suggestion list shows only rearrange presets for MIDI item
Use suggestions (filtered by getContextualSuggestions) instead
of promptMgr.presets (all). When MIDI item selected, only
Rearrange/Variation + favorites shown. When no MIDI item,
non-rearrange presets shown instead.
2026-07-28 20:09:45 +07:00
3dtours 2a9748e12e feat: AI Copilot panel - full scrollable preset list + MIDI item name
Replace horizontal suggestion chips (max 6/4) with vertical
scrollable list (max-h-36, no-scrollbar) showing ALL presets
from PromptTemplateManager (capped at 50). Header shows
'AI Suggestion' label. When MIDI item selected, MIDI item
name displayed in header. Each preset shows star/fav icon,
name, and category tag. Click fills the prompt textarea.
2026-07-28 20:07:29 +07:00
3dtours bb49035bee fix: sửa lỗi xóa track khi nhấn phím Del, đúng là phải xóa items được chọn 2026-07-28 19:34:47 +07:00
3dtours 6c8eb79aac fix: use ref-wrapped handler for delete selected items
Move delete logic into handleDeleteSelectedItemsRef to ensure
setSelectedItemIds, updateActiveTracks, showToast are always
up-to-date despite empty useEffect deps in keyboard handler.

Keyboard handler reads selectedItemIdsRef.current (live ref),
calls handleDeleteSelectedItemsRef.current(idsToDelete).
2026-07-28 18:47:40 +07:00
3dtours 54c1ee9e94 fix: use selectedItemIdsRef in keyboard handler to fix stale closure
Keyboard handler useEffect has empty deps [], so selectedItemIds was
always captured as empty Set. Added selectedItemIdsRef to keep live
reference, matching pattern used by selectedClipIdRef.
2026-07-28 18:35:49 +07:00
3dtours a41284ccf7 feat: add Ctrl+A select all items and Del key delete selected items/groups
- Ctrl+A already existed for selecting all timeline items across tracks
- Added Del/Backspace key handler for selectedItemIds: deletes all selected sections, MIDI items, and audio clips from the selected track(s)
- Clears selection after deletion and shows toast with count
2026-07-28 18:22:31 +07:00
3dtours 6604f85e0d fix: sửa lỗi mouse với ctrl+click+drag 2026-07-28 17:29:50 +07:00
3dtours cff3950670 feat: AI Copilot suggestion chips + typeahead dropdown
- Suggestion chips bar: context-aware (amber for rearrange, indigo for creation)
- Typeahead dropdown: keyword matching on ≥2 chars, Tab to select
- getSelectedMidiItemInfo helper for context detection
- Backend: 4 rearrange presets in ai_presets.py
- PromptTemplateManager: getContextualSuggestions(hasSelectedItem)
2026-07-28 11:20:26 +07:00
3dtours 3f7abe0c95 feat: AI Rearrange Scenario Detection from spec 45_SCENARIAO_AI
- 9 rearrange scenarios with keyword matching (arpeggio, harmonies,
  syncopation, walking bass, jazz, synthwave, cinematic, simplify, chromatic)
- detectRearrangeScenario() maps user prompt to specific technique rules
- buildRearrangeMessage auto-injects scenario-specific technique guidance
- 9 rearrange presets added to PromptTemplateManager (Rearrange / Variation)
2026-07-28 11:03:26 +07:00
3dtours 2eb327056d fix: MIDI Rearrange — selected item triggers dedicated tool flow
- midiExtractor.js: extractSelectedMIDIContext with note name conversion
- aiGateway.js: REARRANGE_TOOL_SPEC + buildRearrangeMessage
- dawCommandDispatcher.js: register REARRANGE_MIDI_MELODY command
- app.jsx: handleAISend detects selected MIDI item → rearrange flow
- rearrangeMidiMelody handler places A/B track below source track
2026-07-28 10:54:35 +07:00
3dtours 421535ca0e feat: AI MIDI Prompt Template & Preset Engine
- promptTemplateManager.js: standalone service with keyword scoring, CRUD, fav toggle
- ai_presets.py: backend CRUD router (JSON file, auth isolation)
- AIPresetModal: PromptTemplateManager, star/fav column, backend API sync
- Piano Roll AI: preset matching support
- 7 tests: matching, CRUD, anonymous auth, user isolation
2026-07-28 10:42:30 +07:00
3dtours 77c7486d4e fix: sửa lỗi Ctrl+S trong SECTION-TAB để lưu vào MAIN SESSION sửa AI 2026-07-28 10:32:39 +07:00
3dtours 10c0a743c6 feat: CC lane dropdown with Velocity, Sustain, Modulation, Pitch Bend, Pan
Replaced flex div with velocity/pan buttons with a
<select> dropdown containing 5 CC type options.
Default: Velocity. Button toggle shows short label.
2026-07-28 10:20:52 +07:00
3dtours ae71acef0f fix: sửa lỗi Ctrl+S trong SECTION-TAB để lưu vào MAIN SESSION 2026-07-28 10:13:58 +07:00
3dtours f0b62d5a1c fix: Ctrl+S in SECTION-TAB stale closure, saveSectionTab uses initial sessionTabs
Keyboard handler (useEffect [] deps) captures handleSaveSectionTab
from first render, which has sessionTabs = []. When section tab
is opened later, saved handleSaveSectionTab finds no tab and
returns silently. Added handleSaveSectionTabRef, updated on
every render, used in keyboard handler via ref.current.
2026-07-28 10:13:28 +07:00
3dtours f84431c9a6 fix: sửa lỗi Ctrl+S trong SECTION-TAB 2026-07-28 10:11:25 +07:00