mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
more minor cleanups
This commit is contained in:
parent
1b7f0e0b93
commit
43ccfff24a
2 changed files with 11 additions and 57 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
use KeyCode::*;
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub enum PoolCommand {
|
pub enum PoolCommand {
|
||||||
Show(bool),
|
Show(bool),
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,13 @@
|
||||||
#![feature(impl_trait_in_assoc_type)]
|
#![feature(impl_trait_in_assoc_type)]
|
||||||
#![feature(type_alias_impl_trait)]
|
#![feature(type_alias_impl_trait)]
|
||||||
pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicBool, Ordering::{self, *}}};
|
pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicBool, Ordering::{self, *}}};
|
||||||
pub(crate) use std::error::Error;
|
|
||||||
/// Standard result type.
|
/// Standard result type.
|
||||||
pub type Usually<T> = std::result::Result<T, Box<dyn Error>>;
|
pub type Usually<T> = std::result::Result<T, Box<dyn std::error::Error>>;
|
||||||
/// Standard optional result type.
|
/// Standard optional result type.
|
||||||
pub type Perhaps<T> = std::result::Result<Option<T>, Box<dyn Error>>;
|
pub type Perhaps<T> = std::result::Result<Option<T>, Box<dyn std::error::Error>>;
|
||||||
pub use ::tek_time::{self, *};
|
pub use ::tek_time::{self, *};
|
||||||
pub use ::tek_jack::{self, *, jack::{*, contrib::*}};
|
pub use ::tek_jack::{self, *, jack::*};
|
||||||
pub use ::tek_midi::{self, *, midly::{*, num::*, live::*}};
|
pub use ::tek_midi::{self, *, midly::{MidiMessage, num::*, live::*}};
|
||||||
pub use ::tek_sampler::{self, *};
|
pub use ::tek_sampler::{self, *};
|
||||||
pub use ::tek_plugin::{self, *};
|
pub use ::tek_plugin::{self, *};
|
||||||
pub use ::tek_tui::{
|
pub use ::tek_tui::{
|
||||||
|
|
@ -910,64 +909,18 @@ audio!(|self: App, client, scope|{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update track sequencers
|
// Update track sequencers
|
||||||
let tracks = &mut self.tracks;
|
for track in self.tracks.iter_mut() {
|
||||||
let note_buf = &mut self.note_buf;
|
if PlayerAudio(
|
||||||
let midi_buf = &mut self.midi_buf;
|
track.player_mut(), &mut self.note_buf, &mut self.midi_buf
|
||||||
if Control::Quit == TracksAudio(tracks, note_buf, midi_buf).process(client, scope) {
|
).process(client, scope) == Control::Quit {
|
||||||
return Control::Quit
|
return Control::Quit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: update timeline position in editor.
|
|
||||||
// must be in sync with clip's playback. since
|
|
||||||
// a clip can be on multiple tracks and launched
|
|
||||||
// at different times, add a playhead with the
|
|
||||||
// playing track's color.
|
|
||||||
//self.now.set(0.);
|
|
||||||
//if let Selection::Clip(t, s) = self.selected {
|
|
||||||
//let clip = self.scenes.get(s).map(|scene|scene.clips.get(t));
|
|
||||||
//if let Some(Some(Some(clip))) = clip {
|
|
||||||
//if let Some(track) = self.tracks().get(t) {
|
|
||||||
//if let Some((ref started_at, Some(ref playing))) = track.player.play_clip {
|
|
||||||
//let clip = clip.read().unwrap();
|
|
||||||
//if *playing.read().unwrap() == *clip {
|
|
||||||
//let pulse = self.current().pulse.get();
|
|
||||||
//let start = started_at.pulse.get();
|
|
||||||
//let now = (pulse - start) % clip.length as f64;
|
|
||||||
//self.now.set(now);
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
|
|
||||||
// End profiling cycle
|
// End profiling cycle
|
||||||
self.perf.update(t0, scope);
|
self.perf.update(t0, scope);
|
||||||
Control::Continue
|
Control::Continue
|
||||||
});
|
});
|
||||||
/// Hosts the JACK callback for a collection of tracks
|
|
||||||
struct TracksAudio<'a>(
|
|
||||||
// Track collection
|
|
||||||
&'a mut [Track],
|
|
||||||
/// Note buffer
|
|
||||||
&'a mut Vec<u8>,
|
|
||||||
/// Note chunk buffer
|
|
||||||
&'a mut Vec<Vec<Vec<u8>>>,
|
|
||||||
);
|
|
||||||
impl Audio for TracksAudio<'_> {
|
|
||||||
fn process (&mut self, client: &Client, scope: &ProcessScope) -> Control {
|
|
||||||
let model = &mut self.0;
|
|
||||||
let note_buffer = &mut self.1;
|
|
||||||
let output_buffer = &mut self.2;
|
|
||||||
for track in model.iter_mut() {
|
|
||||||
if PlayerAudio(track.player_mut(), note_buffer, output_buffer).process(client, scope) == Control::Quit {
|
|
||||||
return Control::Quit
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Control::Continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn help_tag <'a> (before: &'a str, key: &'a str, after: &'a str) -> impl Content<TuiOut> + 'a {
|
fn help_tag <'a> (before: &'a str, key: &'a str, after: &'a str) -> impl Content<TuiOut> + 'a {
|
||||||
let lo = TuiTheme::g(128);
|
let lo = TuiTheme::g(128);
|
||||||
let hi = TuiTheme::orange();
|
let hi = TuiTheme::orange();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue