Feat: mixed bag

This commit is contained in:
2026-02-25 20:31:36 +01:00
parent a6ff19bb08
commit 0119988d7c
25 changed files with 246 additions and 10 deletions

View File

@@ -294,6 +294,7 @@ pub fn build_stream(
initial_samples: Vec<doux::sampling::SampleEntry>,
audio_sample_pos: Arc<AtomicU64>,
error_tx: Sender<String>,
sample_paths: &[std::path::PathBuf],
) -> Result<
(
Stream,
@@ -338,6 +339,17 @@ pub fn build_stream(
let mut engine =
Engine::new_with_metrics(sample_rate, channels, max_voices, Arc::clone(&metrics));
engine.sample_index = initial_samples;
for path in sample_paths {
if let Some(sf2_path) = doux::soundfont::find_sf2_file(path) {
if let Err(e) = engine.load_soundfont(&sf2_path) {
eprintln!("Failed to load soundfont: {e}");
} else {
break;
}
}
}
let registry = Arc::clone(&engine.sample_registry);
let (mut fft_producer, analysis_handle) = spawn_analysis_thread(sample_rate, spectrum_buffer);
@@ -382,6 +394,11 @@ pub fn build_stream(
AudioCommand::LoadSamples(samples) => {
engine.sample_index.extend(samples);
}
AudioCommand::LoadSoundfont(path) => {
if let Err(e) = engine.load_soundfont(&path) {
eprintln!("Failed to load soundfont: {e}");
}
}
}
}