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
+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);
}
}
});
}