fix: GUI VST native window qua bridge + audio path bridge (SF2 preview/play câm)
- 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
This commit is contained in:
@@ -20,6 +20,30 @@
|
||||
if (this._statusCb) this._statusCb({ connected: !!connected });
|
||||
},
|
||||
|
||||
/** Fix C: re-establish bridge routing once audio frames arrive again
|
||||
* after bridge-down. Same wiring as the bootstrap block in app.jsx
|
||||
* (getAudioContext -> BridgeAudioNode.init -> AudioRoutingEngine.connect). */
|
||||
_reconnectInFlight: false,
|
||||
_reconnectIfNeeded: function () {
|
||||
if (this._reconnectInFlight) return;
|
||||
this._reconnectInFlight = true;
|
||||
var self = this;
|
||||
var finish = function () { self._reconnectInFlight = false; };
|
||||
try {
|
||||
var ctx = (typeof getAudioContext === 'function') ? getAudioContext() : (window.__sharedAudioCtx || null);
|
||||
if (ctx && window.BridgeAudioNode && window.AudioRoutingEngine) {
|
||||
window.BridgeAudioNode.init(ctx);
|
||||
window.AudioRoutingEngine.connect(window.BridgeAudioNode, null, null);
|
||||
}
|
||||
if (window.SonicMidiRouter) window.SonicMidiRouter.setBridgeConnected(true);
|
||||
this._notifyStatus(true);
|
||||
console.warn('[BridgeService] bridge recovered — routing re-established.');
|
||||
} catch (e) {
|
||||
console.warn('[BridgeService] reconnect failed:', e);
|
||||
}
|
||||
finish();
|
||||
},
|
||||
|
||||
_init: function () {
|
||||
if (!this._tauri()) {
|
||||
// Dev mode (Linux / plain browser): no Tauri -> log-only, app uses SonicSF.
|
||||
@@ -29,6 +53,9 @@
|
||||
var self = this;
|
||||
try {
|
||||
window.__TAURI__.event.listen('bridge-audio', function (e) {
|
||||
// Bridge recovered after bridge-down (or never bootstrapped):
|
||||
// audio frames flow again -> re-establish routing (Fix C).
|
||||
if (!self.isBridgeConnected) self._reconnectIfNeeded();
|
||||
if (self._audioCb) self._audioCb(e.payload.l, e.payload.r);
|
||||
});
|
||||
window.__TAURI__.event.listen('bridge-down', function () {
|
||||
|
||||
Reference in New Issue
Block a user