mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
show buffer size and latency
This commit is contained in:
parent
763063f4ed
commit
51889d4b43
5 changed files with 33 additions and 14 deletions
|
|
@ -30,7 +30,7 @@ impl TryFrom<&Arc<RwLock<JackClient>>> for ArrangerTui {
|
|||
fn try_from (jack: &Arc<RwLock<JackClient>>) -> Usually<Self> {
|
||||
Ok(Self {
|
||||
jack: jack.clone(),
|
||||
clock: ClockModel::from(&Arc::new(jack.read().unwrap().transport())),
|
||||
clock: ClockModel::from(jack),
|
||||
phrases: PhraseListModel::default(),
|
||||
editor: PhraseEditorModel::default(),
|
||||
selected: ArrangerSelection::Clip(0, 0),
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ pub struct SequencerTui {
|
|||
impl TryFrom<&Arc<RwLock<JackClient>>> for SequencerTui {
|
||||
type Error = Box<dyn std::error::Error>;
|
||||
fn try_from (jack: &Arc<RwLock<JackClient>>) -> Usually<Self> {
|
||||
let clock = ClockModel::from(&Arc::new(jack.read().unwrap().transport()));
|
||||
let clock = ClockModel::from(jack);
|
||||
Ok(Self {
|
||||
jack: jack.clone(),
|
||||
phrases: PhraseListModel::default(),
|
||||
|
|
@ -111,7 +111,7 @@ impl_focus!(SequencerTui SequencerFocus [
|
|||
pub struct SequencerStatusBar {
|
||||
pub(crate) cpu: Option<String>,
|
||||
pub(crate) size: String,
|
||||
pub(crate) sr: String,
|
||||
pub(crate) res: String,
|
||||
pub(crate) mode: &'static str,
|
||||
pub(crate) help: &'static [(&'static str, &'static str, &'static str)]
|
||||
}
|
||||
|
|
@ -130,10 +130,13 @@ impl From<&SequencerTui> for SequencerStatusBar {
|
|||
fn from (state: &SequencerTui) -> Self {
|
||||
use SequencerFocus::*;
|
||||
use TransportFocus::*;
|
||||
let samples = state.clock.chunk.load(Ordering::Relaxed);
|
||||
let rate = state.clock.current.timebase.sr.get() as f64;
|
||||
let buffer = samples as f64 / rate;
|
||||
Self {
|
||||
cpu: state.perf.percentage().map(|cpu|format!(" {cpu:.01}% ")),
|
||||
size: format!(" {}x{} ", state.size.w(), state.size.h()),
|
||||
sr: format!(" {}Hz ", state.clock.current.timebase.sr.get()),
|
||||
cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")),
|
||||
size: format!("{}x{}│", state.size.w(), state.size.h()),
|
||||
res: format!("│{}s│{:.1}kHz│{:.1}ms│", samples, rate / 1000., buffer * 1000.),
|
||||
mode: match state.focused() {
|
||||
Transport(focus) => match focus {
|
||||
PlayPause => " PLAY/PAUSE ",
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl TryFrom<&Arc<RwLock<JackClient>>> for TransportTui {
|
|||
fn try_from (jack: &Arc<RwLock<JackClient>>) -> Usually<Self> {
|
||||
Ok(Self {
|
||||
jack: jack.clone(),
|
||||
clock: ClockModel::from(&Arc::new(jack.read().unwrap().transport())),
|
||||
clock: ClockModel::from(jack),
|
||||
size: Measure::new(),
|
||||
cursor: (0, 0),
|
||||
focus: FocusState::Entered(TransportFocus::PlayPause)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ impl Content for SequencerStatusBar {
|
|||
widget(&self.mode).bg(orange).fg(black).bold(true),
|
||||
row!(
|
||||
widget(&self.cpu).fg(orange),
|
||||
widget(&self.sr).fg(orange),
|
||||
widget(&self.res).fg(orange),
|
||||
widget(&self.size).fg(orange),
|
||||
).align_se().fill_x()
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue