mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
implement App::new
This commit is contained in:
parent
07084656b8
commit
afa2a2fd2b
2 changed files with 19 additions and 16 deletions
17
src/main.rs
17
src/main.rs
|
|
@ -22,25 +22,10 @@ use crate::{core::*, model::*};
|
||||||
|
|
||||||
/// Application entrypoint.
|
/// Application entrypoint.
|
||||||
pub fn main () -> Usually<()> {
|
pub fn main () -> Usually<()> {
|
||||||
// Construct app
|
|
||||||
let mut app = App::default();
|
|
||||||
// Load config
|
|
||||||
let xdg = Arc::new(microxdg::XdgApp::new("tek")?);
|
|
||||||
app.xdg = Some(xdg.clone());
|
|
||||||
if crate::config::AppPaths::new(&xdg)?.should_create() {
|
|
||||||
app.modal = Some(Box::new(crate::config::SetupModal(Some(xdg.clone()))));
|
|
||||||
}
|
|
||||||
let midi_from = ["nanoKEY Studio.*capture.*"];
|
let midi_from = ["nanoKEY Studio.*capture.*"];
|
||||||
let audio_into = ["Komplete.+:playback_FL", "Komplete.+:playback_FR"];
|
let audio_into = ["Komplete.+:playback_FL", "Komplete.+:playback_FR"];
|
||||||
// Init view
|
|
||||||
app.track_cursor = 1;
|
|
||||||
app.scene_cursor = 1;
|
|
||||||
app.note_start = 2;
|
|
||||||
app.time_zoom = 12;
|
|
||||||
app.quant = 24;
|
|
||||||
|
|
||||||
// Start main loop
|
// Start main loop
|
||||||
app.run(Some(|app: Arc<RwLock<App>>|{
|
App::new()?.run(Some(|app: Arc<RwLock<App>>|{
|
||||||
let mut state = app.write().unwrap();
|
let mut state = app.write().unwrap();
|
||||||
// Start JACK and setup device graph
|
// Start JACK and setup device graph
|
||||||
let jack = jack_run("tek", &app)?;
|
let jack = jack_run("tek", &app)?;
|
||||||
|
|
|
||||||
18
src/model.rs
18
src/model.rs
|
|
@ -72,6 +72,24 @@ pub struct App {
|
||||||
/// Quantization factor
|
/// Quantization factor
|
||||||
pub quant: usize,
|
pub quant: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl App {
|
||||||
|
pub fn new () -> Usually<Self> {
|
||||||
|
let xdg = Arc::new(microxdg::XdgApp::new("tek")?);
|
||||||
|
let first_run = crate::config::AppPaths::new(&xdg)?.should_create();
|
||||||
|
Ok(Self {
|
||||||
|
modal: first_run.then(||crate::config::SetupModal(Some(xdg.clone())).boxed()),
|
||||||
|
xdg: Some(xdg),
|
||||||
|
track_cursor: 1,
|
||||||
|
scene_cursor: 1,
|
||||||
|
note_start: 2,
|
||||||
|
time_zoom: 12,
|
||||||
|
quant: 24,
|
||||||
|
..Self::default()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
process!(App |self, _client, scope| {
|
process!(App |self, _client, scope| {
|
||||||
let (
|
let (
|
||||||
reset, current_frames, current_usecs, next_usecs, period_usecs
|
reset, current_frames, current_usecs, next_usecs, period_usecs
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue