Feat: crash bugfixes
All checks were successful
Deploy Website / deploy (push) Has been skipped

This commit is contained in:
2026-03-03 13:10:22 +01:00
parent cf1d2be140
commit 16d6d76422
6 changed files with 27 additions and 14 deletions

View File

@@ -1180,11 +1180,11 @@ impl Forth {
}
Op::Loop => {
let beats = pop_float(stack)?;
let steps = pop_float(stack)?;
if ctx.tempo == 0.0 || ctx.speed == 0.0 {
return Err("tempo and speed must be non-zero".into());
}
let dur = beats * 60.0 / ctx.tempo / ctx.speed;
let dur = steps * ctx.step_duration();
cmd.set_param("fit", Value::Float(dur, None));
cmd.set_param("dur", Value::Float(dur, None));
}

View File

@@ -280,8 +280,8 @@ pub(super) const WORDS: &[Word] = &[
aliases: &[],
category: "Time",
stack: "(n --)",
desc: "Fit sample to n beats",
example: "\"break\" s 4 loop @",
desc: "Fit sample to n steps",
example: "\"break\" s 16 loop @",
compile: Simple,
varargs: false,
},

View File

@@ -251,9 +251,13 @@ impl CagireDesktop {
let mut restart_samples = Vec::new();
self.app.audio.config.sample_counts.clear();
for path in &self.app.audio.config.sample_paths {
let index = doux::sampling::scan_samples_dir(path);
self.app.audio.config.sample_counts.push(index.len());
restart_samples.extend(index);
if path.is_dir() {
let index = doux::sampling::scan_samples_dir(path);
self.app.audio.config.sample_counts.push(index.len());
restart_samples.extend(index);
} else {
self.app.audio.config.sample_counts.push(0);
}
}
self.audio_sample_pos.store(0, Ordering::Release);

View File

@@ -320,7 +320,7 @@ pub fn build_stream(
let sample_rate = default_config.sample_rate() as f32;
let max_channels = doux::audio::max_output_channels(&device);
let channels = config.channels.min(max_channels);
let channels = config.channels.min(max_channels).max(2);
let host_name = doux::audio::preferred_host().id().name().to_string();
let is_jack = host_name.to_lowercase().contains("jack");

View File

@@ -158,9 +158,14 @@ pub fn init(args: InitArgs) -> Init {
let sample_rate_shared = Arc::new(AtomicU32::new(44100));
let mut initial_samples = Vec::new();
for path in &app.audio.config.sample_paths {
let index = doux::sampling::scan_samples_dir(path);
app.audio.config.sample_counts.push(index.len());
initial_samples.extend(index);
if path.is_dir() {
let index = doux::sampling::scan_samples_dir(path);
app.audio.config.sample_counts.push(index.len());
initial_samples.extend(index);
} else {
eprintln!("Sample path not found: {}", path.display());
app.audio.config.sample_counts.push(0);
}
}
let preload_entries: Vec<(String, std::path::PathBuf)> = initial_samples
.iter()

View File

@@ -141,9 +141,13 @@ fn main() -> io::Result<()> {
let mut restart_samples = Vec::new();
app.audio.config.sample_counts.clear();
for path in &app.audio.config.sample_paths {
let index = doux::sampling::scan_samples_dir(path);
app.audio.config.sample_counts.push(index.len());
restart_samples.extend(index);
if path.is_dir() {
let index = doux::sampling::scan_samples_dir(path);
app.audio.config.sample_counts.push(index.len());
restart_samples.extend(index);
} else {
app.audio.config.sample_counts.push(0);
}
}
audio_sample_pos.store(0, Ordering::Relaxed);