add clips with enter

This commit is contained in:
🪞👃🪞 2025-01-11 17:48:44 +01:00
parent 156504b5ba
commit efa35834de
3 changed files with 33 additions and 26 deletions

View file

@ -5,6 +5,11 @@ pub type ClipPool = Vec<Arc<RwLock<MidiClip>>>;
pub trait HasClips {
fn clips <'a> (&'a self) -> std::sync::RwLockReadGuard<'a, ClipPool>;
fn clips_mut <'a> (&'a self) -> std::sync::RwLockWriteGuard<'a, ClipPool>;
fn add_clip (&self) -> (usize, Arc<RwLock<MidiClip>>) {
let clip = Arc::new(RwLock::new(MidiClip::new("Clip", true, 384, None, None)));
self.clips_mut().push(clip.clone());
(self.clips().len() - 1, clip)
}
}
#[macro_export] macro_rules! has_clips {