Fix sampled instrument loading

This commit is contained in:
Skyler Lehmkuhl
2025-10-28 05:50:44 -04:00
parent e426da0f5b
commit d2354e4864
7 changed files with 285 additions and 41 deletions
+2
View File
@@ -1003,6 +1003,8 @@ impl Engine {
if let Some(TrackNode::Midi(track)) = self.project.get_track_mut(track_id) {
track.instrument_graph = Some(graph);
let _ = self.event_tx.push(AudioEvent::GraphStateChanged(track_id));
// Emit preset loaded event after everything is loaded
let _ = self.event_tx.push(AudioEvent::GraphPresetLoaded(track_id));
}
}
Err(e) => {
+7 -3
View File
@@ -861,7 +861,9 @@ impl InstrumentGraph {
} else if let Some(ref path) = file_path {
// Fall back to loading from file (resolve path relative to preset)
let resolved_path = resolve_sample_path(path);
let _ = sampler_node.load_sample_from_file(&resolved_path);
if let Err(e) = sampler_node.load_sample_from_file(&resolved_path) {
eprintln!("Failed to load sample from {}: {}", resolved_path, e);
}
}
}
}
@@ -901,14 +903,16 @@ impl InstrumentGraph {
} else if let Some(ref path) = layer.file_path {
// Fall back to loading from file (resolve path relative to preset)
let resolved_path = resolve_sample_path(path);
let _ = multi_sampler_node.load_layer_from_file(
if let Err(e) = multi_sampler_node.load_layer_from_file(
&resolved_path,
layer.key_min,
layer.key_max,
layer.root_key,
layer.velocity_min,
layer.velocity_max,
);
) {
eprintln!("Failed to load sample layer from {}: {}", resolved_path, e);
}
}
}
}