This commit is contained in:
@@ -1180,11 +1180,11 @@ impl Forth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Op::Loop => {
|
Op::Loop => {
|
||||||
let beats = pop_float(stack)?;
|
let steps = pop_float(stack)?;
|
||||||
if ctx.tempo == 0.0 || ctx.speed == 0.0 {
|
if ctx.tempo == 0.0 || ctx.speed == 0.0 {
|
||||||
return Err("tempo and speed must be non-zero".into());
|
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("fit", Value::Float(dur, None));
|
||||||
cmd.set_param("dur", Value::Float(dur, None));
|
cmd.set_param("dur", Value::Float(dur, None));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,8 +280,8 @@ pub(super) const WORDS: &[Word] = &[
|
|||||||
aliases: &[],
|
aliases: &[],
|
||||||
category: "Time",
|
category: "Time",
|
||||||
stack: "(n --)",
|
stack: "(n --)",
|
||||||
desc: "Fit sample to n beats",
|
desc: "Fit sample to n steps",
|
||||||
example: "\"break\" s 4 loop @",
|
example: "\"break\" s 16 loop @",
|
||||||
compile: Simple,
|
compile: Simple,
|
||||||
varargs: false,
|
varargs: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -251,9 +251,13 @@ impl CagireDesktop {
|
|||||||
let mut restart_samples = Vec::new();
|
let mut restart_samples = Vec::new();
|
||||||
self.app.audio.config.sample_counts.clear();
|
self.app.audio.config.sample_counts.clear();
|
||||||
for path in &self.app.audio.config.sample_paths {
|
for path in &self.app.audio.config.sample_paths {
|
||||||
|
if path.is_dir() {
|
||||||
let index = doux::sampling::scan_samples_dir(path);
|
let index = doux::sampling::scan_samples_dir(path);
|
||||||
self.app.audio.config.sample_counts.push(index.len());
|
self.app.audio.config.sample_counts.push(index.len());
|
||||||
restart_samples.extend(index);
|
restart_samples.extend(index);
|
||||||
|
} else {
|
||||||
|
self.app.audio.config.sample_counts.push(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.audio_sample_pos.store(0, Ordering::Release);
|
self.audio_sample_pos.store(0, Ordering::Release);
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ pub fn build_stream(
|
|||||||
let sample_rate = default_config.sample_rate() as f32;
|
let sample_rate = default_config.sample_rate() as f32;
|
||||||
|
|
||||||
let max_channels = doux::audio::max_output_channels(&device);
|
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 host_name = doux::audio::preferred_host().id().name().to_string();
|
||||||
let is_jack = host_name.to_lowercase().contains("jack");
|
let is_jack = host_name.to_lowercase().contains("jack");
|
||||||
|
|||||||
@@ -158,9 +158,14 @@ pub fn init(args: InitArgs) -> Init {
|
|||||||
let sample_rate_shared = Arc::new(AtomicU32::new(44100));
|
let sample_rate_shared = Arc::new(AtomicU32::new(44100));
|
||||||
let mut initial_samples = Vec::new();
|
let mut initial_samples = Vec::new();
|
||||||
for path in &app.audio.config.sample_paths {
|
for path in &app.audio.config.sample_paths {
|
||||||
|
if path.is_dir() {
|
||||||
let index = doux::sampling::scan_samples_dir(path);
|
let index = doux::sampling::scan_samples_dir(path);
|
||||||
app.audio.config.sample_counts.push(index.len());
|
app.audio.config.sample_counts.push(index.len());
|
||||||
initial_samples.extend(index);
|
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
|
let preload_entries: Vec<(String, std::path::PathBuf)> = initial_samples
|
||||||
.iter()
|
.iter()
|
||||||
|
|||||||
@@ -141,9 +141,13 @@ fn main() -> io::Result<()> {
|
|||||||
let mut restart_samples = Vec::new();
|
let mut restart_samples = Vec::new();
|
||||||
app.audio.config.sample_counts.clear();
|
app.audio.config.sample_counts.clear();
|
||||||
for path in &app.audio.config.sample_paths {
|
for path in &app.audio.config.sample_paths {
|
||||||
|
if path.is_dir() {
|
||||||
let index = doux::sampling::scan_samples_dir(path);
|
let index = doux::sampling::scan_samples_dir(path);
|
||||||
app.audio.config.sample_counts.push(index.len());
|
app.audio.config.sample_counts.push(index.len());
|
||||||
restart_samples.extend(index);
|
restart_samples.extend(index);
|
||||||
|
} else {
|
||||||
|
app.audio.config.sample_counts.push(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
audio_sample_pos.store(0, Ordering::Relaxed);
|
audio_sample_pos.store(0, Ordering::Relaxed);
|
||||||
|
|||||||
Reference in New Issue
Block a user