From f22a74b036e7c09628a366c80b86274684e2a36c Mon Sep 17 00:00:00 2001 From: Simon Gellis Date: Mon, 11 Nov 2024 18:46:25 -0500 Subject: [PATCH] Sleep instead of just spin-looping --- src/audio.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/audio.rs b/src/audio.rs index 2486830..2d97949 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use anyhow::{bail, Result}; use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; use itertools::Itertools; @@ -95,7 +97,7 @@ impl Audio { } while self.sample_sink.slots() < self.sampler.output_frames_max() * 2 { - std::hint::spin_loop(); + std::thread::sleep(Duration::from_micros(500)); } } }