mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
placebo
This commit is contained in:
parent
3ae2467acc
commit
94c1f83ef2
13 changed files with 277 additions and 124 deletions
75
src/main.rs
75
src/main.rs
|
|
@ -1,3 +1,5 @@
|
|||
//#![feature(fn_traits)]
|
||||
//#![feature(unboxed_closures)]
|
||||
#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]
|
||||
|
||||
extern crate clap;
|
||||
|
|
@ -18,23 +20,59 @@ use crate::device::*;
|
|||
|
||||
mod new {
|
||||
use crate::core::*;
|
||||
type Phrase = (String, usize, BTreeMap<usize, Vec<Vec<u8>>>);
|
||||
type Scene = (String, Option<usize>, Vec<Option<AtomicUsize>>);
|
||||
use crate::layout::Stack;
|
||||
type Phrase = (String, usize, BTreeMap<usize, Vec<MidiMessage>>);
|
||||
type Scene = (String, Option<usize>, Vec<Option<usize>>);
|
||||
type Track = (String, usize);
|
||||
#[derive(Default)]
|
||||
struct App {
|
||||
phrases: BTreeMap<usize, Arc<Mutex<Phrase>>>,
|
||||
scenes: BTreeMap<usize, Arc<Mutex<Scene>>>,
|
||||
tracks: BTreeMap<usize, Arc<Mutex<Track>>>,
|
||||
pub struct App {
|
||||
client: Option<DynamicAsyncClient>,
|
||||
phrases: BTreeMap<usize, Phrase>,
|
||||
scenes: BTreeMap<usize, Scene>,
|
||||
tracks: BTreeMap<usize, Track>,
|
||||
frame: usize,
|
||||
scene: Vec<usize>,
|
||||
timebase: Arc<Timebase>,
|
||||
}
|
||||
fn main () {
|
||||
App::default().run()
|
||||
}
|
||||
impl App {
|
||||
fn run (self) {
|
||||
panic_hook_setup();
|
||||
struct SceneGrid {}
|
||||
impl Render for SceneGrid {}
|
||||
struct Chains {}
|
||||
impl Render for Chains {}
|
||||
struct Sequencer {}
|
||||
impl Render for Sequencer {}
|
||||
impl Render for App {
|
||||
fn render (&self, buf: &mut Buffer, area: Rect) -> Usually<Rect> {
|
||||
crate::device::Transport {
|
||||
timebase: &self.timebase,
|
||||
playing: TransportState::Stopped,
|
||||
record: false,
|
||||
overdub: false,
|
||||
monitor: false,
|
||||
frame: 0,
|
||||
}.render(buf, area)?;
|
||||
SceneGrid {
|
||||
}.render(buf, area)?;
|
||||
Chains {}.render(buf, area)?;
|
||||
Sequencer {}.render(buf, area)?;
|
||||
Ok(area)
|
||||
}
|
||||
}
|
||||
impl Handle for App {
|
||||
fn handle (&mut self, _e: &AppEvent) -> Usually<bool> {
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
impl Process for App {
|
||||
fn process (&mut self, _c: &Client, _s: &ProcessScope) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
}
|
||||
pub fn main () -> Usually<()> {
|
||||
App::default().run(Some(|app: Arc<Mutex<App>>|{
|
||||
app.lock().unwrap().client = Some(jack_run("tek", &app)?);
|
||||
Ok(())
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! sample {
|
||||
|
|
@ -61,8 +99,6 @@ fn main () -> Usually<()> {
|
|||
let xdg = microxdg::XdgApp::new("tek")?;
|
||||
crate::config::create_dirs(&xdg)?;
|
||||
//run(Sampler::new("Sampler#000")?)
|
||||
let input = ".*nanoKEY.*";
|
||||
let output = ["Komplete.*:playback_FL", "Komplete.*:playback_FR"];
|
||||
let (client, _) = Client::new("init", ClientOptions::NO_START_SERVER)?;
|
||||
let timebase = Arc::new(Timebase::new(client.sample_rate() as f64, 125.0, 96.0));
|
||||
let ppq = timebase.ppq() as usize;
|
||||
|
|
@ -213,6 +249,13 @@ fn main () -> Usually<()> {
|
|||
])
|
||||
|
||||
)?
|
||||
.connect(input, &output)?
|
||||
.run()
|
||||
.run(Some(init))
|
||||
}
|
||||
|
||||
fn init (state: Arc<Mutex<DynamicDevice<Launcher>>>) -> Usually<()> {
|
||||
let input = ".*nanoKEY.*";
|
||||
let output = ["Komplete.*:playback_FL", "Komplete.*:playback_FR"];
|
||||
let state = state.lock().unwrap();
|
||||
state.connect(input, &output)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue