Fix: persist expression_curve qua project save/load; TEST CC7 thay CC11

This commit is contained in:
2026-08-26 16:29:54 +07:00
parent f10f9873e9
commit e54dec4010
5 changed files with 18 additions and 11 deletions
+3 -1
View File
@@ -175,6 +175,8 @@ def bridge_state_preset_b64(channel=None, plugin_path=None) -> str:
return ""
EXPRESSION_CC = 7 # TEST: CC7 thay CC11 de kiem tra VSTi nhan CC (revert 11 khi xong)
def _expression_events(notes, bpm, sample_rate, grid=64):
"""Sinh CC11 events sample-accurate từ expression_curve mỗi note.
@@ -222,7 +224,7 @@ def _expression_events(notes, bpm, sample_rate, grid=64):
events.append({
"sample": start_sample + int(pos),
"kind": 2,
"a": 11,
"a": EXPRESSION_CC,
"b": max(0, min(127, interp(ratio))),
})
pos += max(1, int(grid))
+7 -4
View File
@@ -746,6 +746,7 @@ const _cc11ValueAt = (curve, ratio) => {
};
// ponytail: duplicate interp cc11ValueAt (component) — consolidate khi curve
// thành field track-level.
const EXPRESSION_CC = 7; // TEST: CC7 thay CC11 de kiem tra VSTi nhan CC (revert 11 khi xong)
const scheduleNoteExpressionCC11 = (track, note, ch, startWallTime, startSec, durSec) => {
try {
const curve = Array.isArray(note && note.expression_curve) ? note.expression_curve : [];
@@ -764,11 +765,11 @@ const scheduleNoteExpressionCC11 = (track, note, ch, startWallTime, startSec, du
const timer = setTimeout(() => {
if (epoch !== _nativePlayEpoch) return;
if (window.SonicMidiRouter && window.SonicMidiRouter.isBridgeActive && window.SonicMidiRouter.isBridgeActive()) {
window.SonicMidiRouter.pushEvent({ cmd: 'CC', channel: track ? track.id : 0, pitch: 11, velocity: 0, data2: val, percussion: isPerc });
window.SonicMidiRouter.pushEvent({ cmd: 'CC', channel: track ? track.id : 0, pitch: EXPRESSION_CC, velocity: 0, data2: val, percussion: isPerc });
return;
}
if (window.SonicSF && typeof window.SonicSF.controllerChange === 'function') {
window.SonicSF.controllerChange(ch, 11, val);
window.SonicSF.controllerChange(ch, EXPRESSION_CC, val);
}
}, delayMs);
_cc11Timers.add(timer);
@@ -11844,7 +11845,8 @@ const serializeTracksList = (tracksList, secondsPerBar) => {
start_beat: n.start_beat || 0.0,
duration_beats: n.duration_beats || 1.0,
velocity: n.velocity || 0.8,
pan: n.pan || 0.0
pan: n.pan || 0.0,
expression_curve: (Array.isArray(n.expression_curve) ? n.expression_curve : []).map(p => ({ position_ratio: p.position_ratio, value: p.value }))
}))
}
});
@@ -11955,7 +11957,8 @@ const deserializeTracksList = (schemaTracks, secondsPerBar, sectionStore, visite
start_beat: n.start_beat || 0.0,
duration_beats: n.duration_beats || 1.0,
velocity: n.velocity || 0.8,
pan: n.pan || 0.0
pan: n.pan || 0.0,
...(Array.isArray(n.expression_curve) ? { expression_curve: n.expression_curve } : {})
}))
});
} else if (item.type === "SECTION_ITEM") {
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -32,7 +32,7 @@
<link rel="stylesheet" href="/static/vendor/fontawesome.min.css">
<script src="/static/vendor/react.production.min.js"></script>
<script src="/static/vendor/react-dom.production.min.js"></script>
<script src="/static/js/services/fluidsynthLoader.js?v=2026082616201545"></script>
<script src="/static/js/services/fluidsynthLoader.js?v=202608261629201545"></script>
<script src="/static/js/services/runtime.js?v=202608101800"></script>
<script src="/static/js/services/api.js?v=202608212400"></script>
<script src="/static/js/services/audioEngine.js?v=202607271016"></script>