Merge branch 'new_timeline' of github.com:skykooler/Lightningbeam into new_timeline

This commit is contained in:
Skyler Lehmkuhl
2025-11-06 23:42:50 -05:00
16 changed files with 3093 additions and 151 deletions
+22
View File
@@ -398,6 +398,24 @@ impl Engine {
_ => {}
}
}
Command::TrimClip(track_id, clip_id, new_start_time, new_duration, new_offset) => {
match self.project.get_track_mut(track_id) {
Some(crate::audio::track::TrackNode::Audio(track)) => {
if let Some(clip) = track.clips.iter_mut().find(|c| c.id == clip_id) {
clip.start_time = new_start_time;
clip.duration = new_duration;
clip.offset = new_offset;
}
}
Some(crate::audio::track::TrackNode::Midi(track)) => {
if let Some(clip) = track.clips.iter_mut().find(|c| c.id == clip_id) {
clip.start_time = new_start_time;
clip.duration = new_duration;
}
}
_ => {}
}
}
Command::CreateMetatrack(name) => {
let track_id = self.project.add_group_track(name.clone(), None);
// Notify UI about the new metatrack
@@ -1911,6 +1929,10 @@ impl EngineController {
let _ = self.command_tx.push(Command::MoveClip(track_id, clip_id, new_start_time));
}
pub fn trim_clip(&mut self, track_id: TrackId, clip_id: ClipId, new_start_time: f64, new_duration: f64, new_offset: f64) {
let _ = self.command_tx.push(Command::TrimClip(track_id, clip_id, new_start_time, new_duration, new_offset));
}
/// Send a generic command to the audio thread
pub fn send_command(&mut self, command: Command) {
let _ = self.command_tx.push(command);
+2
View File
@@ -29,6 +29,8 @@ pub enum Command {
// Clip management commands
/// Move a clip to a new timeline position
MoveClip(TrackId, ClipId, f64),
/// Trim a clip (track_id, clip_id, new_start_time, new_duration, new_offset)
TrimClip(TrackId, ClipId, f64, f64, f64),
// Metatrack management commands
/// Create a new metatrack with a name