mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 13:16:44 +01:00
wip: p.55, e=95
This commit is contained in:
parent
54fb5b6ece
commit
37ac7823af
10 changed files with 272 additions and 219 deletions
|
|
@ -1,58 +1,16 @@
|
|||
use crate::*;
|
||||
|
||||
pub trait TransportControl {
|
||||
fn quant (&self) -> &Quantize;
|
||||
fn bpm (&self) -> &BeatsPerMinute;
|
||||
fn next_quant (&self) -> f64 {
|
||||
next_note_length(self.quant().get() as usize) as f64
|
||||
}
|
||||
fn prev_quant (&self) -> f64 {
|
||||
prev_note_length(self.quant().get() as usize) as f64
|
||||
}
|
||||
fn sync (&self) -> &LaunchSync;
|
||||
fn next_sync (&self) -> f64 {
|
||||
next_note_length(self.sync().get() as usize) as f64
|
||||
}
|
||||
fn prev_sync (&self) -> f64 {
|
||||
prev_note_length(self.sync().get() as usize) as f64
|
||||
}
|
||||
}
|
||||
pub trait TransportControl: ClockApi {}
|
||||
|
||||
impl TransportControl for TransportTui {
|
||||
fn bpm (&self) -> &BeatsPerMinute {
|
||||
&self.current.timebase.bpm
|
||||
}
|
||||
fn quant (&self) -> &Quantize {
|
||||
&self.quant
|
||||
}
|
||||
fn sync (&self) -> &LaunchSync {
|
||||
&self.sync
|
||||
}
|
||||
}
|
||||
impl TransportControl for TransportTui {}
|
||||
|
||||
impl TransportControl for SequencerTui {
|
||||
fn bpm (&self) -> &BeatsPerMinute {
|
||||
&self.current.timebase.bpm
|
||||
}
|
||||
fn quant (&self) -> &Quantize {
|
||||
&self.quant
|
||||
}
|
||||
fn sync (&self) -> &LaunchSync {
|
||||
&self.sync
|
||||
}
|
||||
}
|
||||
impl TransportControl for SequencerTui {}
|
||||
|
||||
impl TransportControl for ArrangerTui {
|
||||
fn bpm (&self) -> &BeatsPerMinute {
|
||||
&self.current.timebase.bpm
|
||||
}
|
||||
fn quant (&self) -> &Quantize {
|
||||
&self.quant
|
||||
}
|
||||
fn sync (&self) -> &LaunchSync {
|
||||
&self.sync
|
||||
}
|
||||
}
|
||||
impl TransportControl for ArrangerTui {}
|
||||
|
||||
pub trait SequencerControl {}
|
||||
|
||||
impl SequencerControl for SequencerTui {}
|
||||
|
||||
pub trait ArrangerControl {
|
||||
fn selected (&self) -> ArrangerSelection;
|
||||
|
|
@ -63,3 +21,93 @@ impl ArrangerControl for ArrangerTui {
|
|||
self.selected
|
||||
}
|
||||
}
|
||||
|
||||
pub trait PhrasesControl {
|
||||
fn phrases_mode (&self) -> &Option<PhrasesMode>;
|
||||
fn phrases_mode_mut (&mut self) -> &mut Option<PhrasesMode>;
|
||||
fn phrase_rename_begin (&mut self) {
|
||||
*self.phrases_mode_mut() = Some(PhrasesMode::Rename(
|
||||
self.phrase,
|
||||
self.phrases[self.phrase].read().unwrap().name.clone()
|
||||
))
|
||||
}
|
||||
fn phrase_length_begin (&mut self) {
|
||||
*self.phrases_mode_mut() = Some(PhrasesMode::Length(
|
||||
self.phrase,
|
||||
self.phrases[self.phrase].read().unwrap().length,
|
||||
PhraseLengthFocus::Bar
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
impl PhrasesControl for SequencerTui {
|
||||
fn phrases_mode (&self) -> &Option<PhrasesMode> {
|
||||
&self.phrases_mode
|
||||
}
|
||||
fn phrases_mode_mut (&mut self) -> &mut Option<PhrasesMode> {
|
||||
&mut self.phrases_mode
|
||||
}
|
||||
}
|
||||
|
||||
impl PhrasesControl for ArrangerTui {
|
||||
fn phrases_mode (&self) -> &Option<PhrasesMode> {
|
||||
&self.phrases_mode
|
||||
}
|
||||
fn phrases_mode_mut (&mut self) -> &mut Option<PhrasesMode> {
|
||||
&mut self.phrases_mode
|
||||
}
|
||||
}
|
||||
|
||||
impl PhrasesControl for PhrasesTui {
|
||||
fn phrases_mode (&self) -> &Option<PhrasesMode> {
|
||||
&self.mode
|
||||
}
|
||||
fn phrases_mode_mut (&mut self) -> &mut Option<PhrasesMode> {
|
||||
&mut self.mode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub trait PhraseControl {
|
||||
fn phrase_entered (&self) -> bool;
|
||||
fn time_axis (&self) -> &RwLock<ScaledAxis<usize>>;
|
||||
fn note_axis (&self) -> &RwLock<FixedAxis<usize>>;
|
||||
fn note_len (&self) -> usize;
|
||||
fn note_len_mut (&mut self) -> &mut usize;
|
||||
}
|
||||
|
||||
impl PhraseControl for SequencerTui {
|
||||
fn phrase_entered (&self) -> bool {
|
||||
self.entered && self.focused() == SequencerFocus::PhraseEditor
|
||||
}
|
||||
fn time_axis (&self) -> &RwLock<ScaledAxis<usize>> {
|
||||
todo!()
|
||||
}
|
||||
fn note_axis (&self) -> &RwLock<FixedAxis<usize>> {
|
||||
todo!()
|
||||
}
|
||||
fn note_len (&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
fn note_len_mut (&mut self) -> &mut usize {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl PhraseControl for ArrangerTui {
|
||||
fn phrase_entered (&self) -> bool {
|
||||
self.entered && self.focused() == ArrangerFocus::PhraseEditor
|
||||
}
|
||||
fn time_axis (&self) -> &RwLock<ScaledAxis<usize>> {
|
||||
todo!()
|
||||
}
|
||||
fn note_axis (&self) -> &RwLock<FixedAxis<usize>> {
|
||||
todo!()
|
||||
}
|
||||
fn note_len (&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
fn note_len_mut (&mut self) -> &mut usize {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue