mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
separate Input and Output impls
This commit is contained in:
parent
a6efde40f8
commit
0e821e098f
77 changed files with 465 additions and 454 deletions
|
|
@ -16,7 +16,7 @@ pub trait HasEditor {
|
|||
/// Contains state for viewing and editing a phrase
|
||||
pub struct MidiEditor {
|
||||
pub mode: PianoHorizontal,
|
||||
pub size: Measure<Tui>
|
||||
pub size: Measure<TuiOut>
|
||||
}
|
||||
|
||||
from!(|phrase: &Arc<RwLock<MidiClip>>|MidiEditor = {
|
||||
|
|
@ -40,9 +40,9 @@ impl Default for MidiEditor {
|
|||
}
|
||||
}
|
||||
|
||||
has_size!(<Tui>|self: MidiEditor|&self.size);
|
||||
has_size!(<TuiOut>|self: MidiEditor|&self.size);
|
||||
|
||||
render!(Tui: (self: MidiEditor) => {
|
||||
render!(TuiOut: (self: MidiEditor) => {
|
||||
self.autoscroll();
|
||||
self.autozoom();
|
||||
Fill::xy(Bsp::b(&self.size, &self.mode))
|
||||
|
|
@ -147,7 +147,7 @@ pub enum MidiEditCommand {
|
|||
Show(Option<Arc<RwLock<MidiClip>>>),
|
||||
}
|
||||
|
||||
handle!(<Tui>|self: MidiEditor, input|MidiEditCommand::execute_with_state(self, input.event()));
|
||||
handle!(TuiIn: |self: MidiEditor, input|MidiEditCommand::execute_with_state(self, input.event()));
|
||||
|
||||
keymap!(KEYS_MIDI_EDITOR = |s: MidiEditor, _input: Event| MidiEditCommand {
|
||||
key(Up) => SetNoteCursor(s.note_point() + 1),
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ pub trait MidiPlaybackApi: HasPlayPhrase + HasClock + HasMidiOuts {
|
|||
phrase: &RwLock<MidiClip>,
|
||||
pulse: usize,
|
||||
sample: usize,
|
||||
note_buf: &mut Vec<u8>,
|
||||
note_buf: &mut Vec<u8>,
|
||||
out: &mut [Vec<Vec<u8>>],
|
||||
notes: &mut [bool;128]
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct MidiEditClip<'a>(pub &'a MidiEditor);
|
||||
render!(Tui: (self: MidiEditClip<'a>) => {
|
||||
render!(TuiOut: (self: MidiEditClip<'a>) => {
|
||||
let (color, name, length, looped) = if let Some(phrase) = self.0.phrase().as_ref().map(|p|p.read().unwrap()) {
|
||||
(phrase.color, phrase.name.clone(), phrase.length, phrase.looped)
|
||||
} else {
|
||||
|
|
@ -14,7 +14,7 @@ render!(Tui: (self: MidiEditClip<'a>) => {
|
|||
});
|
||||
|
||||
pub struct MidiEditStatus<'a>(pub &'a MidiEditor);
|
||||
render!(Tui: (self: MidiEditStatus<'a>) => {
|
||||
render!(TuiOut: (self: MidiEditStatus<'a>) => {
|
||||
let (color, name, length, looped) = if let Some(phrase) = self.0.phrase().as_ref().map(|p|p.read().unwrap()) {
|
||||
(phrase.color, phrase.name.clone(), phrase.length, phrase.looped)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::*;
|
||||
|
||||
pub trait MidiViewer: HasSize<Tui> + MidiRange + MidiPoint + Debug + Send + Sync {
|
||||
pub trait MidiViewer: HasSize<TuiOut> + MidiRange + MidiPoint + Debug + Send + Sync {
|
||||
fn buffer_size (&self, phrase: &MidiClip) -> (usize, usize);
|
||||
fn redraw (&self);
|
||||
fn phrase (&self) -> &Option<Arc<RwLock<MidiClip>>>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue