mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
add clock to sequencer tracks
This commit is contained in:
parent
67a5ea3a2b
commit
4f53058742
5 changed files with 42 additions and 22 deletions
|
|
@ -46,6 +46,8 @@ pub enum ArrangerStatusBar {
|
|||
}
|
||||
/// Represents the tracks and scenes of the composition.
|
||||
pub struct Arrangement<E: Engine> {
|
||||
/// Global timebase
|
||||
pub clock: Arc<TransportTime>,
|
||||
/// Name of arranger
|
||||
pub name: Arc<RwLock<String>>,
|
||||
/// Collection of phrases.
|
||||
|
|
@ -218,8 +220,9 @@ impl<E: Engine> FocusGrid<ArrangerFocus> for Arranger<E> {
|
|||
}
|
||||
/// General methods for arrangement
|
||||
impl<E: Engine> Arrangement<E> {
|
||||
pub fn new (name: &str, phrases: &Arc<RwLock<PhrasePool<E>>>) -> Self {
|
||||
pub fn new (clock: &Arc<TransportTime>, name: &str, phrases: &Arc<RwLock<PhrasePool<E>>>) -> Self {
|
||||
Self {
|
||||
clock: clock.clone(),
|
||||
name: Arc::new(RwLock::new(name.into())),
|
||||
mode: ArrangementViewMode::Vertical(2),
|
||||
selected: ArrangementFocus::Clip(0, 0),
|
||||
|
|
@ -391,8 +394,8 @@ impl<E: Engine> Arrangement<E> {
|
|||
&mut self, name: Option<&str>, color: Option<Color>
|
||||
) -> Usually<&mut ArrangementTrack<E>> {
|
||||
self.tracks.push(name.map_or_else(
|
||||
|| ArrangementTrack::new(&self.track_default_name(), color),
|
||||
|name| ArrangementTrack::new(name, color),
|
||||
|| ArrangementTrack::new(&self.clock, &self.track_default_name(), color),
|
||||
|name| ArrangementTrack::new(&self.clock, name, color),
|
||||
));
|
||||
let index = self.tracks.len() - 1;
|
||||
Ok(&mut self.tracks[index])
|
||||
|
|
@ -519,11 +522,11 @@ impl<E: Engine> Arrangement<E> {
|
|||
}
|
||||
}
|
||||
impl<E: Engine> ArrangementTrack<E> {
|
||||
pub fn new (name: &str, color: Option<Color>) -> Self {
|
||||
pub fn new (clock: &Arc<TransportTime>, name: &str, color: Option<Color>) -> Self {
|
||||
Self {
|
||||
name: Arc::new(RwLock::new(name.into())),
|
||||
inputs: vec![],
|
||||
player: PhrasePlayer::new(),
|
||||
player: PhrasePlayer::new(clock),
|
||||
outputs: vec![],
|
||||
width: name.len() + 2,
|
||||
color: color.unwrap_or_else(random_color)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue