wip: down to 13 errors

This commit is contained in:
🪞👃🪞 2025-05-14 14:35:19 +03:00
parent 6ce83fb27a
commit ebdb8881e9
19 changed files with 793 additions and 691 deletions

View file

@ -6,6 +6,10 @@ pub struct Arrangement {
pub name: Arc<str>,
/// Base color.
pub color: ItemTheme,
/// Jack client handle
pub jack: Jack,
/// Source of time
pub clock: Clock,
/// List of global midi inputs
pub midi_ins: Vec<JackMidiIn>,
/// List of global midi outputs
@ -35,8 +39,8 @@ pub struct Arrangement {
pub arranger: Arc<RwLock<Buffer>>,
/// Display size
pub size: Measure<TuiOut>,
/// Jack client handle
pub jack: Jack,
/// Contains all clips in arrangement
pub pool: Pool,
}
has!(Option<Selection>: |self: Arrangement|self.selected);
@ -45,6 +49,7 @@ has!(Vec<JackMidiOut>: |self: Arrangement|self.midi_outs);
has!(Vec<Scene>: |self: Arrangement|self.scenes);
has!(Vec<Track>: |self: Arrangement|self.tracks);
has!(Jack: |self: Arrangement|self.jack);
has!(Clock: |self: Arrangement|self.clock);
impl Arrangement {
/// Width of display
@ -57,7 +62,8 @@ impl Arrangement {
}
/// Width taken by all tracks.
pub(crate) fn w_tracks (&self) -> u16 {
self.tracks_with_sizes().last().map(|(_, _, _, x)|x as u16).unwrap_or(0)
self.tracks_with_sizes(&self.selected, None).last()
.map(|(_, _, _, x)|x as u16).unwrap_or(0)
}
/// Width available to display tracks.
pub(crate) fn w_tracks_area (&self, is_editing: bool) -> u16 {
@ -114,3 +120,15 @@ impl Arrangement {
//1 + self.devices_with_sizes().last().map(|(_, _, _, _, y)|y as u16).unwrap_or(0)
}
}
#[cfg(feature = "sampler")]
impl Arrangement {
/// Get the first sampler of the active track
pub fn sampler (&self) -> Option<&Sampler> {
self.track().map(|t|t.sampler(0)).flatten()
}
/// Get the first sampler of the active track
pub fn sampler_mut (&mut self) -> Option<&mut Sampler> {
self.track_mut().map(|t|t.sampler_mut(0)).flatten()
}
}