Feat: really good lookahead mechanism for scheduling
This commit is contained in:
@@ -305,6 +305,8 @@ pub fn build_stream(
|
||||
let buffer_samples = data.len() / channels;
|
||||
let buffer_time_ns = (buffer_samples as f64 / sr as f64 * 1e9) as u64;
|
||||
|
||||
audio_sample_pos.fetch_add(buffer_samples as u64, Ordering::Release);
|
||||
|
||||
while let Ok(cmd) = audio_rx.try_recv() {
|
||||
match cmd {
|
||||
AudioCommand::Evaluate { cmd, time } => {
|
||||
@@ -335,8 +337,6 @@ pub fn build_stream(
|
||||
engine.process_block(data, &[], &[]);
|
||||
scope_buffer.write(&engine.output);
|
||||
|
||||
audio_sample_pos.fetch_add(buffer_samples as u64, Ordering::Relaxed);
|
||||
|
||||
// Feed mono mix to analysis thread via ring buffer (non-blocking)
|
||||
for chunk in engine.output.chunks(channels) {
|
||||
let mono = chunk.iter().sum::<f32>() / channels as f32;
|
||||
|
||||
Reference in New Issue
Block a user