Skip to content

Commit

Permalink
Merge pull request #103 from yutannihilation/remove-adjusted_ichannels
Browse files Browse the repository at this point in the history
Remove unused `adjusted_ichannels`
  • Loading branch information
tomoyanonymous authored Dec 5, 2024
2 parents a50f5c4 + 2833b86 commit de63505
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions mimium-audiodriver/src/backends/cpal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,15 @@ impl NativeAudioData {
}
struct NativeAudioReceiver {
dsp_ichannels: usize,
adjusted_ichannels: usize,
localbuffer: Vec<f64>,
buffer: HeapProd<f64>,
count: u64,
}
unsafe impl Send for NativeAudioReceiver {}
impl NativeAudioReceiver {
pub fn new(dsp_ichannels: usize, adjusted_ichannels: usize, buffer: HeapProd<f64>) -> Self {
pub fn new(dsp_ichannels: usize, buffer: HeapProd<f64>) -> Self {
Self {
dsp_ichannels,
adjusted_ichannels,
localbuffer: vec![0f64; 4096 * dsp_ichannels],
buffer,
count: 0,
Expand Down Expand Up @@ -219,9 +217,7 @@ impl Driver for NativeDriver {
fn init(&mut self, ctx: ExecContext, sample_rate: Option<SampleRate>) -> bool {
let host = cpal::default_host();
let dsp_ichannels = 1; //todo
let adjusted_ichannels = 1; //todo: calculate similarly to adjusted_ochannels
let (prod, cons) =
HeapRb::<Self::Sample>::new(adjusted_ichannels * self.buffer_size).split();
let (prod, cons) = HeapRb::<Self::Sample>::new(dsp_ichannels * self.buffer_size).split();

let idevice = host.default_input_device();
let in_stream = if let Some(idevice) = idevice {
Expand All @@ -232,7 +228,7 @@ impl Driver for NativeDriver {
idevice.name().unwrap_or_default(),
iconfig.buffer_size
);
let mut receiver = NativeAudioReceiver::new(dsp_ichannels, adjusted_ichannels, prod);
let mut receiver = NativeAudioReceiver::new(dsp_ichannels, prod);
self.hardware_ichannels = iconfig.channels as usize;
let h_ichannels = self.hardware_ichannels;
let in_stream = idevice.build_input_stream(
Expand Down

0 comments on commit de63505

Please sign in to comment.