smaller audio buffer + fill with zeroes before starting

This commit is contained in:
Alex Janka 2023-02-19 19:54:22 +11:00
parent 052bf829a5
commit 4496316f07

View file

@ -106,10 +106,12 @@ const CYCLES_PER_FRAME: usize = 70224;
impl Apu {
pub fn init(&mut self) {
let sample_rate = self.config.sample_rate.0;
let rb_len = sample_rate as usize;
let rb_len = sample_rate as usize / 60;
let rb = AsyncHeapRb::<f32>::new(rb_len);
let (tx, mut rx) = rb.split();
let (mut tx, mut rx) = rb.split();
executor::block_on(tx.push_iter(vec![0.; rb_len - 1].into_iter())).unwrap();
self.send_rb = Some(tx);