mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
show sample names
This commit is contained in:
parent
511ff91864
commit
5bc19a45d2
8 changed files with 23 additions and 25 deletions
|
|
@ -76,7 +76,7 @@ impl ArrangerTui {
|
|||
from_jack!(|jack| ArrangerTui {
|
||||
let clock = Clock::from(jack);
|
||||
let phrase = Arc::new(RwLock::new(MidiClip::new(
|
||||
"New", true, 4 * clock.timebase.ppq.get() as usize,
|
||||
"Clip", true, 4 * clock.timebase.ppq.get() as usize,
|
||||
None, Some(ItemColor::random().into())
|
||||
)));
|
||||
Self {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pub trait BorderStyle: Send + Sync + Copy {
|
|||
Bordered(self, w)
|
||||
}
|
||||
fn enclose <W: Content<Tui>> (self, w: W) -> impl Content<Tui> {
|
||||
Tui::bg(self.style().unwrap().bg.unwrap(), lay!(Fill::xy(Border(self)), w))
|
||||
Tui::bg(self.style().unwrap().bg.unwrap_or(Color::Reset), lay!(Fill::xy(Border(self)), w))
|
||||
}
|
||||
const NW: &'static str = "";
|
||||
const N: &'static str = "";
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl Groovebox {
|
|||
let mut player = crate::midi::MidiPlayer::new(jack, &"sequencer", &midi_from, &midi_to)?;
|
||||
jack.read().unwrap().client().connect_ports(&player.midi_outs[0], &sampler.midi_in)?;
|
||||
let phrase = Arc::new(RwLock::new(MidiClip::new(
|
||||
"New", true, 4 * player.clock.timebase.ppq.get() as usize,
|
||||
"Clip", true, 4 * player.clock.timebase.ppq.get() as usize,
|
||||
None, Some(ItemColor::random().into())
|
||||
)));
|
||||
player.play_phrase = Some((Moment::zero(&player.clock.timebase), Some(phrase.clone())));
|
||||
|
|
@ -112,16 +112,13 @@ render!(Tui: (self: Groovebox) => {
|
|||
Bsp::s(
|
||||
lay!(Align::w(edit_clip), Align::e(selectors)),
|
||||
Bsp::n(
|
||||
Bsp::a(
|
||||
Outer(Style::default().fg(TuiTheme::g(128))),
|
||||
Fill::x(Fixed::y(sample_h, if let Some((_, sample)) = &self.sampler.recording {
|
||||
Max::y(sample_h, Fill::xy(if let Some((_, sample)) = &self.sampler.recording {
|
||||
SampleViewer(Some(sample.clone()))
|
||||
} else if let Some(sample) = &self.sampler.mapped[note_pt] {
|
||||
SampleViewer(Some(sample.clone()))
|
||||
} else {
|
||||
SampleViewer(None)
|
||||
})),
|
||||
),
|
||||
Bsp::n(
|
||||
lay!(
|
||||
Align::w(Fixed::y(1, SamplerStatus(&self.sampler, note_pt))),
|
||||
|
|
|
|||
|
|
@ -147,10 +147,10 @@ fn to_phrases_command (state: &PoolModel, input: &TuiIn) -> Option<PoolCommand>
|
|||
return None
|
||||
},
|
||||
key_pat!(Char('a')) | key_pat!(Shift-Char('A')) => Cmd::Phrase(PhrasePoolCommand::Add(count, MidiClip::new(
|
||||
String::from("(new)"), true, 4 * PPQ, None, Some(ItemPalette::random())
|
||||
String::from("Clip"), true, 4 * PPQ, None, Some(ItemPalette::random())
|
||||
))),
|
||||
key_pat!(Char('i')) => Cmd::Phrase(PhrasePoolCommand::Add(index + 1, MidiClip::new(
|
||||
String::from("(new)"), true, 4 * PPQ, None, Some(ItemPalette::random())
|
||||
String::from("Clip"), true, 4 * PPQ, None, Some(ItemPalette::random())
|
||||
))),
|
||||
key_pat!(Char('d')) | key_pat!(Shift-Char('D')) => {
|
||||
let mut phrase = state.phrases()[index].read().unwrap().duplicate();
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ impl Sampler {
|
|||
pub fn begin_recording (&mut self, index: usize) {
|
||||
self.recording = Some((
|
||||
index,
|
||||
Arc::new(RwLock::new(Sample::new("(new)", 0, 0, vec![vec![];self.audio_ins.len()])))
|
||||
Arc::new(RwLock::new(Sample::new("Sample", 0, 0, vec![vec![];self.audio_ins.len()])))
|
||||
));
|
||||
}
|
||||
pub fn finish_recording (&mut self) -> Option<Arc<RwLock<Sample>>> {
|
||||
|
|
|
|||
|
|
@ -23,22 +23,23 @@ render!(Tui: (self: SampleList<'a>) => {
|
|||
|
||||
let mut bg = if note == note_pt { TuiTheme::g(64) } else { Color::Reset };
|
||||
let mut fg = TuiTheme::g(160);
|
||||
if sampler.mapped[note].is_some() {
|
||||
fg = TuiTheme::g(224);
|
||||
bg = Color::Rgb(0, if note == note_pt { 96 } else { 64 }, 0);
|
||||
}
|
||||
if let Some((index, _)) = sampler.recording {
|
||||
if note == index {
|
||||
bg = Color::Rgb(64,16,0);
|
||||
bg = if note == note_pt { Color::Rgb(96,24,0) } else { Color::Rgb(64,16,0) };
|
||||
fg = Color::Rgb(224,64,32)
|
||||
}
|
||||
} else if sampler.mapped[note].is_some() {
|
||||
fg = TuiTheme::g(224);
|
||||
}
|
||||
|
||||
offset(Tui::fg_bg(fg, bg, format!("{note:3} {}", if *compact {
|
||||
""
|
||||
String::default()
|
||||
} else if let Some(sample) = &sampler.mapped[note] {
|
||||
"??????"
|
||||
sample.read().unwrap().name.clone()
|
||||
} else {
|
||||
"(none)"
|
||||
String::from("(none)")
|
||||
})))
|
||||
|
||||
}))
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ pub struct SequencerTui {
|
|||
from_jack!(|jack|SequencerTui {
|
||||
let clock = Clock::from(jack);
|
||||
let phrase = Arc::new(RwLock::new(MidiClip::new(
|
||||
"New", true, 4 * clock.timebase.ppq.get() as usize,
|
||||
"Clip", true, 4 * clock.timebase.ppq.get() as usize,
|
||||
None, Some(ItemColor::random().into())
|
||||
)));
|
||||
Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue