Phrase -> Clip in all remaining places

This commit is contained in:
🪞👃🪞 2025-01-11 22:50:57 +01:00
parent 06b643e2b1
commit bb52555183
15 changed files with 916 additions and 936 deletions

View file

@ -9,7 +9,7 @@ pub trait HasMidiIns {
}
}
pub trait MidiRecordApi: HasClock + HasPlayPhrase + HasMidiIns {
pub trait MidiRecordApi: HasClock + HasPlayClip + HasMidiIns {
fn notes_in (&self) -> &Arc<RwLock<[bool;128]>>;
fn recording (&self) -> bool;

View file

@ -1,6 +1,6 @@
use crate::*;
pub trait HasPlayPhrase: HasClock {
pub trait HasPlayClip: HasClock {
fn reset (&self) -> bool;
fn reset_mut (&mut self) -> &mut bool;
fn play_clip (&self) -> &Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>;

View file

@ -11,7 +11,7 @@ pub trait HasMidiOuts {
fn midi_note (&mut self) -> &mut Vec<u8>;
}
pub trait MidiPlaybackApi: HasPlayPhrase + HasClock + HasMidiOuts {
pub trait MidiPlaybackApi: HasPlayClip + HasClock + HasMidiOuts {
fn notes_out (&self) -> &Arc<RwLock<[bool;128]>>;
@ -117,7 +117,7 @@ pub trait MidiPlaybackApi: HasPlayPhrase + HasClock + HasMidiOuts {
) {
// Source clip from which the MIDI events will be taken.
let clip = clip.read().unwrap();
// Phrase with zero length is not processed
// Clip with zero length is not processed
if clip.length > 0 {
// Current pulse index in source clip
let pulse = pulse % clip.length;

View file

@ -186,7 +186,7 @@ impl MidiPlaybackApi for MidiPlayer {
}
}
impl HasPlayPhrase for MidiPlayer {
impl HasPlayClip for MidiPlayer {
fn reset (&self) -> bool {
self.reset
}
@ -212,9 +212,9 @@ impl HasPlayPhrase for MidiPlayer {
///// Global timebase
//pub clock: Arc<Clock>,
///// Start time and clip being played
//pub play_clip: Option<(Moment, Option<Arc<RwLock<Phrase>>>)>,
//pub play_clip: Option<(Moment, Option<Arc<RwLock<Clip>>>)>,
///// Start time and next clip
//pub next_clip: Option<(Moment, Option<Arc<RwLock<Phrase>>>)>,
//pub next_clip: Option<(Moment, Option<Arc<RwLock<Clip>>>)>,
///// Play input through output.
//pub monitoring: bool,
///// Write input to sequence.

View file

@ -13,7 +13,7 @@ render!(TuiOut: (self: ClipSelected) =>
impl ClipSelected {
/// Shows currently playing clip with beats elapsed
pub fn play_clip <T: HasPlayPhrase + HasClock> (state: &T) -> Self {
pub fn play_clip <T: HasPlayClip + HasClock> (state: &T) -> Self {
let (name, color) = if let Some((_, Some(clip))) = state.play_clip() {
let MidiClip { ref name, color, .. } = *clip.read().unwrap();
(name.clone().into(), color)
@ -33,7 +33,7 @@ impl ClipSelected {
}
/// Shows next clip with beats remaining until switchover
pub fn next_clip <T: HasPlayPhrase> (state: &T) -> Self {
pub fn next_clip <T: HasPlayClip> (state: &T) -> Self {
let mut time: Arc<str> = String::from("--.-.--").into();
let mut name: Arc<str> = String::from("").into();
let mut color = ItemPalette::from(TuiTheme::g(64));