unify init naming; GrooveboxTui -> Groovebox

This commit is contained in:
🪞👃🪞 2024-12-29 20:32:00 +01:00
parent 6607491f16
commit 0c9c386a79
7 changed files with 20 additions and 20 deletions

View file

@ -6,7 +6,7 @@ use GrooveboxCommand::*;
use PhraseCommand::*;
use PhrasePoolCommand::*;
pub struct GrooveboxTui {
pub struct Groovebox {
_jack: Arc<RwLock<JackConnection>>,
pub player: MidiPlayer,
@ -20,7 +20,7 @@ pub struct GrooveboxTui {
pub midi_buf: Vec<Vec<Vec<u8>>>,
pub perf: PerfModel,
}
impl GrooveboxTui {
impl Groovebox {
pub fn new (
jack: &Arc<RwLock<JackConnection>>,
midi_from: &[impl AsRef<str>],
@ -64,8 +64,8 @@ impl GrooveboxTui {
})
}
}
has_clock!(|self: GrooveboxTui|self.player.clock());
audio!(|self: GrooveboxTui, client, scope|{
has_clock!(|self: Groovebox|self.player.clock());
audio!(|self: Groovebox, client, scope|{
let t0 = self.perf.get_t0();
if Control::Quit == ClockAudio(&mut self.player).process(client, scope) {
return Control::Quit
@ -111,7 +111,7 @@ audio!(|self: GrooveboxTui, client, scope|{
self.perf.update(t0, scope);
Control::Continue
});
render!(<Tui>|self:GrooveboxTui|{
render!(<Tui>|self:Groovebox|{
let w = self.size.w();
let phrase_w = if w > 60 { 20 } else if w > 40 { 15 } else { 10 };
let pool_w = if self.pool.visible { phrase_w } else { 0 };
@ -165,7 +165,7 @@ render!(<Tui>|self:GrooveboxTui|{
]))
});
struct GrooveboxSamples<'a>(&'a GrooveboxTui);
struct GrooveboxSamples<'a>(&'a Groovebox);
render!(<Tui>|self: GrooveboxSamples<'a>|{
let note_lo = self.0.editor.note_lo().load(Relaxed);
let note_pt = self.0.editor.note_point();
@ -198,9 +198,9 @@ pub enum GrooveboxCommand {
Sampler(SamplerCommand),
}
handle!(<Tui>|self: GrooveboxTui, input|GrooveboxCommand::execute_with_state(self, input));
handle!(<Tui>|self: Groovebox, input|GrooveboxCommand::execute_with_state(self, input));
input_to_command!(GrooveboxCommand: <Tui>|state: GrooveboxTui, input|match input.event() {
input_to_command!(GrooveboxCommand: <Tui>|state: Groovebox, input|match input.event() {
// TODO: k: toggle on-screen keyboard
key_pat!(Ctrl-Char('k')) => {
todo!("keyboard")
@ -249,7 +249,7 @@ input_to_command!(GrooveboxCommand: <Tui>|state: GrooveboxTui, input|match input
}
});
command!(|self:GrooveboxCommand,state:GrooveboxTui|match self {
command!(|self: GrooveboxCommand, state: Groovebox|match self {
Self::Pool(cmd) => {
let mut default = |cmd: PoolCommand|cmd
.execute(&mut state.pool)