remodularize 3

This commit is contained in:
🪞👃🪞 2025-01-08 19:40:06 +01:00
parent d38dc14e84
commit 113e7b0bad
24 changed files with 262 additions and 370 deletions

View file

@ -21,29 +21,29 @@ pub trait HasPlayer {
/// Contains state for playing a phrase
pub struct MidiPlayer {
/// State of clock and playhead
pub(crate) clock: Clock,
pub clock: Clock,
/// Start time and phrase being played
pub(crate) play_phrase: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>,
pub play_phrase: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>,
/// Start time and next phrase
pub(crate) next_phrase: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>,
pub next_phrase: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>,
/// Play input through output.
pub(crate) monitoring: bool,
pub monitoring: bool,
/// Write input to sequence.
pub(crate) recording: bool,
pub recording: bool,
/// Overdub input to sequence.
pub(crate) overdub: bool,
pub overdub: bool,
/// Send all notes off
pub(crate) reset: bool, // TODO?: after Some(nframes)
pub reset: bool, // TODO?: after Some(nframes)
/// Record from MIDI ports to current sequence.
pub midi_ins: Vec<Port<MidiIn>>,
pub midi_ins: Vec<Port<MidiIn>>,
/// Play from current sequence to MIDI ports
pub midi_outs: Vec<Port<MidiOut>>,
pub midi_outs: Vec<Port<MidiOut>>,
/// Notes currently held at input
pub(crate) notes_in: Arc<RwLock<[bool; 128]>>,
pub notes_in: Arc<RwLock<[bool; 128]>>,
/// Notes currently held at output
pub(crate) notes_out: Arc<RwLock<[bool; 128]>>,
pub notes_out: Arc<RwLock<[bool; 128]>>,
/// MIDI output buffer
pub note_buf: Vec<u8>,
pub note_buf: Vec<u8>,
}
impl MidiPlayer {
pub fn new (