connect solution into app: VSTi live native (vst3 attach/vst2 bridge) with WASM autosample fallback, VST GUI window (Bug 1), native-first track instrument

This commit is contained in:
2026-08-11 20:35:53 +07:00
parent 916ce1334b
commit 255e8586bc
13 changed files with 538 additions and 98 deletions
+2
View File
@@ -2880,6 +2880,8 @@ dependencies = [
"tauri-build",
"tauri-plugin-dialog",
"tauri-plugin-shell",
"webview2-com",
"windows-core 0.61.2",
]
[[package]]
+2
View File
@@ -16,6 +16,8 @@ tauri = { version = "2", features = [] }
tauri-plugin-shell = "2"
tauri-plugin-dialog = "2"
raw-window-handle = "0.6"
webview2-com = "0.38"
windows-core = "0.61"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
+4
View File
@@ -18,6 +18,7 @@ use std::path::{Path, PathBuf};
use std::sync::Mutex;
mod vst_gui;
mod permissions;
struct EngineProcess(Mutex<Option<CommandChild>>);
@@ -77,6 +78,9 @@ pub fn run() {
.plugin(tauri_plugin_dialog::init())
.invoke_handler(tauri::generate_handler![vst_gui::open_vst_gui, vst_gui::set_vst_param, vst_gui::get_vst_params, vst_gui::close_vst_editor])
.setup(|app| {
permissions::install(
&app.get_webview_window("main").expect("main window missing"),
);
vst_gui::init(app.handle());
let res_dir = app
.path()
+27
View File
@@ -0,0 +1,27 @@
// Standalone permissions (Bug 5): WebView2 auto-ALLOW mọi permission request
// (MIDI input, microphone, File System Access) — không hiện popup hỏi quyền.
// WebView2 mặc định DENY khi không có handler ICoreWebView2::add_PermissionRequested.
#![cfg(windows)]
use webview2_com::Microsoft::Web::WebView2::Win32::*;
use webview2_com::PermissionRequestedEventHandler;
pub fn install(window: &tauri::WebviewWindow) {
let _ = window.with_webview(|webview| {
unsafe {
if let Ok(core) = webview.controller().CoreWebView2() {
let handler = PermissionRequestedEventHandler::create(Box::new(
|_sender: Option<ICoreWebView2>,
args: Option<ICoreWebView2PermissionRequestedEventArgs>| {
if let Some(args) = args {
args.SetState(COREWEBVIEW2_PERMISSION_STATE_ALLOW)?;
}
Ok(())
},
));
let mut token = 0i64;
let _ = core.add_PermissionRequested(&handler, &mut token);
}
}
});
}