mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: AudioEngine (new jack init)
This commit is contained in:
parent
98cf8da424
commit
2303b258f6
5 changed files with 108 additions and 80 deletions
|
|
@ -50,6 +50,8 @@ pub enum ArrangerStatusBar {
|
|||
}
|
||||
/// Represents the tracks and scenes of the composition.
|
||||
pub struct Arrangement<E: Engine> {
|
||||
/// Global JACK client
|
||||
pub jack: Arc<JackClient>,
|
||||
/// Global timebase
|
||||
pub clock: Arc<TransportTime>,
|
||||
/// Name of arranger
|
||||
|
|
@ -223,8 +225,14 @@ impl<E: Engine> FocusGrid<ArrangerFocus> for Arranger<E> {
|
|||
}
|
||||
/// General methods for arrangement
|
||||
impl<E: Engine> Arrangement<E> {
|
||||
pub fn new (clock: &Arc<TransportTime>, name: &str, phrases: &Arc<RwLock<PhrasePool<E>>>) -> Self {
|
||||
pub fn new (
|
||||
jack: &Arc<JackClient>,
|
||||
clock: &Arc<TransportTime>,
|
||||
name: &str,
|
||||
phrases: &Arc<RwLock<PhrasePool<E>>>
|
||||
) -> Self {
|
||||
Self {
|
||||
jack: jack.clone(),
|
||||
clock: clock.clone(),
|
||||
name: Arc::new(RwLock::new(name.into())),
|
||||
mode: ArrangementViewMode::Vertical(2),
|
||||
|
|
@ -400,8 +408,12 @@ impl<E: Engine> Arrangement<E> {
|
|||
&mut self, name: Option<&str>, color: Option<ItemColor>
|
||||
) -> Usually<&mut ArrangementTrack> {
|
||||
self.tracks.push(name.map_or_else(
|
||||
|| ArrangementTrack::new(&self.clock, &self.track_default_name(), color),
|
||||
|name| ArrangementTrack::new(&self.clock, name, color),
|
||||
|| ArrangementTrack::new(
|
||||
&self.jack, &self.clock, &self.track_default_name(), color
|
||||
),
|
||||
|name| ArrangementTrack::new(
|
||||
&self.jack, &self.clock, name, color
|
||||
),
|
||||
));
|
||||
let index = self.tracks.len() - 1;
|
||||
Ok(&mut self.tracks[index])
|
||||
|
|
@ -524,12 +536,17 @@ impl<E: Engine> Arrangement<E> {
|
|||
}
|
||||
}
|
||||
impl ArrangementTrack {
|
||||
pub fn new (clock: &Arc<TransportTime>, name: &str, color: Option<ItemColor>) -> Self {
|
||||
pub fn new (
|
||||
jack: &Arc<JackClient>,
|
||||
clock: &Arc<TransportTime>,
|
||||
name: &str,
|
||||
color: Option<ItemColor>
|
||||
) -> Self {
|
||||
Self {
|
||||
name: Arc::new(RwLock::new(name.into())),
|
||||
width: name.len() + 2,
|
||||
color: color.unwrap_or_else(ItemColor::random),
|
||||
player: PhrasePlayer::new(clock),
|
||||
player: PhrasePlayer::new(jack, clock),
|
||||
}
|
||||
}
|
||||
pub fn longest_name (tracks: &[Self]) -> usize {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue