mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
wip: cleanup old code
This commit is contained in:
parent
0d7f78e74f
commit
5d3e564949
10 changed files with 1464 additions and 1512 deletions
|
|
@ -22,7 +22,7 @@ pub trait HasClips {
|
|||
}
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub struct PoolModel {
|
||||
pub struct MidiPool {
|
||||
pub visible: bool,
|
||||
/// Collection of clips
|
||||
pub clips: Arc<RwLock<Vec<Arc<RwLock<MidiClip>>>>>,
|
||||
|
|
@ -43,7 +43,7 @@ pub enum PoolMode {
|
|||
/// Save clip to disk
|
||||
Export(usize, FileBrowser),
|
||||
}
|
||||
impl Default for PoolModel {
|
||||
impl Default for MidiPool {
|
||||
fn default () -> Self {
|
||||
Self {
|
||||
visible: true,
|
||||
|
|
@ -53,15 +53,15 @@ impl Default for PoolModel {
|
|||
}
|
||||
}
|
||||
}
|
||||
from!(|clip:&Arc<RwLock<MidiClip>>|PoolModel = {
|
||||
from!(|clip:&Arc<RwLock<MidiClip>>|MidiPool = {
|
||||
let model = Self::default();
|
||||
model.clips.write().unwrap().push(clip.clone());
|
||||
model.clip.store(1, Relaxed);
|
||||
model
|
||||
});
|
||||
has_clips!(|self: PoolModel|self.clips);
|
||||
has_clip!(|self: PoolModel|self.clips().get(self.clip_index()).map(|c|c.clone()));
|
||||
impl PoolModel {
|
||||
has_clips!(|self: MidiPool|self.clips);
|
||||
has_clip!(|self: MidiPool|self.clips().get(self.clip_index()).map(|c|c.clone()));
|
||||
impl MidiPool {
|
||||
pub(crate) fn clip_index (&self) -> usize {
|
||||
self.clip.load(Relaxed)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue