mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: reenable sequencer, pt.2
This commit is contained in:
parent
7063ae90d1
commit
e1eef9e2e9
2 changed files with 59 additions and 78 deletions
|
|
@ -80,8 +80,8 @@ impl Content for ArrangerStandalone<Tui> {
|
||||||
add(&self.transport)?;
|
add(&self.transport)?;
|
||||||
if let Some(direction) = self.show_sequencer {
|
if let Some(direction) = self.show_sequencer {
|
||||||
add(&Split::new(direction, |add|{
|
add(&Split::new(direction, |add|{
|
||||||
add(&self.arranger)?;
|
add(&Shrink::Y(20, &self.arranger as &dyn Widget<Engine = Tui>))?;
|
||||||
add(&Min::Y(10, self.arranger.sequencer().map(
|
add(&Min::Y(20, self.arranger.sequencer().map(
|
||||||
|x|x as &dyn Widget<Engine = Tui>
|
|x|x as &dyn Widget<Engine = Tui>
|
||||||
)))?;
|
)))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
|
|
@ -1566,97 +1566,81 @@ pub(crate) fn keys_vert () -> Buffer {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceName<'a>(&'a Sequencer<Tui>);
|
struct SequenceName<'a>(&'a Sequencer<Tui>);
|
||||||
|
impl<'a> Content for SequenceName<'a> {
|
||||||
impl<'a> Widget for SequenceName<'a> {
|
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
todo!()
|
Min::XY(10, 4, Split::down(|add|{
|
||||||
}
|
let name: &str = &*self.0.name.read().unwrap();
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
add(&"Name")?;
|
||||||
let [x, y, ..] = to.area();
|
add(&name)?;
|
||||||
let frame = [x, y, 10, 4];
|
//Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
||||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
Ok(())
|
||||||
to.blit(&"Name:", x + 1, y + 1, Some(STYLE_LABEL));
|
}))
|
||||||
to.blit(&*self.0.name.read().unwrap(), x + 1, y + 2, Some(STYLE_VALUE));
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceRange;
|
struct SequenceRange;
|
||||||
|
impl Content for SequenceRange {
|
||||||
impl Widget for SequenceRange {
|
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
todo!()
|
Min::XY(10, 6, Split::down(|add|{
|
||||||
}
|
add(&"Start: ")?;//Some(STYLE_LABEL));
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
add(&" 1.1.1")?;//Some(STYLE_VALUE));
|
||||||
let [x, y, ..] = to.area();
|
add(&"End: ")?;//Some(STYLE_LABEL));
|
||||||
let frame = [x, y, 10, 6];
|
add(&" 2.1.1")?;//Some(STYLE_VALUE));
|
||||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
//Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(frame))?;
|
||||||
to.blit(&"Start: ", x + 1, y + 1, Some(STYLE_LABEL));
|
Ok(())
|
||||||
to.blit(&" 1.1.1", x + 1, y + 2, Some(STYLE_VALUE));
|
}))
|
||||||
to.blit(&"End: ", x + 1, y + 3, Some(STYLE_LABEL));
|
|
||||||
to.blit(&" 2.1.1", x + 1, y + 4, Some(STYLE_VALUE));
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceLoopRange;
|
struct SequenceLoopRange;
|
||||||
|
impl Content for SequenceLoopRange {
|
||||||
impl Widget for SequenceLoopRange {
|
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
todo!()
|
Min::XY(10, 7, Split::down(|add|{
|
||||||
}
|
//Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
add(&"Loop [ ]")?;//Some(STYLE_LABEL));
|
||||||
let [x, y, ..] = to.area();
|
add(&"From: ")?;//Some(STYLE_LABEL));
|
||||||
let range = [x, y, 10, 7];
|
add(&" 1.1.1")?;//Some(STYLE_VALUE));
|
||||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
add(&"Length: ")?;//Some(STYLE_LABEL));
|
||||||
to.blit(&"Loop [ ]", x + 1, y + 1, Some(STYLE_LABEL));
|
add(&" 1.0.0")?;//Some(STYLE_VALUE));
|
||||||
to.blit(&"From: ", x + 1, y + 2, Some(STYLE_LABEL));
|
Ok(())
|
||||||
to.blit(&" 1.1.1", x + 1, y + 3, Some(STYLE_VALUE));
|
}))
|
||||||
to.blit(&"Length: ", x + 1, y + 4, Some(STYLE_LABEL));
|
|
||||||
to.blit(&" 1.0.0", x + 1, y + 5, Some(STYLE_VALUE));
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceNoteRange;
|
struct SequenceNoteRange;
|
||||||
|
impl Content for SequenceNoteRange {
|
||||||
impl Widget for SequenceNoteRange {
|
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||||
todo!()
|
Min::XY(10, 9, Split::down(|add|{
|
||||||
}
|
//Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
add(&"Notes: ")?;//Some(STYLE_LABEL));
|
||||||
let [x, y, ..] = to.area();
|
add(&"C#0-C#9 ")?;//Some(STYLE_VALUE));
|
||||||
let range = [x, y, 10, 9];
|
add(&"[ /2 ]")?;//Some(STYLE_LABEL));
|
||||||
Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
|
add(&"[ x2 ]")?;//Some(STYLE_LABEL));
|
||||||
to.blit(&"Notes: ", x + 1, y + 1, Some(STYLE_LABEL));
|
add(&"[ Rev ]")?;//Some(STYLE_LABEL));
|
||||||
to.blit(&"C#0-C#9 ", x + 1, y + 2, Some(STYLE_VALUE));
|
add(&"[ Inv ]")?;//Some(STYLE_LABEL));
|
||||||
to.blit(&"[ /2 ]", x + 1, y + 3, Some(STYLE_LABEL));
|
add(&"[ Dup ]")?;//Some(STYLE_LABEL));
|
||||||
to.blit(&"[ x2 ]", x + 1, y + 4, Some(STYLE_LABEL));
|
Ok(())
|
||||||
to.blit(&"[ Rev ]", x + 1, y + 5, Some(STYLE_LABEL));
|
}))
|
||||||
to.blit(&"[ Inv ]", x + 1, y + 6, Some(STYLE_LABEL));
|
|
||||||
to.blit(&"[ Dup ]", x + 1, y + 7, Some(STYLE_LABEL));
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceKeys<'a>(&'a Sequencer<Tui>);
|
struct SequenceKeys<'a>(&'a Sequencer<Tui>);
|
||||||
|
|
||||||
impl<'a> Widget for SequenceKeys<'a> {
|
impl<'a> Widget for SequenceKeys<'a> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn layout (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||||
todo!()
|
Ok(Some([32,4]))
|
||||||
}
|
}
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
|
|
@ -1677,11 +1661,10 @@ impl<'a> Widget for SequenceKeys<'a> {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceNotes<'a>(&'a Sequencer<Tui>);
|
struct SequenceNotes<'a>(&'a Sequencer<Tui>);
|
||||||
|
|
||||||
impl<'a> Widget for SequenceNotes<'a> {
|
impl<'a> Widget for SequenceNotes<'a> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn layout (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||||
todo!()
|
Ok(Some([32,4]))
|
||||||
}
|
}
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
|
|
@ -1712,11 +1695,10 @@ impl<'a> Widget for SequenceNotes<'a> {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceCursor<'a>(&'a Sequencer<Tui>);
|
struct SequenceCursor<'a>(&'a Sequencer<Tui>);
|
||||||
|
|
||||||
impl<'a> Widget for SequenceCursor<'a> {
|
impl<'a> Widget for SequenceCursor<'a> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn layout (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||||
todo!()
|
Ok(Some([1,1]))
|
||||||
}
|
}
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
|
|
@ -1736,11 +1718,10 @@ impl<'a> Widget for SequenceCursor<'a> {
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct SequenceZoom<'a>(&'a Sequencer<Tui>);
|
struct SequenceZoom<'a>(&'a Sequencer<Tui>);
|
||||||
|
|
||||||
impl<'a> Widget for SequenceZoom<'a> {
|
impl<'a> Widget for SequenceZoom<'a> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||||
todo!()
|
Ok(Some([10,1]))
|
||||||
}
|
}
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
|
|
@ -1752,12 +1733,13 @@ impl<'a> Widget for SequenceZoom<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SequenceTimer<'a>(&'a Sequencer<Tui>, Arc<RwLock<Phrase>>);
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
struct SequenceTimer<'a>(&'a Sequencer<Tui>, Arc<RwLock<Phrase>>);
|
||||||
impl<'a> Widget for SequenceTimer<'a> {
|
impl<'a> Widget for SequenceTimer<'a> {
|
||||||
type Engine = Tui;
|
type Engine = Tui;
|
||||||
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
fn layout (&self, _to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||||
todo!()
|
Ok(Some([32,2]))
|
||||||
}
|
}
|
||||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||||
let area = to.area();
|
let area = to.area();
|
||||||
|
|
@ -1779,13 +1761,14 @@ impl<'a> Widget for SequenceTimer<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/// A collection of phrases to play on each track.
|
/// A collection of phrases to play on each track.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Scene {
|
pub struct Scene {
|
||||||
pub name: Arc<RwLock<String>>,
|
pub name: Arc<RwLock<String>>,
|
||||||
pub clips: Vec<Option<usize>>,
|
pub clips: Vec<Option<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Scene {
|
impl Scene {
|
||||||
pub fn from_edn <'a, 'e> (args: &[Edn<'e>]) -> Usually<Self> {
|
pub fn from_edn <'a, 'e> (args: &[Edn<'e>]) -> Usually<Self> {
|
||||||
let mut name = None;
|
let mut name = None;
|
||||||
|
|
@ -1843,6 +1826,8 @@ impl Scene {
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/// A collection of MIDI messages.
|
||||||
|
pub type PhraseData = Vec<Vec<MidiMessage>>;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
/// A MIDI sequence.
|
/// A MIDI sequence.
|
||||||
pub struct Phrase {
|
pub struct Phrase {
|
||||||
|
|
@ -1853,15 +1838,11 @@ pub struct Phrase {
|
||||||
/// All notes are displayed with minimum length
|
/// All notes are displayed with minimum length
|
||||||
pub percussive: bool
|
pub percussive: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PhraseData = Vec<Vec<MidiMessage>>;
|
|
||||||
|
|
||||||
impl Default for Phrase {
|
impl Default for Phrase {
|
||||||
fn default () -> Self {
|
fn default () -> Self {
|
||||||
Self::new("", 0, None)
|
Self::new("", 0, None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Phrase {
|
impl Phrase {
|
||||||
pub fn new (name: &str, length: usize, notes: Option<PhraseData>) -> Self {
|
pub fn new (name: &str, length: usize, notes: Option<PhraseData>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue