From bfb4772536385ad2858fecfe664fd7361e9bb382 Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Thu, 9 Mar 2023 14:12:28 +1100 Subject: [PATCH] new_unfilled -> new --- gb-emu/src/main.rs | 2 +- gb-vst/src/lib.rs | 4 ++-- lib/src/connect/mod.rs | 24 ------------------------ 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/gb-emu/src/main.rs b/gb-emu/src/main.rs index c719f86..14d75c7 100644 --- a/gb-emu/src/main.rs +++ b/gb-emu/src/main.rs @@ -136,7 +136,7 @@ fn create_audio_output() -> (AudioOutput, Stream) { let sample_rate = config.sample_rate().0; let (output, mut rx) = - AudioOutput::new_unfilled(sample_rate as f32, true, FRAMES_TO_BUFFER, DOWNSAMPLE_TYPE); + AudioOutput::new(sample_rate as f32, true, FRAMES_TO_BUFFER, DOWNSAMPLE_TYPE); let stream = device .build_output_stream( diff --git a/gb-vst/src/lib.rs b/gb-vst/src/lib.rs index 8be019a..4272a0f 100644 --- a/gb-vst/src/lib.rs +++ b/gb-vst/src/lib.rs @@ -129,7 +129,7 @@ impl Plugin for GameboyEmu { }; if let Some(ref mut vars) = self.vars { - let (output, rx) = AudioOutput::new_unfilled( + let (output, rx) = AudioOutput::new( buffer_config.sample_rate, false, FRAMES_TO_BUFFER, @@ -141,7 +141,7 @@ impl Plugin for GameboyEmu { } else { let (sender, receiver) = channel::(); - let (output, rx) = AudioOutput::new_unfilled( + let (output, rx) = AudioOutput::new( buffer_config.sample_rate, false, FRAMES_TO_BUFFER, diff --git a/lib/src/connect/mod.rs b/lib/src/connect/mod.rs index fa95a95..b8fcc2e 100644 --- a/lib/src/connect/mod.rs +++ b/lib/src/connect/mod.rs @@ -2,7 +2,6 @@ use crate::processor::memory::mmio::gpu::Colour; pub use crate::processor::memory::mmio::joypad::{JoypadButtons, JoypadState}; pub use crate::{HEIGHT, WIDTH}; use async_ringbuf::{AsyncHeapConsumer, AsyncHeapProducer, AsyncHeapRb}; -use futures::executor; pub enum EmulatorMessage { Stop, @@ -58,29 +57,6 @@ impl AudioOutput { wait_for_output: bool, frames_to_buffer: usize, downsample_type: DownsampleType, - ) -> (Self, AsyncHeapConsumer<[f32; 2]>) { - let (mut output, rx) = Self::new_unfilled( - sample_rate, - wait_for_output, - frames_to_buffer, - downsample_type, - ); - - executor::block_on( - output - .send_rb - .push_iter(vec![[0.; 2]; output.send_rb.free_len() - 1].into_iter()), - ) - .unwrap(); - - (output, rx) - } - - pub fn new_unfilled( - sample_rate: f32, - wait_for_output: bool, - frames_to_buffer: usize, - downsample_type: DownsampleType, ) -> (Self, AsyncHeapConsumer<[f32; 2]>) { let rb_len = (sample_rate as usize / 60) * frames_to_buffer;