mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 13:16:44 +01:00
implement sequencer focus; auto update_focus
This commit is contained in:
parent
9f15f8fff9
commit
3bf475d15e
8 changed files with 119 additions and 160 deletions
|
|
@ -7,24 +7,20 @@ pub fn main () -> Usually<()> { SequencerCli::parse().run() }
|
|||
#[command(version, about, long_about = None)]
|
||||
pub struct SequencerCli {
|
||||
/// Name of JACK client
|
||||
#[arg(short, long)] name: Option<String>,
|
||||
#[arg(short, long)] name: Option<String>,
|
||||
/// Pulses per quarter note (sequencer resolution; default: 96)
|
||||
#[arg(short, long)] ppq: Option<usize>,
|
||||
#[arg(short, long)] ppq: Option<usize>,
|
||||
/// Default phrase duration (in pulses; default: 4 * PPQ = 1 bar)
|
||||
#[arg(short, long)] length: Option<usize>,
|
||||
#[arg(short, long)] length: Option<usize>,
|
||||
/// Whether to include a transport toolbar (default: true)
|
||||
#[arg(short, long)] transport: Option<bool>
|
||||
#[arg(short, long, default_value_t = true)] transport: bool
|
||||
}
|
||||
|
||||
impl SequencerCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
let jack = JackClient::Inactive(
|
||||
Client::new("tek_arranger", ClientOptions::NO_START_SERVER)?.0
|
||||
);
|
||||
let jack_transport = jack.transport();
|
||||
let mut transport = TransportToolbar::new(Some(jack_transport));
|
||||
transport.set_focused(true);
|
||||
let transport = Arc::new(RwLock::new(transport));
|
||||
let jack = Client::new("tek_arranger", ClientOptions::NO_START_SERVER)?.0;
|
||||
let jack = JackClient::Inactive(jack);
|
||||
let transport = Arc::new(RwLock::new(TransportToolbar::new(Some(jack.transport()))));
|
||||
transport.write().unwrap().jack = Some(
|
||||
jack.activate(
|
||||
&transport.clone(),
|
||||
|
|
@ -34,10 +30,10 @@ impl SequencerCli {
|
|||
)?
|
||||
);
|
||||
let seq = Sequencer {
|
||||
focus: 0,
|
||||
editor: PhraseEditor::new(),
|
||||
phrases: Arc::new(RwLock::new(PhrasePool::new())),
|
||||
transport: Some(transport),
|
||||
focus_cursor: (1, 1),
|
||||
transport: self.transport.then_some(transport),
|
||||
editor: PhraseEditor::new(),
|
||||
phrases: Arc::new(RwLock::new(PhrasePool::new())),
|
||||
};
|
||||
if let Some(name) = self.name.as_ref() {
|
||||
// TODO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue