transport -> clock

This commit is contained in:
🪞👃🪞 2025-01-02 13:04:57 +01:00
parent 7f57465b3a
commit 7a4fa1692b
15 changed files with 37 additions and 36 deletions

View file

@ -102,7 +102,7 @@ pub trait HasPlayer {
/// Contains state for playing a phrase
pub struct MidiPlayer {
/// State of clock and playhead
pub(crate) clock: ClockModel,
pub(crate) clock: Clock,
/// Start time and phrase being played
pub(crate) play_phrase: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>,
/// Start time and next phrase
@ -135,7 +135,7 @@ impl MidiPlayer {
) -> Usually<Self> {
let name = name.as_ref();
Ok(Self {
clock: ClockModel::from(jack),
clock: Clock::from(jack),
play_phrase: None,
next_phrase: None,
recording: false,
@ -166,7 +166,7 @@ impl std::fmt::Debug for MidiPlayer {
.finish()
}
}
from!(|clock: &ClockModel| MidiPlayer = Self {
from!(|clock: &Clock| MidiPlayer = Self {
clock: clock.clone(),
midi_ins: vec![],
midi_outs: vec![],
@ -180,7 +180,7 @@ from!(|clock: &ClockModel| MidiPlayer = Self {
notes_in: RwLock::new([false;128]).into(),
notes_out: RwLock::new([false;128]).into(),
});
from!(|state: (&ClockModel, &Arc<RwLock<MidiClip>>)|MidiPlayer = {
from!(|state: (&Clock, &Arc<RwLock<MidiClip>>)|MidiPlayer = {
let (clock, phrase) = state;
let mut model = Self::from(clock);
model.play_phrase = Some((Moment::zero(&clock.timebase), Some(phrase.clone())));