d8f8506077
- open_vst_gui: bo WebviewWindowBuilder/thread, chi push_control type=4 (hwnd=0 -> bridge tao window) - main.cpp: create_native_vst_window (class SonicForge_Native_VST3_Class, 800x600, khong TOPMOST), tao trong ChannelWorker job, map guiWindows, capture arg2 by value (fix dangling) - app.jsx: guard isBridgeActive() 8 cho -> bridge active thi moi note di router -> pushEvent -> bridge (truoc day SF2 cam vi HAS_PYFLUIDSYNTH=FALSE -> /soundfont-render 501; VST3 path cu dung nativeSf/Carla) - E2E: SF2 NOTE_ON qua dispatchMidiEvent -> SHM peak 0.029745; Nexus GUI native hwnd OK (license/preset) - docs: TASKS.md + TEST_NOTES.md ghi batch fix + ket qua; gitignore vendor/junk
58 lines
2.4 KiB
HTML
58 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="vi">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>SonicForge DAW</title>
|
||
<style>
|
||
body { font-family: system-ui, sans-serif; background: #12141a; color: #e8eaf0;
|
||
display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; }
|
||
#msg { text-align: center; max-width: 480px; line-height: 1.6; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div id="msg">Đang khởi động SonicForge Engine…</div>
|
||
<script>
|
||
// Frontend host (Tauri asset page). KHÔNG location.href redirect: chuyển
|
||
// sang http://127.0.0.1:8000 sẽ rời Tauri context -> mất window.__TAURI__
|
||
// -> NativeBridgeService vô hiệu (bridge-audio/load_instrument không dùng
|
||
// được; MIDI rơi về fallback WASM/Carla). Thay vào đó: quét port engine
|
||
// (8000-8010), nạp toàn bộ UI engine qua document.write trên CÙNG document
|
||
// (origin tauri:// giữ nguyên -> __TAURI__ sống), base href + API_BASE_URL
|
||
// trỏ engine HTTP (CORS * đã bật).
|
||
(async function () {
|
||
var base = null;
|
||
for (var p = 8000; p <= 8010 && !base; p++) {
|
||
try {
|
||
var r = await fetch('http://127.0.0.1:' + p + '/health', { cache: 'no-store' });
|
||
if (r.ok) base = 'http://127.0.0.1:' + p + '/';
|
||
} catch (e) { /* port chưa mở */ }
|
||
}
|
||
if (!base) {
|
||
document.getElementById('msg').textContent =
|
||
'Không tìm thấy SonicForge Engine (port 8000–8010). Hãy đóng và chạy lại ứng dụng. ' +
|
||
'Nếu lặp lại, xem log: %APPDATA%\\SonicForgeDAW\\logs\\engine.log';
|
||
return;
|
||
}
|
||
var html;
|
||
try {
|
||
var res = await fetch(base, { cache: 'no-store' });
|
||
html = await res.text();
|
||
} catch (e) {
|
||
document.getElementById('msg').textContent = 'Engine không phản hồi: ' + e;
|
||
return;
|
||
}
|
||
// base href để /static, /api resolve về engine; API_BASE_URL override
|
||
// location.origin (origin thật là tauri://). KHÔNG trailing slash trong
|
||
// API_BASE_URL: api.js nối `${API_BASE_URL}/api/...` -> double slash
|
||
// `//api/...` -> FastAPI 404 "Not Found" (login báo not found).
|
||
html = html.replace('<head>',
|
||
'<head>\n<base href="' + base + '">\n' +
|
||
'<script>window.API_BASE_URL = "' + base.replace(/\/$/, '') + '";<\/script>');
|
||
document.open();
|
||
document.write(html);
|
||
document.close();
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html>
|