mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
wip(p62,e21)
This commit is contained in:
parent
76da19d9c6
commit
5673dd7e8a
14 changed files with 170 additions and 190 deletions
|
|
@ -12,7 +12,7 @@ pub enum FocusCommand {
|
|||
Exit
|
||||
}
|
||||
|
||||
impl<F: HasFocus + FocusGrid + FocusEnter> Command<F> for FocusCommand {
|
||||
impl<F: HasFocus + FocusGrid> Command<F> for FocusCommand {
|
||||
fn execute (self, state: &mut F) -> Perhaps<FocusCommand> {
|
||||
use FocusCommand::*;
|
||||
match self {
|
||||
|
|
@ -46,6 +46,12 @@ pub trait HasFocus {
|
|||
self.focus_next()
|
||||
}
|
||||
}
|
||||
/// Enter the focused item
|
||||
fn focus_enter (&mut self) {}
|
||||
/// Exit the focused item
|
||||
fn focus_exit (&mut self) {}
|
||||
/// Return the focused item, if any
|
||||
fn focus_entered (&self) -> Option<Self::Item> { None }
|
||||
}
|
||||
|
||||
/// Trait for things that implement directional focus.
|
||||
|
|
@ -94,7 +100,7 @@ pub trait FocusGrid {
|
|||
impl<T, U> HasFocus for U
|
||||
where
|
||||
T: Copy + PartialEq + Debug,
|
||||
U: FocusGrid<Item = T> + FocusEnter<Item = T>,
|
||||
U: FocusGrid<Item = T>
|
||||
{
|
||||
type Item = T;
|
||||
fn focused (&self) -> Self::Item {
|
||||
|
|
@ -134,11 +140,3 @@ where
|
|||
self.focus_update();
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait for things that can be focused into.
|
||||
pub trait FocusEnter {
|
||||
type Item: Copy + PartialEq + Debug;
|
||||
fn focus_enter (&mut self) {}
|
||||
fn focus_exit (&mut self) {}
|
||||
fn focus_entered (&self) -> Option<Self::Item>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ pub struct SequencerTui {
|
|||
pub(crate) cursor: (usize, usize),
|
||||
pub(crate) split: u16,
|
||||
pub(crate) entered: bool,
|
||||
/// MIDI output buffer
|
||||
pub(crate) note_buf: Vec<u8>,
|
||||
/// MIDI output buffer
|
||||
pub(crate) midi_buf: Vec<Vec<Vec<u8>>>,
|
||||
}
|
||||
|
||||
/// Root view for standalone `tek_arranger`
|
||||
|
|
@ -35,10 +39,12 @@ pub struct ArrangerTui {
|
|||
pub(crate) color: ItemColor,
|
||||
pub(crate) entered: bool,
|
||||
pub(crate) size: Measure<Tui>,
|
||||
pub(crate) note_buf: Vec<u8>,
|
||||
pub(crate) midi_buf: Vec<Vec<Vec<u8>>>,
|
||||
pub(crate) cursor: (usize, usize),
|
||||
pub(crate) menu_bar: Option<MenuBar<Tui, Self, ArrangerCommand>>,
|
||||
pub(crate) status_bar: Option<ArrangerStatus>,
|
||||
pub(crate) history: Vec<ArrangerCommand>,
|
||||
/// MIDI output buffer
|
||||
pub(crate) note_buf: Vec<u8>,
|
||||
/// MIDI output buffer
|
||||
pub(crate) midi_buf: Vec<Vec<Vec<u8>>>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,7 @@ pub enum SequencerCommand {
|
|||
|
||||
impl<T> Command<T> for SequencerCommand
|
||||
where
|
||||
T: PhrasesControl + PhraseEditorControl + PlayheadApi
|
||||
+ FocusGrid<Item = SequencerFocus> + FocusEnter<Item = SequencerFocus>
|
||||
T: PhrasesControl + PhraseEditorControl + PlayheadApi + FocusGrid<Item = SequencerFocus>
|
||||
{
|
||||
fn execute (self, state: &mut T) -> Perhaps<Self> {
|
||||
use SequencerCommand::*;
|
||||
|
|
@ -70,7 +69,7 @@ pub enum ArrangerCommand {
|
|||
Clip(ArrangerClipCommand),
|
||||
Select(ArrangerSelection),
|
||||
Zoom(usize),
|
||||
Phrases(PhrasePoolCommand),
|
||||
Phrases(PhrasesCommand),
|
||||
Editor(PhraseCommand),
|
||||
EditPhrase(Option<Arc<RwLock<Phrase>>>),
|
||||
}
|
||||
|
|
@ -263,10 +262,7 @@ pub enum PhraseCommand {
|
|||
TimeZoomSet(usize),
|
||||
}
|
||||
|
||||
impl<T> Command<T> for PhraseCommand
|
||||
where
|
||||
T: PhraseEditorControl + FocusEnter
|
||||
{
|
||||
impl<T: PhraseEditorControl> Command<T> for PhraseCommand {
|
||||
fn execute (self, state: &mut T) -> Perhaps<Self> {
|
||||
use PhraseCommand::*;
|
||||
Ok(match self {
|
||||
|
|
|
|||
|
|
@ -123,9 +123,9 @@ impl<'a, T: PhrasesViewState> Content for PhrasesView<'a, T> {
|
|||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
let focused = self.0.phrases_focused();
|
||||
let entered = self.0.entered();
|
||||
let entered = self.0.phrases_entered();
|
||||
let phrases = self.0.phrases();
|
||||
let selected_phrase = self.0.phrase();
|
||||
let selected_phrase = self.0.phrase_index();
|
||||
let mode = self.0.phrase_mode();
|
||||
let content = col!(
|
||||
(i, phrase) in phrases.iter().enumerate() => Layers::new(|add|{
|
||||
|
|
@ -173,7 +173,7 @@ impl<'a, T: PhraseViewState> Content for PhraseView<'a, T> {
|
|||
let phrase = self.0.phrase();
|
||||
let size = self.0.size();
|
||||
let focused = self.0.phrase_focused();
|
||||
let entered = self.0.entered();
|
||||
let entered = self.0.phrase_editor_entered();
|
||||
let keys = self.0.keys();
|
||||
let buffer = self.0.buffer();
|
||||
let note_len = self.0.note_len();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,26 @@
|
|||
use crate::*;
|
||||
|
||||
pub trait TransportControl: ClockApi {}
|
||||
pub trait TransportControl: ClockApi {
|
||||
fn transport_focused (&self) -> TransportFocus;
|
||||
}
|
||||
|
||||
impl TransportControl for TransportTui {
|
||||
fn transport_focused (&self) -> TransportFocus {
|
||||
self.state.focus
|
||||
}
|
||||
}
|
||||
|
||||
impl TransportControl for SequencerTui {
|
||||
fn transport_focused (&self) -> TransportFocus {
|
||||
self.transport.focus
|
||||
}
|
||||
}
|
||||
|
||||
impl TransportControl for ArrangerTui {
|
||||
fn transport_focused (&self) -> TransportFocus {
|
||||
self.transport.focus
|
||||
}
|
||||
}
|
||||
|
||||
pub trait SequencerControl: TransportControl {}
|
||||
|
||||
|
|
@ -50,7 +70,7 @@ pub trait PhrasesControl: HasPhrases {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait PhraseEditorControl {
|
||||
pub trait PhraseEditorControl: HasFocus {
|
||||
fn edit_phrase (&self, phrase: &Option<Arc<RwLock<Phrase>>>);
|
||||
fn editing_phrase (&self) -> &Option<Arc<RwLock<Phrase>>>;
|
||||
fn phrase_editor_entered (&self) -> bool;
|
||||
|
|
@ -67,12 +87,6 @@ pub trait PhraseEditorControl {
|
|||
}
|
||||
}
|
||||
|
||||
impl TransportControl for TransportTui {}
|
||||
|
||||
impl TransportControl for SequencerTui {}
|
||||
|
||||
impl TransportControl for ArrangerTui {}
|
||||
|
||||
impl SequencerControl for SequencerTui {}
|
||||
|
||||
impl ArrangerControl for ArrangerTui {
|
||||
|
|
|
|||
|
|
@ -68,27 +68,6 @@ impl TransportFocus {
|
|||
}
|
||||
}
|
||||
|
||||
//impl HasFocus for TransportTui {
|
||||
//type Item = TransportFocus;
|
||||
//}
|
||||
|
||||
//impl FocusEnter for TransportTui {
|
||||
//type Item = TransportFocus;
|
||||
//fn focus_enter (&mut self) {
|
||||
//self.entered = true;
|
||||
//}
|
||||
//fn focus_exit (&mut self) {
|
||||
//self.entered = false;
|
||||
//}
|
||||
//fn focus_entered (&self) -> Option<Self::Item> {
|
||||
//if self.entered {
|
||||
//Some(self.focused())
|
||||
//} else {
|
||||
//None
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
impl FocusGrid for TransportTui {
|
||||
type Item = TransportFocus;
|
||||
fn focus_cursor (&self) -> (usize, usize) {
|
||||
|
|
@ -113,29 +92,29 @@ impl FocusGrid for TransportTui {
|
|||
//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 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;
|
||||
|
|
@ -158,34 +137,34 @@ impl FocusGrid for SequencerTui {
|
|||
}
|
||||
}
|
||||
|
||||
impl FocusEnter for ArrangerTui {
|
||||
type Item = ArrangerFocus;
|
||||
fn focus_enter (&mut self) {
|
||||
self.entered = true;
|
||||
//use ArrangerFocus::*;
|
||||
//let focused = self.focused();
|
||||
//if !self.entered {
|
||||
//self.entered = focused == Arranger;
|
||||
//self.editor.entered = focused == PhraseEditor;
|
||||
//self.phrases.entered = focused == Phrases;
|
||||
//}
|
||||
}
|
||||
fn focus_exit (&mut self) {
|
||||
self.entered = false;
|
||||
//impl FocusEnter for ArrangerTui {
|
||||
//type Item = ArrangerFocus;
|
||||
//fn focus_enter (&mut self) {
|
||||
//self.entered = true;
|
||||
////use ArrangerFocus::*;
|
||||
////let focused = self.focused();
|
||||
////if !self.entered {
|
||||
////self.entered = focused == Arranger;
|
||||
////self.editor.entered = focused == PhraseEditor;
|
||||
////self.phrases.entered = focused == Phrases;
|
||||
////}
|
||||
//}
|
||||
//fn focus_exit (&mut self) {
|
||||
//self.entered = false;
|
||||
////if self.entered {
|
||||
////self.entered = false;
|
||||
////self.editor.entered = false;
|
||||
////self.phrases.entered = false;
|
||||
////}
|
||||
//}
|
||||
//fn focus_entered (&self) -> Option<Self::Item> {
|
||||
//if self.entered {
|
||||
//self.entered = false;
|
||||
//self.editor.entered = false;
|
||||
//self.phrases.entered = false;
|
||||
//Some(self.focused())
|
||||
//} else {
|
||||
//None
|
||||
//}
|
||||
}
|
||||
fn focus_entered (&self) -> Option<Self::Item> {
|
||||
if self.entered {
|
||||
Some(self.focused())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
//}
|
||||
|
||||
/// Focus layout of arranger app
|
||||
impl FocusGrid for ArrangerTui {
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ impl Handle<Tui> for ArrangerTui {
|
|||
ArrangerCommand::execute_with_state(self, i)
|
||||
}
|
||||
}
|
||||
impl Handle<Tui> for PhrasesModel {
|
||||
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
PhrasesCommand::execute_with_state(self, from)
|
||||
}
|
||||
}
|
||||
impl Handle<Tui> for PhraseEditorModel {
|
||||
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
PhraseCommand::execute_with_state(self, from)
|
||||
}
|
||||
}
|
||||
//impl Handle<Tui> for PhrasesModel {
|
||||
//fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
//PhrasesCommand::execute_with_state(self, from)
|
||||
//}
|
||||
//}
|
||||
//impl Handle<Tui> for PhraseEditorModel {
|
||||
//fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
//PhraseCommand::execute_with_state(self, from)
|
||||
//}
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ impl_has_phrase!(SequencerTui::player);
|
|||
impl_has_phrase!(ArrangerTrack::player);
|
||||
impl_has_phrase!(PhrasePlayerModel);
|
||||
impl_midi_player!(ArrangerTrack);
|
||||
impl_midi_player!(PhrasePlayerModel);
|
||||
|
||||
impl HasScenes<ArrangerScene> for ArrangerTui {
|
||||
fn scenes (&self) -> &Vec<ArrangerScene> {
|
||||
|
|
|
|||
|
|
@ -17,15 +17,17 @@ impl TryFrom<&Arc<RwLock<JackClient>>> for SequencerTui {
|
|||
type Error = Box<dyn std::error::Error>;
|
||||
fn try_from (jack: &Arc<RwLock<JackClient>>) -> Usually<Self> {
|
||||
Ok(Self {
|
||||
jack: jack.clone(),
|
||||
transport: TransportModel::from(jack.read().unwrap().transport()),
|
||||
phrases: PhrasesModel::default(),
|
||||
player: PhrasePlayerModel::default(),
|
||||
editor: PhraseEditorModel::default(),
|
||||
size: Measure::new(),
|
||||
cursor: (0, 0),
|
||||
entered: false,
|
||||
split: 20,
|
||||
jack: jack.clone(),
|
||||
transport: TransportModel::from(jack.read().unwrap().transport()),
|
||||
phrases: PhrasesModel::default(),
|
||||
player: PhrasePlayerModel::default(),
|
||||
editor: PhraseEditorModel::default(),
|
||||
size: Measure::new(),
|
||||
cursor: (0, 0),
|
||||
entered: false,
|
||||
split: 20,
|
||||
midi_buf: vec![],
|
||||
note_buf: vec![],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -34,24 +36,24 @@ impl TryFrom<&Arc<RwLock<JackClient>>> for ArrangerTui {
|
|||
type Error = Box<dyn std::error::Error>;
|
||||
fn try_from (jack: &Arc<RwLock<JackClient>>) -> Usually<Self> {
|
||||
Ok(Self {
|
||||
jack: jack.clone(),
|
||||
transport: TransportModel::from(jack.read().unwrap().transport()),
|
||||
phrases: PhrasesModel::default(),
|
||||
selected: ArrangerSelection::Clip(0, 0),
|
||||
scenes: vec![],
|
||||
tracks: vec![],
|
||||
color: Color::Rgb(28, 35, 25).into(),
|
||||
history: vec![],
|
||||
midi_buf: vec![],
|
||||
note_buf: vec![],
|
||||
mode: ArrangerMode::Vertical(2),
|
||||
name: Arc::new(RwLock::new(String::new())),
|
||||
size: Measure::new(),
|
||||
cursor: (0, 0),
|
||||
splits: [20, 20],
|
||||
entered: false,
|
||||
menu_bar: None,
|
||||
status_bar: None,
|
||||
jack: jack.clone(),
|
||||
transport: TransportModel::from(jack.read().unwrap().transport()),
|
||||
phrases: PhrasesModel::default(),
|
||||
selected: ArrangerSelection::Clip(0, 0),
|
||||
scenes: vec![],
|
||||
tracks: vec![],
|
||||
color: Color::Rgb(28, 35, 25).into(),
|
||||
history: vec![],
|
||||
mode: ArrangerMode::Vertical(2),
|
||||
name: Arc::new(RwLock::new(String::new())),
|
||||
size: Measure::new(),
|
||||
cursor: (0, 0),
|
||||
splits: [20, 20],
|
||||
entered: false,
|
||||
menu_bar: None,
|
||||
status_bar: None,
|
||||
midi_buf: vec![],
|
||||
note_buf: vec![],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,12 @@
|
|||
use crate::*;
|
||||
|
||||
impl<T> InputToCommand<Tui, T> for TransportCommand
|
||||
where
|
||||
T: TransportControl
|
||||
+ HasFocus<Item = TransportFocus>
|
||||
+ FocusEnter<Item = TransportFocus>
|
||||
{
|
||||
impl<T: TransportControl> InputToCommand<Tui, T> for TransportCommand {
|
||||
fn input_to_command (state: &T, input: &TuiInput) -> Option<Self> {
|
||||
use KeyCode::Char;
|
||||
use ClockCommand::{SetBpm, SetQuant, SetSync};
|
||||
use TransportFocus as Focused;
|
||||
use TransportCommand::{Focus, Clock, Playhead};
|
||||
let focused = state.focused();
|
||||
let focused = state.transport_focused();
|
||||
Some(match input.event() {
|
||||
key!(Left) => Focus(FocusCommand::Prev),
|
||||
key!(Right) => Focus(FocusCommand::Next),
|
||||
|
|
@ -57,7 +52,6 @@ where
|
|||
T: SequencerControl + TransportControl + PhrasesControl + PhraseEditorControl + PlayheadApi
|
||||
+ HasFocus<Item = SequencerFocus>
|
||||
+ FocusGrid<Item = SequencerFocus>
|
||||
+ FocusEnter<Item = SequencerFocus>
|
||||
{
|
||||
fn input_to_command (state: &T, input: &TuiInput) -> Option<Self> {
|
||||
use FocusCommand::*;
|
||||
|
|
@ -73,14 +67,11 @@ where
|
|||
key!(KeyCode::Right) => Some(Self::Focus(Right)),
|
||||
_ => Some(match state.focused() {
|
||||
SequencerFocus::Transport => {
|
||||
use TransportCommand::{Clock, Playhead};
|
||||
use TransportCommand::{Clock, Playhead, Focus};
|
||||
match TransportCommand::input_to_command(state, input)? {
|
||||
Clock(command) => {
|
||||
todo!()
|
||||
},
|
||||
Playhead(command) => {
|
||||
todo!()
|
||||
},
|
||||
Clock(command) => { todo!() },
|
||||
Playhead(command) => { todo!() },
|
||||
Focus(command) => { todo!() },
|
||||
}
|
||||
},
|
||||
SequencerFocus::Phrases =>
|
||||
|
|
@ -110,23 +101,21 @@ impl InputToCommand<Tui, ArrangerTui> for ArrangerCommand {
|
|||
key!(KeyCode::Esc) => Self::Focus(Exit),
|
||||
key!(KeyCode::Char(' ')) => Self::Playhead(PlayheadCommand::Play(None)),
|
||||
_ => match state.focused() {
|
||||
ArrangerFocus::Menu => { todo!() },
|
||||
ArrangerFocus::Transport => {
|
||||
use TransportCommand::{Clock, Playhead};
|
||||
use TransportCommand::{Clock, Playhead, Focus};
|
||||
match TransportCommand::input_to_command(state, input)? {
|
||||
Clock(command) => {
|
||||
todo!()
|
||||
},
|
||||
Playhead(command) => {
|
||||
todo!()
|
||||
},
|
||||
Clock(command) => { todo!() },
|
||||
Playhead(command) => { todo!() },
|
||||
Focus(command) => { todo!() }
|
||||
}
|
||||
},
|
||||
ArrangerFocus::PhraseEditor => Editor(
|
||||
PhraseCommand::input_to_command(state, input)?
|
||||
),
|
||||
ArrangerFocus::Phrases => match input.event() {
|
||||
key!(KeyCode::Char('e')) => EditPhrase(Some(state.phrase().clone())),
|
||||
_ => Phrases(PhrasePoolCommand::input_to_command(state, input)?)
|
||||
key!(KeyCode::Char('e')) => EditPhrase(state.phrase().clone()),
|
||||
_ => Phrases(PhrasesCommand::input_to_command(state, input)?)
|
||||
},
|
||||
ArrangerFocus::Arranger => {
|
||||
use ArrangerSelection as Select;
|
||||
|
|
@ -134,7 +123,7 @@ impl InputToCommand<Tui, ArrangerTui> for ArrangerCommand {
|
|||
use ArrangerClipCommand as Clip;
|
||||
use ArrangerSceneCommand as Scene;
|
||||
match input.event() {
|
||||
key!(KeyCode::Char('e')) => EditPhrase(state.phrase()),
|
||||
key!(KeyCode::Char('e')) => EditPhrase(state.phrase().clone()),
|
||||
_ => match input.event() {
|
||||
// FIXME: boundary conditions
|
||||
|
||||
|
|
@ -361,10 +350,7 @@ impl<T: PhrasesControl> InputToCommand<Tui, T> for PhraseRenameCommand {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> InputToCommand<Tui, T> for PhraseCommand
|
||||
where
|
||||
T: PhraseEditorControl + FocusEnter
|
||||
{
|
||||
impl<T: PhraseEditorControl> InputToCommand<Tui, T> for PhraseCommand {
|
||||
fn input_to_command (state: &T, from: &TuiInput) -> Option<Self> {
|
||||
use PhraseCommand::*;
|
||||
Some(match from.event() {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@ impl Audio for SequencerTui {
|
|||
if PlayheadAudio(self).process(client, scope) == Control::Quit {
|
||||
return Control::Quit
|
||||
}
|
||||
if PlayerAudio(self.player).process(client, scope) == Control::Quit {
|
||||
if PlayerAudio(
|
||||
&mut self.player,
|
||||
&mut self.note_buf,
|
||||
&mut self.midi_buf,
|
||||
).process(client, scope) == Control::Quit {
|
||||
return Control::Quit
|
||||
}
|
||||
Control::Continue
|
||||
|
|
@ -39,14 +43,14 @@ impl Audio for ArrangerTui {
|
|||
let pulse = self.current().pulse.get();
|
||||
let start = started_at.pulse.get();
|
||||
let now = (pulse - start) % phrase.length as f64;
|
||||
self.now.set(now);
|
||||
self.now().set(now);
|
||||
return Control::Continue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self.now.set(0.);
|
||||
self.now().set(0.);
|
||||
return Control::Continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,10 +56,6 @@ pub struct PhrasePlayerModel {
|
|||
pub(crate) midi_ins: Vec<Port<MidiIn>>,
|
||||
/// Play from current sequence to MIDI ports
|
||||
pub(crate) midi_outs: Vec<Port<MidiOut>>,
|
||||
/// MIDI output buffer
|
||||
pub(crate) note_buf: Vec<u8>,
|
||||
/// MIDI output buffer
|
||||
pub(crate) midi_buf: Vec<Vec<Vec<u8>>>,
|
||||
/// Notes currently held at input
|
||||
pub(crate) notes_in: Arc<RwLock<[bool; 128]>>,
|
||||
/// Notes currently held at output
|
||||
|
|
@ -79,8 +75,6 @@ impl Default for PhrasePlayerModel {
|
|||
next_phrase: None,
|
||||
notes_in: RwLock::new([false;128]).into(),
|
||||
notes_out: RwLock::new([false;128]).into(),
|
||||
note_buf: vec![],
|
||||
midi_buf: vec![],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +121,7 @@ impl Default for PhraseEditorModel {
|
|||
mode: false,
|
||||
notes_in: RwLock::new([false;128]).into(),
|
||||
notes_out: RwLock::new([false;128]).into(),
|
||||
now: Instant::default().into(),
|
||||
now: Pulse::default().into(),
|
||||
size: Measure::new(),
|
||||
note_axis: RwLock::new(FixedAxis {
|
||||
start: 12,
|
||||
|
|
@ -301,7 +295,7 @@ impl PhrasesModel {
|
|||
pub fn new (phrases: Vec<Arc<RwLock<Phrase>>>) -> Self {
|
||||
Self {
|
||||
scroll: 0,
|
||||
phrase: 0,
|
||||
phrase: 0.into(),
|
||||
mode: None,
|
||||
focused: false,
|
||||
entered: false,
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ impl StatusBar for ArrangerStatus {
|
|||
ArrangerSelection::Scene(_) => ArrangerStatus::ArrangerScene,
|
||||
ArrangerSelection::Clip(_, _) => ArrangerStatus::ArrangerClip,
|
||||
},
|
||||
ArrangerFocus::PhrasePool => ArrangerStatus::PhrasePool,
|
||||
ArrangerFocus::Phrases => ArrangerStatus::PhrasePool,
|
||||
ArrangerFocus::PhraseEditor => match entered {
|
||||
true => ArrangerStatus::PhraseEdit,
|
||||
false => ArrangerStatus::PhraseView,
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ pub trait ArrangerViewState {
|
|||
|
||||
pub trait PhrasesViewState: Send + Sync {
|
||||
fn phrases_focused (&self) -> bool;
|
||||
fn entered (&self) -> bool;
|
||||
fn phrases_entered (&self) -> bool;
|
||||
fn phrases (&self) -> Vec<Arc<RwLock<Phrase>>>;
|
||||
fn phrase (&self) -> usize;
|
||||
fn phrase_index (&self) -> usize;
|
||||
fn phrase_mode (&self) -> &Option<PhrasesMode>;
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ pub trait PhraseViewState: Send + Sync {
|
|||
fn phrase (&self) -> &Option<Arc<RwLock<Phrase>>>;
|
||||
fn phrase_focused (&self) -> bool;
|
||||
fn phrase_editor_size (&self) -> &Measure<Tui>;
|
||||
fn entered (&self) -> bool;
|
||||
fn phrase_editor_entered (&self) -> bool;
|
||||
fn keys (&self) -> &Buffer;
|
||||
fn buffer (&self) -> &BigBuffer;
|
||||
fn note_len (&self) -> usize;
|
||||
|
|
@ -96,13 +96,13 @@ impl PhrasesViewState for PhrasesModel {
|
|||
fn phrases_focused (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn entered (&self) -> bool {
|
||||
fn phrases_entered (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn phrases (&self) -> Vec<Arc<RwLock<Phrase>>> {
|
||||
todo!()
|
||||
}
|
||||
fn phrase (&self) -> usize {
|
||||
fn phrase_index (&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
fn phrase_mode (&self) -> &Option<PhrasesMode> {
|
||||
|
|
@ -114,13 +114,13 @@ impl PhrasesViewState for SequencerTui {
|
|||
fn phrases_focused (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn entered (&self) -> bool {
|
||||
fn phrases_entered (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn phrases (&self) -> Vec<Arc<RwLock<Phrase>>> {
|
||||
todo!()
|
||||
}
|
||||
fn phrase (&self) -> usize {
|
||||
fn phrase_index (&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
fn phrase_mode (&self) -> &Option<PhrasesMode> {
|
||||
|
|
@ -132,13 +132,13 @@ impl PhrasesViewState for ArrangerTui {
|
|||
fn phrases_focused (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn entered (&self) -> bool {
|
||||
fn phrases_entered (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn phrases (&self) -> Vec<Arc<RwLock<Phrase>>> {
|
||||
todo!()
|
||||
}
|
||||
fn phrase (&self) -> usize {
|
||||
fn phrase_index (&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
fn phrase_mode (&self) -> &Option<PhrasesMode> {
|
||||
|
|
@ -156,7 +156,7 @@ impl PhraseViewState for PhraseEditorModel {
|
|||
fn phrase_editor_size (&self) -> &Measure<Tui> {
|
||||
todo!()
|
||||
}
|
||||
fn entered (&self) -> bool {
|
||||
fn phrase_editor_entered (&self) -> bool {
|
||||
self.entered
|
||||
}
|
||||
fn keys (&self) -> &Buffer {
|
||||
|
|
@ -192,7 +192,7 @@ impl PhraseViewState for SequencerTui {
|
|||
fn phrase_editor_size (&self) -> &Measure<Tui> {
|
||||
todo!()
|
||||
}
|
||||
fn entered (&self) -> bool {
|
||||
fn phrase_editor_entered (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn keys (&self) -> &Buffer {
|
||||
|
|
@ -228,7 +228,7 @@ impl PhraseViewState for ArrangerTui {
|
|||
fn phrase_editor_size (&self) -> &Measure<Tui> {
|
||||
todo!()
|
||||
}
|
||||
fn entered (&self) -> bool {
|
||||
fn phrase_editor_entered (&self) -> bool {
|
||||
todo!()
|
||||
}
|
||||
fn keys (&self) -> &Buffer {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue