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