diff --git a/.gitignore b/.gitignore index 555191e..6d067b3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,11 +2,4 @@ /Cargo.lock .cargo/ .DS_Store -recorded.wav -asio-sys/target -asio-sys/Cargo.lock -asio-sys/.cargo/ -asio-sys/.DS_Store -*~ -*.swap -*.swo +recorded.wav \ No newline at end of file diff --git a/asio-sys/.gitignore b/asio-sys/.gitignore new file mode 100644 index 0000000..3375044 --- /dev/null +++ b/asio-sys/.gitignore @@ -0,0 +1,4 @@ +/target +/Cargo.lock +.cargo/ +.DS_Store \ No newline at end of file diff --git a/asio-sys/examples/.test.rs.swp b/asio-sys/examples/.test.rs.swp deleted file mode 100644 index d041a32..0000000 Binary files a/asio-sys/examples/.test.rs.swp and /dev/null differ diff --git a/src/os/mod.rs b/src/os/mod.rs index 0d034fd..581af77 100644 --- a/src/os/mod.rs +++ b/src/os/mod.rs @@ -1 +1,2 @@ +#[cfg(target_os = "windows")] pub mod windows; diff --git a/src/platform/windows/asio/stream.rs b/src/platform/windows/asio/stream.rs index 16686db..b439bf5 100644 --- a/src/platform/windows/asio/stream.rs +++ b/src/platform/windows/asio/stream.rs @@ -55,16 +55,7 @@ struct I16Buffer { cpal: Vec, channel: Vec>, } -// 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, - channel: Vec>, -} -*/ + #[derive(Default)] struct F32Buffer { cpal: Vec, @@ -203,8 +194,7 @@ impl EventLoop { self.get_input_stream(&drivers, format) .map(|stream_buffer_size| { let cpal_num_samples = stream_buffer_size * num_channels as usize; - let count = self.stream_count.load(Ordering::SeqCst); - self.stream_count.store(count + 1, Ordering::SeqCst); + let count = self.stream_count.fetch_add(1, Ordering::SeqCst); let asio_streams = self.asio_streams.clone(); let cpal_streams = self.cpal_streams.clone(); let callbacks = self.callbacks.clone(); @@ -496,8 +486,7 @@ impl EventLoop { self.get_output_stream(&drivers, format) .map(|stream_buffer_size| { let cpal_num_samples = stream_buffer_size * num_channels as usize; - let count = self.stream_count.load(Ordering::SeqCst); - self.stream_count.store(count + 1, Ordering::SeqCst); + let count = self.stream_count.fetch_add(1, Ordering::SeqCst); let asio_streams = self.asio_streams.clone(); let cpal_streams = self.cpal_streams.clone(); let callbacks = self.callbacks.clone(); @@ -836,8 +825,7 @@ impl EventLoop { pub fn destroy_stream(&self, stream_id: StreamId) { let mut streams = self.cpal_streams.lock().unwrap(); streams.get_mut(stream_id.0).take(); - let count = self.stream_count.load(Ordering::SeqCst); - self.stream_count.store(count - 1, Ordering::SeqCst); + let count = self.stream_count.fetch_sub(1, Ordering::SeqCst); if count == 1 { *self.asio_streams.lock().unwrap() = sys::AsioStreams { output: None,