mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
wip: AudioEngine pt.2 (rewrite activation sanely)
This commit is contained in:
parent
2303b258f6
commit
746e29aeb3
8 changed files with 104 additions and 106 deletions
|
|
@ -3,7 +3,7 @@ use crate::*;
|
|||
/// Root level object for standalone `tek_arranger`
|
||||
pub struct Arranger<E: Engine> {
|
||||
/// JACK client handle (needs to not be dropped for standalone mode to work).
|
||||
pub jack: Option<Arc<JackClient>>,
|
||||
pub jack: Arc<RwLock<JackClient>>,
|
||||
/// Which view is focused
|
||||
pub focus_cursor: (usize, usize),
|
||||
/// Controls the JACK transport.
|
||||
|
|
@ -51,7 +51,7 @@ pub enum ArrangerStatusBar {
|
|||
/// Represents the tracks and scenes of the composition.
|
||||
pub struct Arrangement<E: Engine> {
|
||||
/// Global JACK client
|
||||
pub jack: Arc<JackClient>,
|
||||
pub jack: Arc<RwLock<JackClient>>,
|
||||
/// Global timebase
|
||||
pub clock: Arc<TransportTime>,
|
||||
/// Name of arranger
|
||||
|
|
@ -120,26 +120,27 @@ pub struct HorizontalArranger<'a, E: Engine>(pub &'a Arrangement<E>);
|
|||
/// General methods for arranger
|
||||
impl<E: Engine> Arranger<E> {
|
||||
pub fn new (
|
||||
jack: &Arc<RwLock<JackClient>>,
|
||||
transport: Option<Arc<RwLock<TransportToolbar<E>>>>,
|
||||
arrangement: Arrangement<E>,
|
||||
phrases: Arc<RwLock<PhrasePool<E>>>,
|
||||
) -> Self {
|
||||
let mut app = Self {
|
||||
jack: None,
|
||||
focus_cursor: (0, 1),
|
||||
phrases_split: 20,
|
||||
jack: jack.clone(),
|
||||
focus_cursor: (0, 1),
|
||||
phrases_split: 20,
|
||||
arrangement_split: 21,
|
||||
editor: PhraseEditor::new(),
|
||||
status: ArrangerStatusBar::ArrangementClip,
|
||||
editor: PhraseEditor::new(),
|
||||
status: ArrangerStatusBar::ArrangementClip,
|
||||
transport: transport.clone(),
|
||||
arrangement,
|
||||
phrases,
|
||||
size: Measure::new(),
|
||||
clock: if let Some(ref transport) = transport {
|
||||
transport.read().unwrap().clock.clone()
|
||||
} else {
|
||||
Arc::new(TransportTime::default())
|
||||
},
|
||||
transport,
|
||||
arrangement,
|
||||
phrases,
|
||||
size: Measure::new(),
|
||||
};
|
||||
app.update_focus();
|
||||
app
|
||||
|
|
@ -226,7 +227,7 @@ impl<E: Engine> FocusGrid<ArrangerFocus> for Arranger<E> {
|
|||
/// General methods for arrangement
|
||||
impl<E: Engine> Arrangement<E> {
|
||||
pub fn new (
|
||||
jack: &Arc<JackClient>,
|
||||
jack: &Arc<RwLock<JackClient>>,
|
||||
clock: &Arc<TransportTime>,
|
||||
name: &str,
|
||||
phrases: &Arc<RwLock<PhrasePool<E>>>
|
||||
|
|
@ -537,16 +538,16 @@ impl<E: Engine> Arrangement<E> {
|
|||
}
|
||||
impl ArrangementTrack {
|
||||
pub fn new (
|
||||
jack: &Arc<JackClient>,
|
||||
jack: &Arc<RwLock<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(jack, clock),
|
||||
name: Arc::new(RwLock::new(name.into())),
|
||||
width: name.len() + 2,
|
||||
color: color.unwrap_or_else(ItemColor::random),
|
||||
player: PhrasePlayer::new(&jack, clock),
|
||||
}
|
||||
}
|
||||
pub fn longest_name (tracks: &[Self]) -> usize {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue