Feat: documentation, UI/UX
This commit is contained in:
@@ -61,9 +61,6 @@ impl App {
|
||||
.set_completion_enabled(self.ui.show_completion);
|
||||
let tree = SampleTree::from_paths(&self.audio.config.sample_paths);
|
||||
self.editor_ctx.editor.set_sample_folders(tree.all_folder_names());
|
||||
if self.editor_ctx.show_stack {
|
||||
crate::services::stack_preview::update_cache(&self.editor_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,20 +126,33 @@ impl App {
|
||||
}
|
||||
|
||||
/// Evaluate a script and immediately send its audio commands.
|
||||
/// Returns collected `print` output, if any.
|
||||
pub fn execute_script_oneshot(
|
||||
&self,
|
||||
script: &str,
|
||||
link: &LinkState,
|
||||
audio_tx: &arc_swap::ArcSwap<Sender<crate::engine::AudioCommand>>,
|
||||
) -> Result<(), String> {
|
||||
) -> Result<Option<String>, String> {
|
||||
let ctx = self.create_step_context(self.editor_ctx.step, link);
|
||||
let cmds = self.script_engine.evaluate(script, &ctx)?;
|
||||
let mut print_output = String::new();
|
||||
for cmd in cmds {
|
||||
if let Some(text) = cmd.strip_prefix("print:") {
|
||||
if !print_output.is_empty() {
|
||||
print_output.push(' ');
|
||||
}
|
||||
print_output.push_str(text);
|
||||
continue;
|
||||
}
|
||||
let _ = audio_tx
|
||||
.load()
|
||||
.send(crate::engine::AudioCommand::Evaluate { cmd, time: None });
|
||||
}
|
||||
Ok(())
|
||||
Ok(if print_output.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(print_output)
|
||||
})
|
||||
}
|
||||
|
||||
/// Compile (evaluate) the current step's script to check for errors.
|
||||
|
||||
Reference in New Issue
Block a user