use crate::*; /// Temporal resolutions: sample rate, tempo, MIDI pulses per quaver (beat) /// /// ``` /// /// ``` #[derive(Debug, Clone)] pub struct Timebase { /// Audio samples per second pub sr: SampleRate, /// MIDI beats per minute pub bpm: BeatsPerMinute, /// MIDI ticks per beat pub ppq: PulsesPerQuaver, } /// Iterator that emits subsequent ticks within a range. /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct TicksIterator { pub spp: f64, pub sample: usize, pub start: usize, pub end: usize, } /// /// ``` /// let model = MidiSelection::from((1, false)); /// /// let _ = model.get_time_len(); /// let _ = model.get_time_zoom(); /// let _ = model.get_time_lock(); /// let _ = model.get_time_start(); /// let _ = model.get_time_axis(); /// let _ = model.get_time_end(); /// /// let _ = model.get_note_lo(); /// let _ = model.get_note_axis(); /// let _ = model.get_note_hi(); /// ``` #[derive(Debug, Clone)] pub struct MidiCursor { /// Time coordinate of cursor pub time_pos: Arc, /// Note coordinate of cursor pub note_pos: Arc, /// Length of note that will be inserted, in pulses pub note_len: Arc, } /// /// ``` /// /// ``` #[derive(Debug, Clone, Default)] pub struct MidiSelection { pub time_len: Arc, /// Length of visible time axis pub time_axis: Arc, /// Earliest time displayed pub time_start: Arc, /// Time step pub time_zoom: Arc, /// Auto rezoom to fit in time axis pub time_lock: Arc, /// Length of visible note axis pub note_axis: Arc, // Lowest note displayed pub note_lo: Arc, } /// A point in time in all time scales (microsecond, sample, MIDI pulse) /// /// ``` /// /// ``` #[derive(Debug, Default, Clone)] pub struct Moment { pub timebase: Arc, /// Current time in microseconds pub usec: Microsecond, /// Current time in audio samples pub sample: SampleCount, /// Current time in MIDI pulses pub pulse: Pulse, } /// /// ``` /// /// ``` #[derive(Debug, Clone, Default)] pub enum Moment2 { #[default] None, Zero, Usec(Microsecond), Sample(SampleCount), Pulse(Pulse), } /// MIDI resolution in PPQ (pulses per quarter note) /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct PulsesPerQuaver (pub(crate) AtomicF64); /// Timestamp in MIDI pulses /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct Pulse (pub(crate) AtomicF64); /// Tempo in beats per minute /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct BeatsPerMinute (pub(crate) AtomicF64); /// Quantization setting for launching clips /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct LaunchSync (pub(crate) AtomicF64); /// Quantization setting for notes /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct Quantize (pub(crate) AtomicF64); /// Timestamp in audio samples /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct SampleCount (pub(crate) AtomicF64); /// Audio sample rate in Hz (samples per second) /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct SampleRate (pub(crate) AtomicF64); /// Timestamp in microseconds /// /// ``` /// /// ``` #[derive(Debug, Default)] pub struct Microsecond (pub(crate) AtomicF64);