git ignore, temp files, fetch_add, os cfg

This commit is contained in:
Tom Gowan 2018-11-07 12:57:22 +11:00 committed by mitchmindtree
parent 523d25ad49
commit 25070464f9
5 changed files with 10 additions and 24 deletions

9
.gitignore vendored
View File

@ -2,11 +2,4 @@
/Cargo.lock /Cargo.lock
.cargo/ .cargo/
.DS_Store .DS_Store
recorded.wav recorded.wav
asio-sys/target
asio-sys/Cargo.lock
asio-sys/.cargo/
asio-sys/.DS_Store
*~
*.swap
*.swo

4
asio-sys/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/target
/Cargo.lock
.cargo/
.DS_Store

Binary file not shown.

View File

@ -1 +1,2 @@
#[cfg(target_os = "windows")]
pub mod windows; pub mod windows;

View File

@ -55,16 +55,7 @@ struct I16Buffer {
cpal: Vec<i16>, cpal: Vec<i16>,
channel: Vec<Vec<i16>>, channel: Vec<Vec<i16>>,
} }
// TODO This never gets used as there is
// no usigned variants of ASIO buffers
// and can probably be removed.
/*
#[derive(Default)]
struct U16Buffer {
cpal: Vec<u16>,
channel: Vec<Vec<u16>>,
}
*/
#[derive(Default)] #[derive(Default)]
struct F32Buffer { struct F32Buffer {
cpal: Vec<f32>, cpal: Vec<f32>,
@ -203,8 +194,7 @@ impl EventLoop {
self.get_input_stream(&drivers, format) self.get_input_stream(&drivers, format)
.map(|stream_buffer_size| { .map(|stream_buffer_size| {
let cpal_num_samples = stream_buffer_size * num_channels as usize; let cpal_num_samples = stream_buffer_size * num_channels as usize;
let count = self.stream_count.load(Ordering::SeqCst); let count = self.stream_count.fetch_add(1, Ordering::SeqCst);
self.stream_count.store(count + 1, Ordering::SeqCst);
let asio_streams = self.asio_streams.clone(); let asio_streams = self.asio_streams.clone();
let cpal_streams = self.cpal_streams.clone(); let cpal_streams = self.cpal_streams.clone();
let callbacks = self.callbacks.clone(); let callbacks = self.callbacks.clone();
@ -496,8 +486,7 @@ impl EventLoop {
self.get_output_stream(&drivers, format) self.get_output_stream(&drivers, format)
.map(|stream_buffer_size| { .map(|stream_buffer_size| {
let cpal_num_samples = stream_buffer_size * num_channels as usize; let cpal_num_samples = stream_buffer_size * num_channels as usize;
let count = self.stream_count.load(Ordering::SeqCst); let count = self.stream_count.fetch_add(1, Ordering::SeqCst);
self.stream_count.store(count + 1, Ordering::SeqCst);
let asio_streams = self.asio_streams.clone(); let asio_streams = self.asio_streams.clone();
let cpal_streams = self.cpal_streams.clone(); let cpal_streams = self.cpal_streams.clone();
let callbacks = self.callbacks.clone(); let callbacks = self.callbacks.clone();
@ -836,8 +825,7 @@ impl EventLoop {
pub fn destroy_stream(&self, stream_id: StreamId) { pub fn destroy_stream(&self, stream_id: StreamId) {
let mut streams = self.cpal_streams.lock().unwrap(); let mut streams = self.cpal_streams.lock().unwrap();
streams.get_mut(stream_id.0).take(); streams.get_mut(stream_id.0).take();
let count = self.stream_count.load(Ordering::SeqCst); let count = self.stream_count.fetch_sub(1, Ordering::SeqCst);
self.stream_count.store(count - 1, Ordering::SeqCst);
if count == 1 { if count == 1 {
*self.asio_streams.lock().unwrap() = sys::AsioStreams { *self.asio_streams.lock().unwrap() = sys::AsioStreams {
output: None, output: None,