mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: unified dsl_ns macro
This commit is contained in:
parent
28aacd7cbc
commit
08730df042
8 changed files with 524 additions and 510 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,4 @@
|
|||
pub(crate) use tek::*;
|
||||
pub(crate) use std::sync::{Arc, RwLock};
|
||||
pub(crate) use clap::{self, Parser, Subcommand};
|
||||
|
||||
/// Application entrypoint.
|
||||
|
|
@ -56,16 +55,16 @@ impl Cli {
|
|||
let empty = &[] as &[&str];
|
||||
let mut midi_ins = vec![];
|
||||
let mut midi_outs = vec![];
|
||||
let mut tracks = vec![];
|
||||
let mut scenes = vec![];
|
||||
let tracks = vec![];
|
||||
let scenes = vec![];
|
||||
let midi_froms = Connect::collect(&self.midi_from, empty, &self.midi_from_re);
|
||||
let midi_tos = Connect::collect(&self.midi_to, empty, &self.midi_to_re);
|
||||
let left_froms = Connect::collect(&self.left_from, empty, empty);
|
||||
let left_tos = Connect::collect(&self.left_to, empty, empty);
|
||||
let right_froms = Connect::collect(&self.right_from, empty, empty);
|
||||
let right_tos = Connect::collect(&self.right_to, empty, empty);
|
||||
let audio_froms = &[left_froms.as_slice(), right_froms.as_slice()];
|
||||
let audio_tos = &[left_tos.as_slice(), right_tos.as_slice()];
|
||||
let _audio_froms = &[left_froms.as_slice(), right_froms.as_slice()];
|
||||
let _audio_tos = &[left_tos.as_slice(), right_tos.as_slice()];
|
||||
Tui::new()?.run(&Jack::new_run(&name, move|jack|{
|
||||
for (index, connect) in midi_froms.iter().enumerate() {
|
||||
midi_ins.push(jack.midi_in(&format!("M/{index}"), &[connect.clone()])?);
|
||||
|
|
@ -74,7 +73,7 @@ impl Cli {
|
|||
midi_outs.push(jack.midi_out(&format!("{index}/M"), &[connect.clone()])?);
|
||||
};
|
||||
let clock = Clock::new(&jack, self.bpm)?;
|
||||
let mut app = App {
|
||||
let app = App {
|
||||
config,
|
||||
jack: jack.clone(),
|
||||
color: ItemTheme::random(),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl HasSceneScroll for Arrangement {
|
|||
fn scene_scroll (&self) -> usize { self.scene_scroll }
|
||||
}
|
||||
|
||||
pub type SceneWith<'a, T: Send + Sync> = (usize, &'a Scene, usize, usize, T);
|
||||
pub type SceneWith<'a, T> = (usize, &'a Scene, usize, usize, T);
|
||||
|
||||
impl<T: HasScenes + HasTracks> AddScene for T {}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,10 +139,10 @@ impl TrackCommand {
|
|||
std::mem::swap(&mut color, &mut track.color);
|
||||
Ok(Some(Self::SetColor { color }))
|
||||
}
|
||||
fn set_mute (track: &mut Track, value: Option<bool>) -> Perhaps<Self> {
|
||||
fn set_mute (_track: &mut Track, _value: Option<bool>) -> Perhaps<Self> {
|
||||
todo!()
|
||||
}
|
||||
fn set_solo (track: &mut Track, value: Option<bool>) -> Perhaps<Self> {
|
||||
fn set_solo (_track: &mut Track, _value: Option<bool>) -> Perhaps<Self> {
|
||||
todo!()
|
||||
}
|
||||
fn set_rec (track: &mut Track, value: Option<bool>) -> Perhaps<Self> {
|
||||
|
|
@ -155,10 +155,10 @@ impl TrackCommand {
|
|||
let value = value.unwrap_or(!current);
|
||||
Ok((value != current).then_some(Self::SetRec { value: Some(current) }))
|
||||
}
|
||||
fn set_size (track: &mut Track, size: usize) -> Perhaps<Self> {
|
||||
fn set_size (_track: &mut Track, _size: usize) -> Perhaps<Self> {
|
||||
todo!()
|
||||
}
|
||||
fn set_zoom (track: &mut Track, zoom: usize) -> Perhaps<Self> {
|
||||
fn set_zoom (_track: &mut Track, _zoom: usize) -> Perhaps<Self> {
|
||||
todo!()
|
||||
}
|
||||
fn stop (track: &mut Track) -> Perhaps<Self> {
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ pub(crate) fn button_play_pause (playing: bool) -> impl Content<TuiOut> {
|
|||
impl Default for ViewCache {
|
||||
fn default () -> Self {
|
||||
let mut beat = String::with_capacity(16);
|
||||
write!(beat, "{}", Self::BEAT_EMPTY);
|
||||
let _ = write!(beat, "{}", Self::BEAT_EMPTY);
|
||||
let mut time = String::with_capacity(16);
|
||||
write!(time, "{}", Self::TIME_EMPTY);
|
||||
let _ = write!(time, "{}", Self::TIME_EMPTY);
|
||||
let mut bpm = String::with_capacity(16);
|
||||
write!(bpm, "{}", Self::BPM_EMPTY);
|
||||
let _ = write!(bpm, "{}", Self::BPM_EMPTY);
|
||||
Self {
|
||||
beat: Memo::new(None, beat),
|
||||
time: Memo::new(None, time),
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ impl PoolClipCommand {
|
|||
Ok(Self::Add { index, clip }.execute(pool)?)
|
||||
}
|
||||
|
||||
fn export (pool: &mut Pool, index: usize, path: PathBuf) -> Perhaps<Self> {
|
||||
fn export (_pool: &mut Pool, _index: usize, _path: PathBuf) -> Perhaps<Self> {
|
||||
todo!("export clip to midi file");
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ impl PoolClipCommand {
|
|||
|
||||
#[tengri_proc::command(Pool)]
|
||||
impl RenameCommand {
|
||||
fn begin (pool: &mut Pool) -> Perhaps<Self> {
|
||||
fn begin (_pool: &mut Pool) -> Perhaps<Self> {
|
||||
unreachable!();
|
||||
}
|
||||
fn cancel (pool: &mut Pool) -> Perhaps<Self> {
|
||||
|
|
@ -165,7 +165,7 @@ impl RenameCommand {
|
|||
return Ok(None)
|
||||
}
|
||||
fn confirm (pool: &mut Pool) -> Perhaps<Self> {
|
||||
if let Some(PoolMode::Rename(clip, ref mut old_name)) = pool.mode_mut().clone() {
|
||||
if let Some(PoolMode::Rename(_clip, ref mut old_name)) = pool.mode_mut().clone() {
|
||||
let old_name = old_name.clone();
|
||||
*pool.mode_mut() = None;
|
||||
return Ok(Some(Self::Set { value: old_name }))
|
||||
|
|
@ -173,7 +173,7 @@ impl RenameCommand {
|
|||
return Ok(None)
|
||||
}
|
||||
fn set (pool: &mut Pool, value: Arc<str>) -> Perhaps<Self> {
|
||||
if let Some(PoolMode::Rename(clip, ref mut old_name)) = pool.mode_mut().clone() {
|
||||
if let Some(PoolMode::Rename(clip, ref mut _old_name)) = pool.mode_mut().clone() {
|
||||
pool.clips()[clip].write().unwrap().name = value;
|
||||
}
|
||||
return Ok(None)
|
||||
|
|
@ -182,7 +182,7 @@ impl RenameCommand {
|
|||
|
||||
#[tengri_proc::command(Pool)]
|
||||
impl CropCommand {
|
||||
fn begin (pool: &mut Pool) -> Perhaps<Self> {
|
||||
fn begin (_pool: &mut Pool) -> Perhaps<Self> {
|
||||
unreachable!()
|
||||
}
|
||||
fn cancel (pool: &mut Pool) -> Perhaps<Self> {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ impl Sampler {
|
|||
impl SamplerCommand {
|
||||
fn record_toggle (sampler: &mut Sampler, slot: usize) -> Perhaps<Self> {
|
||||
let recording = sampler.recording.as_ref().map(|x|x.0);
|
||||
Self::record_finish(sampler);
|
||||
Self::record_finish(sampler)?;
|
||||
// autoslice: continue recording at next slot
|
||||
if recording != Some(slot) {
|
||||
Self::record_begin(sampler, slot)
|
||||
|
|
|
|||
2
deps/tengri
vendored
2
deps/tengri
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit d7884f6289ac6c7a88f806f4453fb7c246c87f0b
|
||||
Subproject commit 4fc0db577737ad1ce2601aa99d45248dba9a2d5f
|
||||
Loading…
Add table
Add a link
Reference in a new issue