wip: unified dsl_ns macro

This commit is contained in:
🪞👃🪞 2025-08-16 13:56:55 +03:00
parent 28aacd7cbc
commit 08730df042
8 changed files with 524 additions and 510 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,4 @@
pub(crate) use tek::*; pub(crate) use tek::*;
pub(crate) use std::sync::{Arc, RwLock};
pub(crate) use clap::{self, Parser, Subcommand}; pub(crate) use clap::{self, Parser, Subcommand};
/// Application entrypoint. /// Application entrypoint.
@ -56,16 +55,16 @@ impl Cli {
let empty = &[] as &[&str]; let empty = &[] as &[&str];
let mut midi_ins = vec![]; let mut midi_ins = vec![];
let mut midi_outs = vec![]; let mut midi_outs = vec![];
let mut tracks = vec![]; let tracks = vec![];
let mut scenes = vec![]; let scenes = vec![];
let midi_froms = Connect::collect(&self.midi_from, empty, &self.midi_from_re); 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 midi_tos = Connect::collect(&self.midi_to, empty, &self.midi_to_re);
let left_froms = Connect::collect(&self.left_from, empty, empty); let left_froms = Connect::collect(&self.left_from, empty, empty);
let left_tos = Connect::collect(&self.left_to, empty, empty); let left_tos = Connect::collect(&self.left_to, empty, empty);
let right_froms = Connect::collect(&self.right_from, empty, empty); let right_froms = Connect::collect(&self.right_from, empty, empty);
let right_tos = Connect::collect(&self.right_to, 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_froms = &[left_froms.as_slice(), right_froms.as_slice()];
let audio_tos = &[left_tos.as_slice(), right_tos.as_slice()]; let _audio_tos = &[left_tos.as_slice(), right_tos.as_slice()];
Tui::new()?.run(&Jack::new_run(&name, move|jack|{ Tui::new()?.run(&Jack::new_run(&name, move|jack|{
for (index, connect) in midi_froms.iter().enumerate() { for (index, connect) in midi_froms.iter().enumerate() {
midi_ins.push(jack.midi_in(&format!("M/{index}"), &[connect.clone()])?); 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()])?); midi_outs.push(jack.midi_out(&format!("{index}/M"), &[connect.clone()])?);
}; };
let clock = Clock::new(&jack, self.bpm)?; let clock = Clock::new(&jack, self.bpm)?;
let mut app = App { let app = App {
config, config,
jack: jack.clone(), jack: jack.clone(),
color: ItemTheme::random(), color: ItemTheme::random(),

View file

@ -25,7 +25,7 @@ impl HasSceneScroll for Arrangement {
fn scene_scroll (&self) -> usize { self.scene_scroll } 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 {} impl<T: HasScenes + HasTracks> AddScene for T {}

View file

@ -139,10 +139,10 @@ impl TrackCommand {
std::mem::swap(&mut color, &mut track.color); std::mem::swap(&mut color, &mut track.color);
Ok(Some(Self::SetColor { 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!() todo!()
} }
fn set_solo (track: &mut Track, value: Option<bool>) -> Perhaps<Self> { fn set_solo (_track: &mut Track, _value: Option<bool>) -> Perhaps<Self> {
todo!() todo!()
} }
fn set_rec (track: &mut Track, value: Option<bool>) -> Perhaps<Self> { fn set_rec (track: &mut Track, value: Option<bool>) -> Perhaps<Self> {
@ -155,10 +155,10 @@ impl TrackCommand {
let value = value.unwrap_or(!current); let value = value.unwrap_or(!current);
Ok((value != current).then_some(Self::SetRec { value: Some(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!() todo!()
} }
fn set_zoom (track: &mut Track, zoom: usize) -> Perhaps<Self> { fn set_zoom (_track: &mut Track, _zoom: usize) -> Perhaps<Self> {
todo!() todo!()
} }
fn stop (track: &mut Track) -> Perhaps<Self> { fn stop (track: &mut Track) -> Perhaps<Self> {

View file

@ -63,11 +63,11 @@ pub(crate) fn button_play_pause (playing: bool) -> impl Content<TuiOut> {
impl Default for ViewCache { impl Default for ViewCache {
fn default () -> Self { fn default () -> Self {
let mut beat = String::with_capacity(16); 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); 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); let mut bpm = String::with_capacity(16);
write!(bpm, "{}", Self::BPM_EMPTY); let _ = write!(bpm, "{}", Self::BPM_EMPTY);
Self { Self {
beat: Memo::new(None, beat), beat: Memo::new(None, beat),
time: Memo::new(None, time), time: Memo::new(None, time),

View file

@ -127,7 +127,7 @@ impl PoolClipCommand {
Ok(Self::Add { index, clip }.execute(pool)?) 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"); todo!("export clip to midi file");
} }
@ -155,7 +155,7 @@ impl PoolClipCommand {
#[tengri_proc::command(Pool)] #[tengri_proc::command(Pool)]
impl RenameCommand { impl RenameCommand {
fn begin (pool: &mut Pool) -> Perhaps<Self> { fn begin (_pool: &mut Pool) -> Perhaps<Self> {
unreachable!(); unreachable!();
} }
fn cancel (pool: &mut Pool) -> Perhaps<Self> { fn cancel (pool: &mut Pool) -> Perhaps<Self> {
@ -165,7 +165,7 @@ impl RenameCommand {
return Ok(None) return Ok(None)
} }
fn confirm (pool: &mut Pool) -> Perhaps<Self> { 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(); let old_name = old_name.clone();
*pool.mode_mut() = None; *pool.mode_mut() = None;
return Ok(Some(Self::Set { value: old_name })) return Ok(Some(Self::Set { value: old_name }))
@ -173,7 +173,7 @@ impl RenameCommand {
return Ok(None) return Ok(None)
} }
fn set (pool: &mut Pool, value: Arc<str>) -> Perhaps<Self> { 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; pool.clips()[clip].write().unwrap().name = value;
} }
return Ok(None) return Ok(None)
@ -182,7 +182,7 @@ impl RenameCommand {
#[tengri_proc::command(Pool)] #[tengri_proc::command(Pool)]
impl CropCommand { impl CropCommand {
fn begin (pool: &mut Pool) -> Perhaps<Self> { fn begin (_pool: &mut Pool) -> Perhaps<Self> {
unreachable!() unreachable!()
} }
fn cancel (pool: &mut Pool) -> Perhaps<Self> { fn cancel (pool: &mut Pool) -> Perhaps<Self> {

View file

@ -52,7 +52,7 @@ impl Sampler {
impl SamplerCommand { impl SamplerCommand {
fn record_toggle (sampler: &mut Sampler, slot: usize) -> Perhaps<Self> { fn record_toggle (sampler: &mut Sampler, slot: usize) -> Perhaps<Self> {
let recording = sampler.recording.as_ref().map(|x|x.0); let recording = sampler.recording.as_ref().map(|x|x.0);
Self::record_finish(sampler); Self::record_finish(sampler)?;
// autoslice: continue recording at next slot // autoslice: continue recording at next slot
if recording != Some(slot) { if recording != Some(slot) {
Self::record_begin(sampler, slot) Self::record_begin(sampler, slot)

2
deps/tengri vendored

@ -1 +1 @@
Subproject commit d7884f6289ac6c7a88f806f4453fb7c246c87f0b Subproject commit 4fc0db577737ad1ce2601aa99d45248dba9a2d5f