fix(midi): route MIDI live via masterBus, fix media explorer drag, add action logging
- TrackInstrument: gate native live path (SF/VSTi WASAPI bridge bypassed masterBus -> mastering FX + main out VU dead). Fallback to SonicSF WASM through masterBus.input; native kept for offline render only. - MEDIA_LIBRARY_SAMPLES: rename MIDI_Loop_02_Bass/03_Lead/05_Bass to match actual /static/midi files (drag was 404 -> parse error). - Add SonicAppLogger (console + POST /api/v1/logs) wired to: instrument load error, VSTi autosample fail, MIDI item -> mastering fx chain, play -> main out, drag MIDI errors (media explorer + window explorer). - Add backend /api/v1/logs endpoint (server-side log, no DB).
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// SonicForge App Logger — ghi hành động quan trọng của client (console + POST
|
||||
// /api/v1/logs để server log). Fire-and-forget: không throw, không block UI.
|
||||
// Các category dùng chung:
|
||||
// INSTRUMENT — lỗi load instrument (soundfont select/load fail)
|
||||
// VSTI — VSTi load/autosample/preview fail
|
||||
// MIDI_ITEM — MIDI item qua mastering fx chain / main out (playback)
|
||||
// DRAG_MIDI — lỗi drag MIDI từ MEDIA EXPLORER hoặc window explorer
|
||||
window.SonicAppLogger = window.SonicAppLogger || (function () {
|
||||
function base() {
|
||||
return window.API_BASE_URL || window.location.origin || '';
|
||||
}
|
||||
function emit(category, level, message, data) {
|
||||
try {
|
||||
var line = '[AppLog][' + category + '][' + level + '] ' + message;
|
||||
if (data !== undefined && data !== null) {
|
||||
try { line += ' ' + JSON.stringify(data); } catch (e) {}
|
||||
}
|
||||
if (level === 'error') console.error(line); else if (level === 'warn') console.warn(line); else console.log(line);
|
||||
try {
|
||||
fetch(base() + '/api/v1/logs', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
category: category,
|
||||
level: level,
|
||||
message: message,
|
||||
data: data !== undefined ? data : null,
|
||||
url: window.location ? window.location.href : '',
|
||||
ts: new Date().toISOString()
|
||||
})
|
||||
}).catch(function () {});
|
||||
} catch (e) {}
|
||||
} catch (e) {}
|
||||
}
|
||||
return {
|
||||
info: function (category, message, data) { emit(category, 'info', message, data); },
|
||||
warn: function (category, message, data) { emit(category, 'warn', message, data); },
|
||||
error: function (category, message, data) { emit(category, 'error', message, data); }
|
||||
};
|
||||
})();
|
||||
@@ -22,7 +22,15 @@ window.TrackInstrument = window.TrackInstrument || {};
|
||||
|
||||
// Loại engine native cho track: 'sf' (soundfont), 'vst3'/'vst2' (VSTi có
|
||||
// plugin_id) hay null (không native được → fallback WASM/autosample).
|
||||
// T15-regression fix: native live (SF/VSTi qua WASAPI bridge) phát thẳng ra
|
||||
// OS device — BỎ QUA WebAudio masterBus → mastering FX + Main out VU không
|
||||
// nhận tín hiệu. Gate native live path: luôn fallback WASM (SonicSF/
|
||||
// autosample) qua masterBus.input. Native vẫn dùng cho OFFLINE render
|
||||
// (scheduleNativeSfItem / /api/v1/native/render) — không đi qua hàm này.
|
||||
// ponytail: re-enable live native khi C++ bridge có capture/readback →
|
||||
// set window.__SONICFORGE_NATIVE_LIVE = true.
|
||||
TrackInstrument.prototype._nativeKind = function () {
|
||||
if (!window.__SONICFORGE_NATIVE_LIVE) return null;
|
||||
try {
|
||||
if (this.sfId) return 'sf';
|
||||
if (window.SonicNativeAudio && this.synthEngine && this.synthEngine.plugin_id) {
|
||||
|
||||
Reference in New Issue
Block a user