wip(p64,e4)

This commit is contained in:
🪞👃🪞 2024-11-21 15:44:32 +01:00
parent f49823b7a7
commit fffd830e15
11 changed files with 194 additions and 217 deletions

View file

@ -7,7 +7,7 @@ pub trait HasPlayer: JackApi {
pub trait MidiPlayerApi: MidiInputApi + MidiOutputApi + Send + Sync {}
pub trait HasPhrase: PlayheadApi {
pub trait HasPhrase: ClockApi {
fn reset (&self) -> bool;
fn reset_mut (&mut self) -> &mut bool;
@ -37,7 +37,7 @@ pub trait HasPhrase: PlayheadApi {
}
}
pub trait MidiInputApi: PlayheadApi + HasPhrase {
pub trait MidiInputApi: ClockApi + HasPhrase {
fn midi_ins (&self) -> &Vec<Port<MidiIn>>;
fn midi_ins_mut (&self) -> &mut Vec<Port<MidiIn>>;
fn has_midi_ins (&self) -> bool {
@ -122,7 +122,7 @@ pub trait MidiInputApi: PlayheadApi + HasPhrase {
}
pub trait MidiOutputApi: PlayheadApi + HasPhrase {
pub trait MidiOutputApi: ClockApi + HasPhrase {
fn midi_outs (&self) -> &Vec<Port<MidiOut>>;
fn midi_outs_mut (&mut self) -> &mut Vec<Port<MidiOut>>;
@ -165,7 +165,7 @@ pub trait MidiOutputApi: PlayheadApi + HasPhrase {
// If no phrase is playing, prepare for switchover immediately
next = self.phrase().is_none();
let phrase = self.phrase();
let started0 = self.started();
let started0 = self.transport_offset();
let timebase = self.timebase();
let notes_out = self.notes_out();
let next_phrase = self.next_phrase();
@ -231,7 +231,7 @@ pub trait MidiOutputApi: PlayheadApi + HasPhrase {
//let samples = scope.n_frames() as usize;
if let Some((start_at, phrase)) = &self.next_phrase() {
let start = start_at.sample.get() as usize;
let sample = self.started().read().unwrap().unwrap().0;
let sample = self.transport_offset().read().unwrap().unwrap().0;
// If it's time to switch to the next phrase:
if start <= sample0.saturating_sub(sample) {
// Samples elapsed since phrase was supposed to start