mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
remove to_sequencer_command
This commit is contained in:
parent
f71ee5c521
commit
f5dcd3cba1
1 changed files with 48 additions and 67 deletions
|
|
@ -84,26 +84,17 @@ impl Command<SequencerTui> for SequencerCommand {
|
|||
|
||||
impl InputToCommand<Tui, SequencerTui> for SequencerCommand {
|
||||
fn input_to_command (state: &SequencerTui, input: &TuiInput) -> Option<Self> {
|
||||
to_sequencer_command(state, input)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_sequencer_command (state: &SequencerTui, input: &TuiInput) -> Option<SequencerCommand> {
|
||||
Some(match input.event() {
|
||||
|
||||
// Toggle visibility of phrase pool column
|
||||
key_pat!(Tab) => ShowPool(!state.show_pool),
|
||||
|
||||
// Enqueue currently edited phrase
|
||||
key_pat!(Char('q')) => Enqueue(Some(
|
||||
state.phrases.phrases[state.phrases.phrase.load(Ordering::Relaxed)].clone()
|
||||
)),
|
||||
|
||||
// 0: Enqueue phrase 0 (stop all)
|
||||
key_pat!(Char('0')) => Enqueue(Some(
|
||||
state.phrases.phrases[0].clone()
|
||||
)),
|
||||
|
||||
// E: Toggle between editing currently playing or other phrase
|
||||
key_pat!(Char('e')) => if let Some((_, Some(playing_phrase))) = state.player.play_phrase() {
|
||||
let editing_phrase = state.editor.phrase().as_ref().map(|p|p.read().unwrap().clone());
|
||||
|
|
@ -116,21 +107,18 @@ pub fn to_sequencer_command (state: &SequencerTui, input: &TuiInput) -> Option<S
|
|||
} else {
|
||||
return None
|
||||
},
|
||||
|
||||
// Transport: Play/pause
|
||||
key_pat!(Char(' ')) => Clock(if state.clock().is_stopped() {
|
||||
Play(None)
|
||||
} else {
|
||||
Pause(None)
|
||||
}),
|
||||
|
||||
// Transport: Play from start or rewind to start
|
||||
key_pat!(Shift-Char(' ')) => Clock(if state.clock().is_stopped() {
|
||||
Play(Some(0))
|
||||
} else {
|
||||
Pause(Some(0))
|
||||
}),
|
||||
|
||||
// Delegate to components:
|
||||
_ => if let Some(command) = PhraseCommand::input_to_command(&state.editor, input) {
|
||||
Editor(command)
|
||||
|
|
@ -139,9 +127,9 @@ pub fn to_sequencer_command (state: &SequencerTui, input: &TuiInput) -> Option<S
|
|||
} else {
|
||||
return None
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
audio!(|self:SequencerTui, client, scope|{
|
||||
// Start profiling cycle
|
||||
|
|
@ -321,8 +309,6 @@ render!(|self: SequencerStatusBar|Tui::fixed_y(2, row!([
|
|||
Tui::fixed_xy(11, 2, PlayPause(self.playing)),
|
||||
lay!([
|
||||
{
|
||||
let bg = TuiTheme::g(50);
|
||||
let fg = TuiTheme::g(255);
|
||||
let single = |binding, command|row!([" ", col!([
|
||||
Tui::fg(TuiTheme::yellow(), binding),
|
||||
command
|
||||
|
|
@ -331,7 +317,7 @@ render!(|self: SequencerStatusBar|Tui::fixed_y(2, row!([
|
|||
row!([" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,]),
|
||||
row!([" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,]),
|
||||
]);
|
||||
Tui::bg(bg, Tui::fg(fg, row!([
|
||||
Tui::bg(TuiTheme::g(50), Tui::fg(TuiTheme::g(255), row!([
|
||||
single("SPACE", "play/pause"),
|
||||
double((" ✣", "cursor"), ("C-✣", "scroll"), ),
|
||||
double((",.", "note"), ("<>", "triplet"),),
|
||||
|
|
@ -340,15 +326,10 @@ render!(|self: SequencerStatusBar|Tui::fixed_y(2, row!([
|
|||
])))
|
||||
},
|
||||
Tui::fill_xy(Tui::at_se({
|
||||
let orange = TuiTheme::orange();
|
||||
let dark = TuiTheme::g(25);
|
||||
//let cpu = &self.cpu;
|
||||
//let res = &self.res;
|
||||
let size = &self.size;
|
||||
Tui::bg(dark, row!([
|
||||
//Tui::fg(orange, cpu),
|
||||
//Tui::fg(orange, res),
|
||||
Tui::fg(orange, size),
|
||||
Tui::bg(TuiTheme::g(25), row!([
|
||||
Tui::fg(TuiTheme::orange(), &self.cpu),
|
||||
Tui::fg(TuiTheme::orange(), &self.res),
|
||||
Tui::fg(TuiTheme::orange(), &self.size),
|
||||
]))
|
||||
})),
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue