Lots + MIDI implementation
This commit is contained in:
14
src/app.rs
14
src/app.rs
@@ -10,6 +10,7 @@ use crate::commands::AppCommand;
|
||||
use crate::engine::{
|
||||
LinkState, PatternChange, PatternSnapshot, SeqCommand, SequencerSnapshot, StepSnapshot,
|
||||
};
|
||||
use crate::midi::MidiState;
|
||||
use crate::model::{self, Bank, Dictionary, Pattern, Rng, ScriptEngine, StepContext, Variables};
|
||||
use crate::page::Page;
|
||||
use crate::services::pattern_editor;
|
||||
@@ -46,6 +47,7 @@ pub struct App {
|
||||
pub audio: AudioSettings,
|
||||
pub options: OptionsState,
|
||||
pub panel: PanelState,
|
||||
pub midi: MidiState,
|
||||
}
|
||||
|
||||
impl Default for App {
|
||||
@@ -86,6 +88,7 @@ impl App {
|
||||
audio: AudioSettings::default(),
|
||||
options: OptionsState::default(),
|
||||
panel: PanelState::default(),
|
||||
midi: MidiState::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,6 +117,14 @@ impl App {
|
||||
tempo: link.tempo(),
|
||||
quantum: link.quantum(),
|
||||
},
|
||||
midi: crate::settings::MidiSettings {
|
||||
output_device: self.midi.selected_output.and_then(|idx| {
|
||||
crate::midi::list_midi_outputs().get(idx).map(|d| d.name.clone())
|
||||
}),
|
||||
input_device: self.midi.selected_input.and_then(|idx| {
|
||||
crate::midi::list_midi_inputs().get(idx).map(|d| d.name.clone())
|
||||
}),
|
||||
},
|
||||
};
|
||||
settings.save();
|
||||
}
|
||||
@@ -315,6 +326,7 @@ impl App {
|
||||
speed,
|
||||
fill: false,
|
||||
nudge_secs: 0.0,
|
||||
cc_memory: None,
|
||||
};
|
||||
|
||||
let cmds = self.script_engine.evaluate(script, &ctx)?;
|
||||
@@ -365,6 +377,7 @@ impl App {
|
||||
speed,
|
||||
fill: false,
|
||||
nudge_secs: 0.0,
|
||||
cc_memory: None,
|
||||
};
|
||||
|
||||
match self.script_engine.evaluate(&script, &ctx) {
|
||||
@@ -442,6 +455,7 @@ impl App {
|
||||
speed,
|
||||
fill: false,
|
||||
nudge_secs: 0.0,
|
||||
cc_memory: None,
|
||||
};
|
||||
|
||||
if let Ok(cmds) = self.script_engine.evaluate(&script, &ctx) {
|
||||
|
||||
Reference in New Issue
Block a user