Skip to content

Commit

Permalink
ASIO audio mixing fixes (#832)
Browse files Browse the repository at this point in the history
* Fixed ASIO output mixing

Fixed clippy errors

* Fixed buffer silence bug

* Removed byteorder dependency

* Removed SizedSample bound
  • Loading branch information
jesnor authored Feb 21, 2024
1 parent b87ec4b commit adaa49d
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 99 deletions.
12 changes: 7 additions & 5 deletions src/host/asio/device.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std;
pub type SupportedInputConfigs = std::vec::IntoIter<SupportedStreamConfigRange>;
pub type SupportedOutputConfigs = std::vec::IntoIter<SupportedStreamConfigRange>;

Expand All @@ -15,6 +14,7 @@ use crate::SupportedStreamConfig;
use crate::SupportedStreamConfigRange;
use crate::SupportedStreamConfigsError;
use std::hash::{Hash, Hasher};
use std::sync::atomic::AtomicI32;
use std::sync::Arc;

/// A ASIO Device
Expand All @@ -27,6 +27,7 @@ pub struct Device {
// A driver can only have one of each.
// They need to be created at the same time.
pub asio_streams: Arc<Mutex<sys::AsioStreams>>,
pub current_buffer_index: Arc<AtomicI32>,
}

/// All available devices.
Expand Down Expand Up @@ -83,8 +84,8 @@ impl Device {
channels,
min_sample_rate: rate,
max_sample_rate: rate,
buffer_size: f.buffer_size.clone(),
sample_format: f.sample_format.clone(),
buffer_size: f.buffer_size,
sample_format: f.sample_format,
})
}
}
Expand Down Expand Up @@ -120,8 +121,8 @@ impl Device {
channels,
min_sample_rate: rate,
max_sample_rate: rate,
buffer_size: f.buffer_size.clone(),
sample_format: f.sample_format.clone(),
buffer_size: f.buffer_size,
sample_format: f.sample_format,
})
}
}
Expand Down Expand Up @@ -194,6 +195,7 @@ impl Iterator for Devices {
return Some(Device {
driver,
asio_streams,
current_buffer_index: Arc::new(AtomicI32::new(-1)),
});
}
Err(_) => continue,
Expand Down
Loading

0 comments on commit adaa49d

Please sign in to comment.