v15b: fix CC7 to VSTi (legacy tag kHostMidiCC+cc + volume-param fallback), CC lane grid + 0/+- labels
This commit is contained in:
+64
-9
@@ -9643,6 +9643,44 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
// ponytail: chi khoi phuc khi project cu co curve; chua hop nhat migration
|
||||
}, [notes]);
|
||||
|
||||
// CC lane grid: vẽ cột beat/bar GIỐNG HỆT piano roll (cùng pixelsPerBeat +
|
||||
// snapBeats + timeSigNum) → không lệch khi zoom. snapBeats copy nguyên từ
|
||||
// notes canvas để hai lane trùng khít.
|
||||
const paintCCLaneGrid = (ctx, h) => {
|
||||
let snapBeats = 0.25;
|
||||
if (snapValue === '1') snapBeats = 1.0;
|
||||
else if (snapValue === '1/2') snapBeats = 0.5;
|
||||
else if (snapValue === '1/4') snapBeats = 0.25;
|
||||
else if (snapValue === '1/8') snapBeats = 0.125;
|
||||
else if (snapValue === '1/16') snapBeats = 0.0625;
|
||||
else if (snapValue === '4') snapBeats = 4.0;
|
||||
else if (snapValue === '1/32') snapBeats = 0.03125;
|
||||
for (let beat = 0; beat <= viewBeats; beat += snapBeats) {
|
||||
const x = beat * pixelsPerBeat;
|
||||
if (x > viewWidth) break;
|
||||
const isBar = beat % timeSigNum === 0;
|
||||
ctx.strokeStyle = isBar ? '#444450' : '#2d2d35';
|
||||
ctx.lineWidth = isBar ? 1.2 : 0.6;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x, 0);
|
||||
ctx.lineTo(x, h);
|
||||
ctx.stroke();
|
||||
}
|
||||
};
|
||||
// Nhan 0/+-: CC 0=min (velocity, expression...) ghi "0" o day; CC luong cuc
|
||||
// (pan) ghi "+" dinh, "0" giua, "-" day.
|
||||
const paintCCLaneZeroLabel = (ctx, h, bipolar) => {
|
||||
ctx.fillStyle = '#8b8b95';
|
||||
ctx.font = '10px sans-serif';
|
||||
if (bipolar) {
|
||||
ctx.fillText('+', 5, 12);
|
||||
ctx.fillText('0', 5, h / 2 + 3);
|
||||
ctx.fillText('-', 5, h - 5);
|
||||
} else {
|
||||
ctx.fillText('0', 5, h - 5);
|
||||
}
|
||||
};
|
||||
|
||||
// Ve CC11 lane (graph thread). Tach rieng de drag ve preview truc tiep
|
||||
// (truoc day setNotes tung mousemove + doc notes tu closure stale -> node
|
||||
// cu/moi xen ke -> flicker). previewNoteId != null: chi ve note do voi
|
||||
@@ -9658,12 +9696,15 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
||||
ctx.fillStyle = '#161616';
|
||||
ctx.fillRect(0, 0, viewWidth, h);
|
||||
ctx.strokeStyle = '#252525';
|
||||
paintCCLaneGrid(ctx, h);
|
||||
// CC11 0=min → ghi "0" o day (khong ve duong giua nua).
|
||||
ctx.strokeStyle = '#2f2f38';
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, h / 2);
|
||||
ctx.lineTo(viewWidth, h / 2);
|
||||
ctx.moveTo(0, h - 10);
|
||||
ctx.lineTo(viewWidth, h - 10);
|
||||
ctx.stroke();
|
||||
paintCCLaneZeroLabel(ctx, h, false);
|
||||
const yOf = v => h - ((v / 127) * (h - 20) + 10);
|
||||
if (notes.length === 0) return;
|
||||
let minS = Infinity, maxE = -Infinity;
|
||||
@@ -9719,13 +9760,27 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
|
||||
ctx.fillStyle = '#161616';
|
||||
ctx.fillRect(0, 0, viewWidth, h);
|
||||
paintCCLaneGrid(ctx, h);
|
||||
|
||||
ctx.strokeStyle = '#252525';
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, h / 2);
|
||||
ctx.lineTo(viewWidth, h / 2);
|
||||
ctx.stroke();
|
||||
if (ccMode === 'pan') {
|
||||
// Luong cuc: 0 o giua (+ dinh / - day) — giu nguyen nhu cu.
|
||||
ctx.strokeStyle = '#252525';
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, h / 2);
|
||||
ctx.lineTo(viewWidth, h / 2);
|
||||
ctx.stroke();
|
||||
paintCCLaneZeroLabel(ctx, h, true);
|
||||
} else {
|
||||
// 0=min: ve duong day tai gia tri 0 + nhan "0".
|
||||
ctx.strokeStyle = '#2f2f38';
|
||||
ctx.lineWidth = 1;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, h - 10);
|
||||
ctx.lineTo(viewWidth, h - 10);
|
||||
ctx.stroke();
|
||||
paintCCLaneZeroLabel(ctx, h, false);
|
||||
}
|
||||
|
||||
if (ccMode === 'cc11') {
|
||||
// CC11 expression: graph thread cho note dang chon; khi dang drag ve
|
||||
|
||||
Reference in New Issue
Block a user