mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
more doc string and reexport fixes
This commit is contained in:
parent
107e38278e
commit
dc1f5f4a17
13 changed files with 37 additions and 48 deletions
32
src/model.rs
32
src/model.rs
|
|
@ -1,24 +1,10 @@
|
||||||
//! Application state.
|
//! Application state.
|
||||||
|
|
||||||
pub mod looper;
|
submod! { looper mixer phrase plugin sampler scene track transport }
|
||||||
pub mod mixer;
|
|
||||||
pub mod phrase;
|
|
||||||
pub mod plugin;
|
|
||||||
pub mod sampler;
|
|
||||||
pub mod scene;
|
|
||||||
pub mod track;
|
|
||||||
pub mod transport;
|
|
||||||
|
|
||||||
pub use self::phrase::{Phrase, PhraseData};
|
|
||||||
pub use self::scene::Scene;
|
|
||||||
pub use self::track::Track;
|
|
||||||
pub use self::sampler::{Sampler, Sample, read_sample_data};
|
|
||||||
pub use self::mixer::Mixer;
|
|
||||||
pub use self::plugin::{Plugin, PluginKind, lv2::LV2Plugin};
|
|
||||||
pub use self::transport::{TransportToolbar, TransportFocus};
|
|
||||||
|
|
||||||
use crate::{core::*, view::*};
|
use crate::{core::*, view::*};
|
||||||
|
|
||||||
|
/// Root of application state.
|
||||||
pub struct App {
|
pub struct App {
|
||||||
/// Main JACK client.
|
/// Main JACK client.
|
||||||
pub jack: Option<JackClient>,
|
pub jack: Option<JackClient>,
|
||||||
|
|
@ -156,9 +142,19 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Different sections of the UI that may be focused.
|
||||||
#[derive(PartialEq, Clone, Copy)]
|
#[derive(PartialEq, Clone, Copy)]
|
||||||
pub enum AppFocus { Transport, Arranger, Sequencer, Chain, }
|
pub enum AppFocus {
|
||||||
impl Default for AppFocus { fn default () -> Self { Self::Arranger } }
|
Transport,
|
||||||
|
Arranger,
|
||||||
|
Sequencer,
|
||||||
|
Chain,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for AppFocus {
|
||||||
|
fn default () -> Self { Self::Arranger }
|
||||||
|
}
|
||||||
|
|
||||||
impl AppFocus {
|
impl AppFocus {
|
||||||
pub fn prev (&mut self) {
|
pub fn prev (&mut self) {
|
||||||
*self = match self {
|
*self = match self {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::core::*;
|
use crate::core::*;
|
||||||
|
|
||||||
|
/// TODO: audio looper. (Integrate with [crate::model::Sampler]?)
|
||||||
pub struct Looper {
|
pub struct Looper {
|
||||||
pub name: String
|
pub name: String
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::core::*;
|
use crate::core::*;
|
||||||
|
|
||||||
|
/// TODO: audio mixer.
|
||||||
pub struct Mixer {
|
pub struct Mixer {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub tracks: Vec<MixerTrack>,
|
pub tracks: Vec<MixerTrack>,
|
||||||
|
|
@ -31,7 +32,7 @@ impl Mixer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn process (
|
fn process (
|
||||||
_: &mut Mixer,
|
_: &mut Mixer,
|
||||||
_: &Client,
|
_: &Client,
|
||||||
_: &ProcessScope
|
_: &ProcessScope
|
||||||
|
|
@ -39,6 +40,7 @@ pub fn process (
|
||||||
Control::Continue
|
Control::Continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TODO: A track in the mixer. (Integrate with [crate::model::Track]?)
|
||||||
pub struct MixerTrack {
|
pub struct MixerTrack {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub channels: u8,
|
pub channels: u8,
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ impl App {
|
||||||
pub type PhraseData = Vec<Vec<MidiMessage>>;
|
pub type PhraseData = Vec<Vec<MidiMessage>>;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
/// A MIDI sequence.
|
||||||
pub struct Phrase {
|
pub struct Phrase {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub length: usize,
|
pub length: usize,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
use crate::core::*;
|
use crate::core::*;
|
||||||
|
|
||||||
pub mod lv2;
|
submod! { lv2 vst2 vst3 }
|
||||||
pub mod vst2;
|
|
||||||
pub mod vst3;
|
|
||||||
|
|
||||||
use self::lv2::*;
|
|
||||||
|
|
||||||
|
/// A plugin device.
|
||||||
pub struct Plugin {
|
pub struct Plugin {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub path: Option<String>,
|
pub path: Option<String>,
|
||||||
|
|
@ -14,10 +11,11 @@ pub struct Plugin {
|
||||||
pub mapping: bool,
|
pub mapping: bool,
|
||||||
pub ports: JackPorts,
|
pub ports: JackPorts,
|
||||||
}
|
}
|
||||||
render!(Plugin = crate::view::plugin::render);
|
render!(Plugin = crate::view::render_plugin);
|
||||||
handle!(Plugin = crate::control::handle_plugin);
|
handle!(Plugin = crate::control::handle_plugin);
|
||||||
process!(Plugin = Plugin::process);
|
process!(Plugin = Plugin::process);
|
||||||
|
|
||||||
|
/// Supported plugin formats.
|
||||||
pub enum PluginKind {
|
pub enum PluginKind {
|
||||||
LV2(LV2Plugin),
|
LV2(LV2Plugin),
|
||||||
VST2 {
|
VST2 {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ use ::livi::{
|
||||||
event::LV2AtomSequence,
|
event::LV2AtomSequence,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// A LV2 plugin.
|
||||||
pub struct LV2Plugin {
|
pub struct LV2Plugin {
|
||||||
pub world: World,
|
pub world: World,
|
||||||
pub instance: Instance,
|
pub instance: Instance,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::core::*;
|
use crate::core::*;
|
||||||
|
|
||||||
|
/// The sampler plugin plays sounds.
|
||||||
pub struct Sampler {
|
pub struct Sampler {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub cursor: (usize, usize),
|
pub cursor: (usize, usize),
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A collection of phrases to play on each track.
|
||||||
pub struct Scene {
|
pub struct Scene {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub clips: Vec<Option<usize>>,
|
pub clips: Vec<Option<usize>>,
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A sequencer track.
|
||||||
pub struct Track {
|
pub struct Track {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
/// Play input through output.
|
/// Play input through output.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::core::*;
|
use crate::core::*;
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
/// Which section of the transport is focused
|
||||||
pub enum TransportFocus { BPM, Quant, Sync }
|
pub enum TransportFocus { BPM, Quant, Sync }
|
||||||
|
|
||||||
impl TransportFocus {
|
impl TransportFocus {
|
||||||
|
|
@ -20,9 +21,10 @@ impl TransportFocus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Stored and displays time-related state.
|
||||||
pub struct TransportToolbar {
|
pub struct TransportToolbar {
|
||||||
|
/// Enable metronome?
|
||||||
pub metronome: bool,
|
pub metronome: bool,
|
||||||
pub mode: bool,
|
|
||||||
pub focused: bool,
|
pub focused: bool,
|
||||||
pub entered: bool,
|
pub entered: bool,
|
||||||
pub selected: TransportFocus,
|
pub selected: TransportFocus,
|
||||||
|
|
@ -48,7 +50,6 @@ impl TransportToolbar {
|
||||||
Self {
|
Self {
|
||||||
selected: TransportFocus::BPM,
|
selected: TransportFocus::BPM,
|
||||||
metronome: false,
|
metronome: false,
|
||||||
mode: false,
|
|
||||||
focused: false,
|
focused: false,
|
||||||
entered: false,
|
entered: false,
|
||||||
playhead: 0,
|
playhead: 0,
|
||||||
|
|
|
||||||
22
src/view.rs
22
src/view.rs
|
|
@ -1,25 +1,11 @@
|
||||||
//! Rendering of application to display.
|
//! Rendering of application to display.
|
||||||
|
|
||||||
pub mod arranger;
|
|
||||||
pub mod border;
|
|
||||||
pub mod chain;
|
|
||||||
pub mod help;
|
|
||||||
pub mod plugin;
|
|
||||||
pub mod sequencer;
|
|
||||||
pub mod split;
|
|
||||||
pub mod theme;
|
|
||||||
pub mod transport;
|
|
||||||
|
|
||||||
pub use self::arranger::*;
|
|
||||||
pub use self::border::*;
|
|
||||||
pub use self::chain::ChainView;
|
|
||||||
pub use self::help::*;
|
|
||||||
pub use self::sequencer::{SequencerView, BufferedSequencerView};
|
|
||||||
pub use self::split::*;
|
|
||||||
pub use self::theme::*;
|
|
||||||
|
|
||||||
use crate::{render, App, core::*};
|
use crate::{render, App, core::*};
|
||||||
|
|
||||||
|
submod! {
|
||||||
|
arranger border chain help plugin sequencer split theme transport
|
||||||
|
}
|
||||||
|
|
||||||
render!(App |self, buf, area| {
|
render!(App |self, buf, area| {
|
||||||
Split::down([
|
Split::down([
|
||||||
&self.transport,
|
&self.transport,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use crate::{core::*, view::*};
|
use crate::{core::*, view::*};
|
||||||
|
|
||||||
|
/// Command palette.
|
||||||
pub struct HelpModal {
|
pub struct HelpModal {
|
||||||
cursor: usize,
|
cursor: usize,
|
||||||
search: Option<String>,
|
search: Option<String>,
|
||||||
exited: bool,
|
exited: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HelpModal {
|
impl HelpModal {
|
||||||
pub fn new () -> Self {
|
pub fn new () -> Self {
|
||||||
Self { cursor: 0, search: None, exited: false }
|
Self { cursor: 0, search: None, exited: false }
|
||||||
|
|
@ -52,7 +52,7 @@ render!(HelpModal |self, buf, area|{
|
||||||
format!("{:?}", command.0).blit(buf, x, y, Some(Style::default().white().bold()))?;
|
format!("{:?}", command.0).blit(buf, x, y, Some(Style::default().white().bold()))?;
|
||||||
command.2.blit(buf, x + 11, y, Some(Style::default().white().bold()))?;
|
command.2.blit(buf, x + 11, y, Some(Style::default().white().bold()))?;
|
||||||
command.3.blit(buf, x + 26, y, Some(Style::default().white().dim()))?;
|
command.3.blit(buf, x + 26, y, Some(Style::default().white().dim()))?;
|
||||||
} else if let Some(command) = crate::control::KEYMAP.get((i as usize) - crate::control::KEYMAP_FOCUS.len()) {
|
} else if let Some(command) = crate::control::KEYMAP_GLOBAL.get((i as usize) - crate::control::KEYMAP_FOCUS.len()) {
|
||||||
format!("{:?}", command.0).blit(buf, x, y, Some(Style::default().white().bold()))?;
|
format!("{:?}", command.0).blit(buf, x, y, Some(Style::default().white().bold()))?;
|
||||||
command.2.blit(buf, x + 11, y, Some(Style::default().white().bold()))?;
|
command.2.blit(buf, x + 11, y, Some(Style::default().white().bold()))?;
|
||||||
command.3.blit(buf, x + 26, y, Some(Style::default().white().dim()))?;
|
command.3.blit(buf, x + 26, y, Some(Style::default().white().dim()))?;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{core::*, model::*};
|
use crate::{core::*, model::*};
|
||||||
|
|
||||||
pub fn render (state: &Plugin, buf: &mut Buffer, area: Rect)
|
pub fn render_plugin (state: &Plugin, buf: &mut Buffer, area: Rect)
|
||||||
-> Usually<Rect>
|
-> Usually<Rect>
|
||||||
{
|
{
|
||||||
let Rect { x, y, height, .. } = area;
|
let Rect { x, y, height, .. } = area;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue