Add audio export

This commit is contained in:
Skyler Lehmkuhl
2025-11-24 01:03:31 -05:00
parent 2e1485afb1
commit cbdd277184
11 changed files with 486 additions and 2 deletions
+7
View File
@@ -1102,6 +1102,7 @@ dependencies = [
"dasp_rms",
"dasp_sample",
"dasp_signal",
"hound",
"midir",
"midly",
"pathdiff",
@@ -1939,6 +1940,12 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hound"
version = "3.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
[[package]]
name = "html5ever"
version = "0.26.0"
+42
View File
@@ -1656,3 +1656,45 @@ pub async fn audio_load_track_graph(
Err("Audio not initialized".to_string())
}
}
#[tauri::command]
pub async fn audio_export(
state: tauri::State<'_, Arc<Mutex<AudioState>>>,
output_path: String,
format: String,
sample_rate: u32,
channels: u32,
bit_depth: u16,
mp3_bitrate: u32,
start_time: f64,
end_time: f64,
) -> Result<(), String> {
let mut audio_state = state.lock().unwrap();
if let Some(controller) = &mut audio_state.controller {
// Parse format
let export_format = match format.as_str() {
"wav" => daw_backend::audio::ExportFormat::Wav,
"flac" => daw_backend::audio::ExportFormat::Flac,
_ => return Err(format!("Unsupported format: {}", format)),
};
// Create export settings
let settings = daw_backend::audio::ExportSettings {
format: export_format,
sample_rate,
channels,
bit_depth,
mp3_bitrate,
start_time,
end_time,
};
// Call export through controller
controller.export_audio(&settings, &output_path)?;
Ok(())
} else {
Err("Audio not initialized".to_string())
}
}
+1
View File
@@ -303,6 +303,7 @@ pub fn run() {
audio::audio_resolve_missing_file,
audio::audio_serialize_track_graph,
audio::audio_load_track_graph,
audio::audio_export,
video::video_load_file,
video::video_get_frame,
video::video_get_frames_batch,