mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
wip: refactor pt.42 (84e) lotta todo!
This commit is contained in:
parent
bf0e14c252
commit
638298ad32
11 changed files with 536 additions and 335 deletions
|
|
@ -28,7 +28,7 @@ pub type ArrangerApp<E: Engine> = AppView<
|
|||
ArrangerStatusBar
|
||||
>;
|
||||
|
||||
impl Audio for ArrangerApp {
|
||||
impl<E: Engine> Audio for ArrangerApp<E> {
|
||||
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||
ArrangerRefAudio(self.app).process(client, scope)
|
||||
}
|
||||
|
|
@ -78,9 +78,19 @@ impl InputToCommand<Tui, ArrangerApp<Tui>> for ArrangerAppCommand {
|
|||
Self::App(Playhead(PlayheadCommand::Play(None)))
|
||||
},
|
||||
_ => Self::App(match view.focused() {
|
||||
Content(ArrangerViewFocus::Transport) => Transport(
|
||||
TransportCommand::input_to_command(&view.app.transport, input)?
|
||||
),
|
||||
Content(ArrangerViewFocus::Transport) => {
|
||||
match TransportCommand::input_to_command(&view.app.transport, input)? {
|
||||
Focus(command) => {
|
||||
todo!()
|
||||
},
|
||||
App(Clock(command)) => {
|
||||
todo!()
|
||||
},
|
||||
App(Playhead(command)) => {
|
||||
todo!()
|
||||
},
|
||||
}
|
||||
},
|
||||
Content(ArrangerViewFocus::PhraseEditor) => Editor(
|
||||
PhraseEditorCommand::input_to_command(&view.app.editor, input)?
|
||||
),
|
||||
|
|
@ -280,8 +290,8 @@ impl HasJack for ArrangerView<Tui> {
|
|||
}
|
||||
|
||||
impl ClockApi for ArrangerView<Tui> {
|
||||
fn current (&self) -> &Instant {
|
||||
&self.current
|
||||
fn timebase (&self) -> &Arc<Timebase> {
|
||||
&self.current.timebase
|
||||
}
|
||||
fn quant (&self) -> &Quantize {
|
||||
&self.quant
|
||||
|
|
@ -291,6 +301,21 @@ impl ClockApi for ArrangerView<Tui> {
|
|||
}
|
||||
}
|
||||
|
||||
impl PlayheadApi for ArrangerView<Tui> {
|
||||
fn current (&self) -> &Instant {
|
||||
&self.current
|
||||
}
|
||||
fn transport (&self) -> &jack::Transport {
|
||||
&self.transport
|
||||
}
|
||||
fn playing (&self) -> &RwLock<Option<TransportState>> {
|
||||
&self.playing
|
||||
}
|
||||
fn started (&self) -> &RwLock<Option<(usize, usize)>> {
|
||||
&self.started
|
||||
}
|
||||
}
|
||||
|
||||
impl HasPhrases for ArrangerView<Tui> {
|
||||
fn phrases (&self) -> &Vec<Arc<RwLock<Phrase>>> {
|
||||
&self.phrases
|
||||
|
|
@ -986,16 +1011,17 @@ pub fn arranger_content_vertical (
|
|||
view: &ArrangerView<Tui>,
|
||||
factor: usize
|
||||
) -> impl Widget<Engine = Tui> + use<'_> {
|
||||
let clock = view.clock();
|
||||
let tracks = view.tracks();
|
||||
let scenes = view.scenes();
|
||||
let cols = track_widths(tracks);
|
||||
let rows = ArrangerScene::ppqs(scenes, factor);
|
||||
let bg = view.color;
|
||||
let clip_bg = TuiTheme::border_bg();
|
||||
let sep_fg = TuiTheme::separator_fg(false);
|
||||
let header_h = 3u16;//5u16;
|
||||
let scenes_w = 3 + ArrangerScene::longest_name(scenes) as u16; // x of 1st track
|
||||
let timebase = view.timebase();
|
||||
let current = view.current();
|
||||
let tracks = view.tracks();
|
||||
let scenes = view.scenes();
|
||||
let cols = track_widths(tracks);
|
||||
let rows = ArrangerScene::ppqs(scenes, factor);
|
||||
let bg = view.color;
|
||||
let clip_bg = TuiTheme::border_bg();
|
||||
let sep_fg = TuiTheme::separator_fg(false);
|
||||
let header_h = 3u16;//5u16;
|
||||
let scenes_w = 3 + ArrangerScene::longest_name(scenes) as u16; // x of 1st track
|
||||
let arrangement = Layers::new(move |add|{
|
||||
let rows: &[(usize, usize)] = rows.as_ref();
|
||||
let cols: &[(usize, usize)] = cols.as_ref();
|
||||
|
|
@ -1033,7 +1059,7 @@ pub fn arranger_content_vertical (
|
|||
let elapsed = if let Some((_, Some(phrase))) = track.phrase().as_ref() {
|
||||
let length = phrase.read().unwrap().length;
|
||||
let elapsed = track.pulses_since_start().unwrap();
|
||||
let elapsed = clock.timebase().format_beats_1_short(
|
||||
let elapsed = timebase.format_beats_1_short(
|
||||
(elapsed as usize % length) as f64
|
||||
);
|
||||
format!("▎+{elapsed:>}")
|
||||
|
|
@ -1043,21 +1069,21 @@ pub fn arranger_content_vertical (
|
|||
// beats until switchover
|
||||
let until_next = track.next_phrase().as_ref().map(|(t, _)|{
|
||||
let target = t.pulse.get();
|
||||
let current = clock.current.pulse.get();
|
||||
let current = current.pulse.get();
|
||||
if target > current {
|
||||
let remaining = target - current;
|
||||
format!("▎-{:>}", clock.timebase().format_beats_0_short(remaining))
|
||||
format!("▎-{:>}", timebase.format_beats_0_short(remaining))
|
||||
} else {
|
||||
String::new()
|
||||
}
|
||||
}).unwrap_or(String::from("▎"));
|
||||
// name of active MIDI input
|
||||
let input = format!("▎>{}", track.midi_inputs().get(0)
|
||||
let input = format!("▎>{}", track.midi_ins().get(0)
|
||||
.map(|port|port.short_name())
|
||||
.transpose()?
|
||||
.unwrap_or("(none)".into()));
|
||||
// name of active MIDI output
|
||||
let output = format!("▎<{}", track.midi_outputs().get(0)
|
||||
let output = format!("▎<{}", track.midi_outs().get(0)
|
||||
.map(|port|port.short_name())
|
||||
.transpose()?
|
||||
.unwrap_or("(none)".into()));
|
||||
|
|
@ -1437,22 +1463,105 @@ impl ArrangerTrackApi for ArrangerTrack {
|
|||
}
|
||||
|
||||
impl HasMidiBuffer for ArrangerTrack {
|
||||
fn midi_buffer (&self) -> &Vec<Vec<Vec<u8>>> {
|
||||
todo!()
|
||||
}
|
||||
fn midi_buffer_mut (&self) -> &mut Vec<Vec<Vec<u8>>> {
|
||||
todo!()
|
||||
}
|
||||
fn reset (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn reset_mut (&mut self) -> &mut bool {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl HasPhrase for ArrangerTrack {
|
||||
fn phrase (&self) -> &Option<(Instant, Option<Arc<RwLock<Phrase>>>)> {
|
||||
todo!()
|
||||
}
|
||||
fn phrase_mut (&self) -> &mut Option<(Instant, Option<Arc<RwLock<Phrase>>>)> {
|
||||
todo!()
|
||||
}
|
||||
fn next_phrase (&self) -> &Option<(Instant, Option<Arc<RwLock<Phrase>>>)> {
|
||||
todo!()
|
||||
}
|
||||
fn next_phrase_mut (&mut self) -> &mut Option<(Instant, Option<Arc<RwLock<Phrase>>>)> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl MidiInputApi for ArrangerTrack {
|
||||
fn midi_ins(&self) -> &Vec<Port<jack::MidiIn>> {
|
||||
todo!()
|
||||
}
|
||||
fn midi_ins_mut(&self) -> &mut Vec<Port<jack::MidiIn>> {
|
||||
todo!()
|
||||
}
|
||||
fn recording(&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn recording_mut(&mut self) -> &mut bool {
|
||||
todo!()
|
||||
}
|
||||
fn monitoring(&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn monitoring_mut(&mut self) -> &mut bool {
|
||||
todo!()
|
||||
}
|
||||
fn overdub(&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn overdub_mut(&mut self) -> &mut bool {
|
||||
todo!()
|
||||
}
|
||||
fn notes_in(&self) -> &Arc<RwLock<[bool; 128]>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl MidiOutputApi for ArrangerTrack {
|
||||
fn midi_outs (&self) -> &Vec<Port<jack::MidiOut>> {
|
||||
todo!()
|
||||
}
|
||||
fn midi_outs_mut (&mut self) -> &mut Vec<Port<jack::MidiOut>> {
|
||||
todo!()
|
||||
}
|
||||
fn midi_note (&mut self) -> &mut Vec<u8> {
|
||||
todo!()
|
||||
}
|
||||
fn notes_out (&self) -> &Arc<RwLock<[bool; 128]>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl ClockApi for ArrangerTrack {
|
||||
fn timebase (&self) -> &Arc<Timebase> {
|
||||
todo!()
|
||||
}
|
||||
fn quant (&self) -> &Quantize {
|
||||
todo!()
|
||||
}
|
||||
fn sync (&self) -> &LaunchSync {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl PlayheadApi for ArrangerTrack {
|
||||
fn current(&self) -> &Instant {
|
||||
todo!()
|
||||
}
|
||||
fn transport(&self) -> &Transport {
|
||||
todo!()
|
||||
}
|
||||
fn playing(&self) -> &RwLock<Option<TransportState>> {
|
||||
todo!()
|
||||
}
|
||||
fn started(&self) -> &RwLock<Option<(usize, usize)>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl PlayerApi for ArrangerTrack {
|
||||
}
|
||||
impl PlayerApi for ArrangerTrack {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue