mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: p.47, e=24, and even more todo!
This commit is contained in:
parent
2977247597
commit
28d0020261
9 changed files with 250 additions and 228 deletions
|
|
@ -0,0 +1,6 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
pub trait HasColor {
|
||||||
|
fn color (&self) -> ItemColor;
|
||||||
|
fn color_mut (&self) -> &mut ItemColor;
|
||||||
|
}
|
||||||
|
|
@ -9,15 +9,16 @@ pub(crate) use tek_core::jack::{
|
||||||
};
|
};
|
||||||
|
|
||||||
submod! {
|
submod! {
|
||||||
//api_jack
|
|
||||||
api_clip
|
api_clip
|
||||||
|
api_clock
|
||||||
|
api_color
|
||||||
|
api_jack
|
||||||
|
api_phrase
|
||||||
|
api_player
|
||||||
|
api_playhead
|
||||||
api_scene
|
api_scene
|
||||||
api_track
|
api_track
|
||||||
api_clock
|
|
||||||
api_jack
|
|
||||||
api_player
|
|
||||||
api_phrase
|
|
||||||
api_playhead
|
|
||||||
//api_mixer
|
//api_mixer
|
||||||
//api_channel
|
//api_channel
|
||||||
//api_plugin
|
//api_plugin
|
||||||
|
|
@ -26,13 +27,6 @@ submod! {
|
||||||
//api_sampler
|
//api_sampler
|
||||||
//api_sampler_sample
|
//api_sampler_sample
|
||||||
//api_sampler_voice
|
//api_sampler_voice
|
||||||
|
|
||||||
//model_scene
|
|
||||||
//model_track
|
|
||||||
//model_clock
|
|
||||||
//model_phrase
|
|
||||||
//model_player
|
|
||||||
//model_pool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait JackActivate: Sized {
|
pub trait JackActivate: Sized {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ submod! {
|
||||||
//tui_sampler_cmd
|
//tui_sampler_cmd
|
||||||
tui_sequencer
|
tui_sequencer
|
||||||
tui_sequencer_cmd
|
tui_sequencer_cmd
|
||||||
|
tui_sequencer_jack
|
||||||
|
tui_sequencer_view
|
||||||
|
tui_sequencer_focus
|
||||||
|
tui_sequencer_status
|
||||||
|
|
||||||
tui_status
|
tui_status
|
||||||
tui_theme
|
tui_theme
|
||||||
tui_transport
|
tui_transport
|
||||||
|
|
|
||||||
|
|
@ -65,30 +65,6 @@ impl Content for ArrangerTui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TransportViewState for ArrangerTui {
|
|
||||||
fn focus (&self) -> TransportFocus {
|
|
||||||
self.focus
|
|
||||||
}
|
|
||||||
fn focused (&self) -> bool {
|
|
||||||
self.focused
|
|
||||||
}
|
|
||||||
fn transport_state (&self) -> Option<TransportState> {
|
|
||||||
*self.playing().read().unwrap()
|
|
||||||
}
|
|
||||||
fn bpm_value (&self) -> f64 {
|
|
||||||
self.bpm().get()
|
|
||||||
}
|
|
||||||
fn sync_value (&self) -> f64 {
|
|
||||||
self.sync().get()
|
|
||||||
}
|
|
||||||
fn format_beat (&self) -> String {
|
|
||||||
self.current().format_beat()
|
|
||||||
}
|
|
||||||
fn format_msu (&self) -> String {
|
|
||||||
self.current().usec.format_msu()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn track_widths (tracks: &[ArrangerTrack]) -> Vec<(usize, usize)> {
|
fn track_widths (tracks: &[ArrangerTrack]) -> Vec<(usize, usize)> {
|
||||||
let mut widths = vec![];
|
let mut widths = vec![];
|
||||||
let mut total = 0;
|
let mut total = 0;
|
||||||
|
|
@ -480,3 +456,33 @@ pub fn arranger_content_horizontal (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl TransportViewState for ArrangerTui {
|
||||||
|
fn focus (&self) -> TransportFocus {
|
||||||
|
self.focus
|
||||||
|
}
|
||||||
|
fn focused (&self) -> bool {
|
||||||
|
self.focused
|
||||||
|
}
|
||||||
|
fn transport_state (&self) -> Option<TransportState> {
|
||||||
|
*self.playing().read().unwrap()
|
||||||
|
}
|
||||||
|
fn bpm_value (&self) -> f64 {
|
||||||
|
self.bpm().get()
|
||||||
|
}
|
||||||
|
fn sync_value (&self) -> f64 {
|
||||||
|
self.sync().get()
|
||||||
|
}
|
||||||
|
fn format_beat (&self) -> String {
|
||||||
|
self.current().format_beat()
|
||||||
|
}
|
||||||
|
fn format_msu (&self) -> String {
|
||||||
|
self.current().usec.format_msu()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PhrasesViewState for ArrangerTui {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PhraseViewState for ArrangerTui {
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,105 +69,12 @@ pub enum SequencerFocus {
|
||||||
PhraseEditor,
|
PhraseEditor,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Status bar for sequencer app
|
|
||||||
#[derive(Copy, Clone)]
|
|
||||||
pub enum SequencerStatusBar {
|
|
||||||
Transport,
|
|
||||||
PhrasePool,
|
|
||||||
PhraseEditor,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Content for SequencerTui {
|
|
||||||
type Engine = Tui;
|
|
||||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
|
||||||
col!(
|
|
||||||
widget(&TransportRefView(self)),
|
|
||||||
Split::right(20,
|
|
||||||
widget(&PhrasesView(self)),
|
|
||||||
widget(&PhraseView(self)),
|
|
||||||
).min_y(20)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Audio for SequencerTui {
|
impl Audio for SequencerTui {
|
||||||
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
||||||
self.model.process(client, scope)
|
self.model.process(client, scope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StatusBar for SequencerStatusBar {
|
|
||||||
type State = ();
|
|
||||||
fn hotkey_fg () -> Color {
|
|
||||||
TuiTheme::hotkey_fg()
|
|
||||||
}
|
|
||||||
fn update (&mut self, state: &()) {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Content for SequencerStatusBar {
|
|
||||||
type Engine = Tui;
|
|
||||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
|
||||||
todo!();
|
|
||||||
""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HasFocus for SequencerTui {
|
|
||||||
type Item = SequencerFocus;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FocusEnter for SequencerTui {
|
|
||||||
fn focus_enter (&mut self) {
|
|
||||||
let focused = self.focused();
|
|
||||||
if !self.entered {
|
|
||||||
self.entered = true;
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn focus_exit (&mut self) {
|
|
||||||
if self.entered {
|
|
||||||
self.entered = false;
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn focus_entered (&self) -> Option<Self::Item> {
|
|
||||||
if self.entered {
|
|
||||||
Some(self.focused())
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FocusGrid for SequencerTui {
|
|
||||||
type Item = SequencerFocus;
|
|
||||||
fn focus_cursor (&self) -> (usize, usize) {
|
|
||||||
self.cursor
|
|
||||||
}
|
|
||||||
fn focus_cursor_mut (&mut self) -> &mut (usize, usize) {
|
|
||||||
&mut self.cursor
|
|
||||||
}
|
|
||||||
fn focus_layout (&self) -> &[&[Self::Item]] {
|
|
||||||
use SequencerFocus::*;
|
|
||||||
&[
|
|
||||||
&[Menu, Menu ],
|
|
||||||
&[Transport, Transport ],
|
|
||||||
&[PhrasePool, PhraseEditor],
|
|
||||||
]
|
|
||||||
}
|
|
||||||
fn focus_update (&mut self) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl JackApi for SequencerTui {
|
|
||||||
fn jack (&self) -> &Arc<RwLock<JackClient>> {
|
|
||||||
&self.jack
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl HasPhrases for SequencerTui {
|
impl HasPhrases for SequencerTui {
|
||||||
fn phrases (&self) -> &Vec<Arc<RwLock<Phrase>>> {
|
fn phrases (&self) -> &Vec<Arc<RwLock<Phrase>>> {
|
||||||
&self.phrases
|
&self.phrases
|
||||||
|
|
@ -197,101 +104,3 @@ impl HasPhrase for SequencerTui {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MidiInputApi for SequencerTui {
|
|
||||||
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 SequencerTui {
|
|
||||||
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 SequencerTui {
|
|
||||||
fn timebase (&self) -> &Arc<Timebase> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
fn quant (&self) -> &Quantize {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
fn sync (&self) -> &LaunchSync {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PlayheadApi for SequencerTui {
|
|
||||||
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 SequencerTui {}
|
|
||||||
|
|
||||||
impl TransportViewState for SequencerTui {
|
|
||||||
fn focus (&self) -> TransportFocus {
|
|
||||||
self.focus
|
|
||||||
}
|
|
||||||
fn focused (&self) -> bool {
|
|
||||||
self.focused
|
|
||||||
}
|
|
||||||
fn transport_state (&self) -> Option<TransportState> {
|
|
||||||
*self.playing().read().unwrap()
|
|
||||||
}
|
|
||||||
fn bpm_value (&self) -> f64 {
|
|
||||||
self.bpm().get()
|
|
||||||
}
|
|
||||||
fn sync_value (&self) -> f64 {
|
|
||||||
self.sync().get()
|
|
||||||
}
|
|
||||||
fn format_beat (&self) -> String {
|
|
||||||
self.current().format_beat()
|
|
||||||
}
|
|
||||||
fn format_msu (&self) -> String {
|
|
||||||
self.current().usec.format_msu()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
50
crates/tek_tui/src/tui_sequencer_focus.rs
Normal file
50
crates/tek_tui/src/tui_sequencer_focus.rs
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
impl HasFocus for SequencerTui {
|
||||||
|
type Item = SequencerFocus;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FocusEnter for SequencerTui {
|
||||||
|
type Item = SequencerFocus;
|
||||||
|
fn focus_enter (&mut self) {
|
||||||
|
let focused = self.focused();
|
||||||
|
if !self.entered {
|
||||||
|
self.entered = true;
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn focus_exit (&mut self) {
|
||||||
|
if self.entered {
|
||||||
|
self.entered = false;
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn focus_entered (&self) -> Option<Self::Item> {
|
||||||
|
if self.entered {
|
||||||
|
Some(self.focused())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FocusGrid for SequencerTui {
|
||||||
|
type Item = SequencerFocus;
|
||||||
|
fn focus_cursor (&self) -> (usize, usize) {
|
||||||
|
self.cursor
|
||||||
|
}
|
||||||
|
fn focus_cursor_mut (&mut self) -> &mut (usize, usize) {
|
||||||
|
&mut self.cursor
|
||||||
|
}
|
||||||
|
fn focus_layout (&self) -> &[&[Self::Item]] {
|
||||||
|
use SequencerFocus::*;
|
||||||
|
&[
|
||||||
|
&[Menu, Menu ],
|
||||||
|
&[Transport, Transport ],
|
||||||
|
&[PhrasePool, PhraseEditor],
|
||||||
|
]
|
||||||
|
}
|
||||||
|
fn focus_update (&mut self) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
81
crates/tek_tui/src/tui_sequencer_jack.rs
Normal file
81
crates/tek_tui/src/tui_sequencer_jack.rs
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
impl JackApi for SequencerTui {
|
||||||
|
fn jack (&self) -> &Arc<RwLock<JackClient>> {
|
||||||
|
&self.jack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MidiInputApi for SequencerTui {
|
||||||
|
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 SequencerTui {
|
||||||
|
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 SequencerTui {
|
||||||
|
fn timebase (&self) -> &Arc<Timebase> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
fn quant (&self) -> &Quantize {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
fn sync (&self) -> &LaunchSync {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PlayheadApi for SequencerTui {
|
||||||
|
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 SequencerTui {}
|
||||||
27
crates/tek_tui/src/tui_sequencer_status.rs
Normal file
27
crates/tek_tui/src/tui_sequencer_status.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
/// Status bar for sequencer app
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub enum SequencerStatusBar {
|
||||||
|
Transport,
|
||||||
|
PhrasePool,
|
||||||
|
PhraseEditor,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StatusBar for SequencerStatusBar {
|
||||||
|
type State = ();
|
||||||
|
fn hotkey_fg () -> Color {
|
||||||
|
TuiTheme::hotkey_fg()
|
||||||
|
}
|
||||||
|
fn update (&mut self, state: &()) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Content for SequencerStatusBar {
|
||||||
|
type Engine = Tui;
|
||||||
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
|
todo!();
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
44
crates/tek_tui/src/tui_sequencer_view.rs
Normal file
44
crates/tek_tui/src/tui_sequencer_view.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
|
impl Content for SequencerTui {
|
||||||
|
type Engine = Tui;
|
||||||
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
|
col!(
|
||||||
|
widget(&TransportRefView(self)),
|
||||||
|
Split::right(20,
|
||||||
|
widget(&PhrasesView(self)),
|
||||||
|
widget(&PhraseView(self)),
|
||||||
|
).min_y(20)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TransportViewState for SequencerTui {
|
||||||
|
fn focus (&self) -> TransportFocus {
|
||||||
|
self.focus
|
||||||
|
}
|
||||||
|
fn focused (&self) -> bool {
|
||||||
|
self.focused
|
||||||
|
}
|
||||||
|
fn transport_state (&self) -> Option<TransportState> {
|
||||||
|
*self.playing().read().unwrap()
|
||||||
|
}
|
||||||
|
fn bpm_value (&self) -> f64 {
|
||||||
|
self.bpm().get()
|
||||||
|
}
|
||||||
|
fn sync_value (&self) -> f64 {
|
||||||
|
self.sync().get()
|
||||||
|
}
|
||||||
|
fn format_beat (&self) -> String {
|
||||||
|
self.current().format_beat()
|
||||||
|
}
|
||||||
|
fn format_msu (&self) -> String {
|
||||||
|
self.current().usec.format_msu()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PhrasesViewState for ArrangerTui {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PhraseViewState for ArrangerTui {
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue