mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
transport toolbar docs and cleanup
This commit is contained in:
parent
b3db10607a
commit
5671e19910
2 changed files with 26 additions and 13 deletions
|
|
@ -11,19 +11,36 @@ pub struct TransportToolbar<E: Engine> {
|
||||||
pub jack: Option<JackClient>,
|
pub jack: Option<JackClient>,
|
||||||
/// JACK transport handle.
|
/// JACK transport handle.
|
||||||
pub transport: Option<Transport>,
|
pub transport: Option<Transport>,
|
||||||
/// Quantization factor
|
|
||||||
/// Global frame and usec at which playback started
|
/// Global frame and usec at which playback started
|
||||||
pub started: Option<(usize, usize)>,
|
pub started: Option<(usize, usize)>,
|
||||||
|
/// Whether the toolbar is focused
|
||||||
pub focused: bool,
|
pub focused: bool,
|
||||||
|
/// Which part of the toolbar is focused
|
||||||
pub focus: TransportToolbarFocus,
|
pub focus: TransportToolbarFocus,
|
||||||
|
/// Playback state
|
||||||
pub playing: Option<TransportState>,
|
pub playing: Option<TransportState>,
|
||||||
|
/// Current tempo
|
||||||
pub bpm: f64,
|
pub bpm: f64,
|
||||||
|
/// Quantization factor
|
||||||
pub quant: usize,
|
pub quant: usize,
|
||||||
|
/// Launch sync
|
||||||
pub sync: usize,
|
pub sync: usize,
|
||||||
|
/// Current time in frames
|
||||||
pub frame: usize,
|
pub frame: usize,
|
||||||
|
/// Current time in pulses
|
||||||
pub pulse: usize,
|
pub pulse: usize,
|
||||||
pub ppq: usize,
|
/// Current time in microseconds
|
||||||
pub usecs: usize,
|
pub usecs: usize,
|
||||||
|
/// Pulses per quarter note
|
||||||
|
pub ppq: usize,
|
||||||
|
}
|
||||||
|
#[derive(Clone, Copy, PartialEq)]
|
||||||
|
pub enum TransportToolbarFocus {
|
||||||
|
Bpm,
|
||||||
|
Sync,
|
||||||
|
PlayPause,
|
||||||
|
Clock,
|
||||||
|
Quant,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: Engine> TransportToolbar<E> {
|
impl<E: Engine> TransportToolbar<E> {
|
||||||
|
|
@ -112,17 +129,6 @@ impl<E: Engine> TransportToolbar<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E: Engine> Audio for TransportToolbar<E> {
|
|
||||||
fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
|
|
||||||
self.update(&scope);
|
|
||||||
Control::Continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq)]
|
|
||||||
pub enum TransportToolbarFocus { PlayPause, Bpm, Quant, Sync, Clock, }
|
|
||||||
impl TransportToolbarFocus {
|
impl TransportToolbarFocus {
|
||||||
pub fn next (&mut self) {
|
pub fn next (&mut self) {
|
||||||
*self = match self {
|
*self = match self {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
use crate::*;
|
||||||
|
impl<E: Engine> Audio for TransportToolbar<E> {
|
||||||
|
fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
|
||||||
|
self.update(&scope);
|
||||||
|
Control::Continue
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue