Multi sample bulk import

This commit is contained in:
Skyler Lehmkuhl
2026-02-20 01:59:37 -05:00
parent 35089f3b2e
commit 66c848e218
9 changed files with 1176 additions and 2 deletions
+20
View File
@@ -1840,6 +1840,21 @@ impl Engine {
}
}
Command::MultiSamplerClearLayers(track_id, node_id) => {
use crate::audio::node_graph::nodes::MultiSamplerNode;
if let Some(TrackNode::Midi(track)) = self.project.get_track_mut(track_id) {
let graph = &mut track.instrument_graph;
let node_idx = NodeIndex::new(node_id as usize);
if let Some(graph_node) = graph.get_graph_node_mut(node_idx) {
if let Some(multi_sampler_node) = graph_node.node.as_any_mut().downcast_mut::<MultiSamplerNode>() {
multi_sampler_node.clear_layers();
}
}
}
}
Command::AutomationAddKeyframe(track_id, node_id, time, value, interpolation_str, ease_out, ease_in) => {
use crate::audio::node_graph::nodes::{AutomationInputNode, AutomationKeyframe, InterpolationType};
@@ -3329,6 +3344,11 @@ impl EngineController {
let _ = self.command_tx.push(Command::MultiSamplerRemoveLayer(track_id, node_id, layer_index));
}
/// Clear all layers from a MultiSampler node
pub fn multi_sampler_clear_layers(&mut self, track_id: TrackId, node_id: u32) {
let _ = self.command_tx.push(Command::MultiSamplerClearLayers(track_id, node_id));
}
/// Send a synchronous query and wait for the response
/// This blocks until the audio thread processes the query
/// Generic method that works with any Query/QueryResponse pair
@@ -458,6 +458,16 @@ impl MultiSamplerNode {
Ok(())
}
/// Remove all layers
pub fn clear_layers(&mut self) {
self.layers.clear();
self.layer_infos.clear();
// Stop all active voices
for voice in &mut self.voices {
voice.is_active = false;
}
}
/// Find the best matching layer for a given note and velocity
fn find_layer(&self, note: u8, velocity: u8) -> Option<usize> {
self.layers
+2
View File
@@ -194,6 +194,8 @@ pub enum Command {
MultiSamplerUpdateLayer(TrackId, u32, usize, u8, u8, u8, u8, u8, Option<usize>, Option<usize>, LoopMode),
/// Remove a layer from a MultiSampler node (track_id, node_id, layer_index)
MultiSamplerRemoveLayer(TrackId, u32, usize),
/// Clear all layers from a MultiSampler node (track_id, node_id)
MultiSamplerClearLayers(TrackId, u32),
// Automation Input Node commands
/// Add or update a keyframe on an AutomationInput node (track_id, node_id, time, value, interpolation, ease_out, ease_in)