feat: disconnect dsps on window close

This commit is contained in:
2026-10-06 22:23:53 +02:00
parent 83cb602625
commit 83d17add42
3 changed files with 49 additions and 32 deletions
-2
View File
@@ -10,8 +10,6 @@ This template should help get you started developing with Tauri, React and Types
- Check in meter if clip bool is limit instead
- On close disconenct all ds^p
- Check end to end behavioour
- Roll back on scroll when 2 scroll
+36 -29
View File
@@ -2,6 +2,7 @@ mod commands;
mod state;
use state::AppState;
use tauri::Manager;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
@@ -13,36 +14,42 @@ pub fn run() {
commands::remove_dsp408,
commands::get_dsp_snapshot,
commands::get_dsp_state,
commands::connect_dsp408, // 0x10
commands::disconnect_dsp408, // 0x11
commands::set_delay_unit, // 0x15
commands::recall_preset, // 0x20
commands::store_current_configuration, // 0x21
commands::factory_reset, // 0x23
commands::set_current_preset_name, // 0x26
commands::copy_channel, // 0x2A
commands::unlock_device, // Command `0x2D`
commands::lock_device, // Command `0x2F`
commands::set_compressor, // 0x30
commands::set_low_pass, // 0x31
commands::set_high_pass, // 0x32
commands::set_peq_band, // 0x33
commands::set_channel_gain, // 0x34
commands::set_mute, // 0x35
commands::set_channel_inverse_gain, // 0x36
commands::set_delay, // 0x38
commands::set_input_source, // 0x39
commands::set_matrix_routing, // 0x3A
commands::link_channels, // 0x3B
commands::set_bypass_peq, // 0x3C
commands::set_channel_name, // 0x3D
commands::set_gate, // 0x3E
commands::set_limiter, // 0x3F
commands::get_meter_levels, // 0x40
commands::set_matrix_gain, // 0x41
commands::set_geq_band, // 0x48
commands::set_geq_bypass, // 0x49
commands::connect_dsp408,
commands::disconnect_dsp408,
commands::set_delay_unit,
commands::recall_preset,
commands::store_current_configuration,
commands::factory_reset,
commands::set_current_preset_name,
commands::copy_channel,
commands::unlock_device,
commands::lock_device,
commands::set_compressor,
commands::set_low_pass,
commands::set_high_pass,
commands::set_peq_band,
commands::set_channel_gain,
commands::set_mute,
commands::set_channel_inverse_gain,
commands::set_delay,
commands::set_input_source,
commands::set_matrix_routing,
commands::link_channels,
commands::set_bypass_peq,
commands::set_channel_name,
commands::set_gate,
commands::set_limiter,
commands::get_meter_levels,
commands::set_matrix_gain,
commands::set_geq_band,
commands::set_geq_bypass,
])
.on_window_event(|window, event| {
if let tauri::WindowEvent::CloseRequested { .. } = event {
let state = window.app_handle().state::<AppState>();
state.shutdown();
}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
+12
View File
@@ -18,4 +18,16 @@ impl AppState {
next_id: Mutex::new(1),
}
}
pub fn shutdown(&self) {
let devices = self.devices.lock().unwrap();
for device in devices.values() {
if let Ok(mut device) = device.lock() {
if device.dsp.connected() {
let _ = device.dsp.disconnect();
}
}
}
}
}