From 25070464f9b9247784c070785e476eb389272745 Mon Sep 17 00:00:00 2001 From: Tom Gowan Date: Wed, 7 Nov 2018 12:57:22 +1100 Subject: [PATCH] git ignore, temp files, fetch_add, os cfg --- .gitignore | 9 +-------- asio-sys/.gitignore | 4 ++++ asio-sys/examples/.test.rs.swp | Bin 12288 -> 0 bytes src/os/mod.rs | 1 + src/platform/windows/asio/stream.rs | 20 ++++---------------- 5 files changed, 10 insertions(+), 24 deletions(-) create mode 100644 asio-sys/.gitignore delete mode 100644 asio-sys/examples/.test.rs.swp 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 d041a32118a297802fd2a215b14b539b97514601..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&u-H|5XQG~L<;|2U>c;#mfF~qOXaAoM2b`nh)Spwfgp07Nn>F<*6tFus&ef^ z@Br`{yaW#b55W~?9S8doA+FIk(r53^&dl!oj`p61ub;o5yrI1oOLCH, 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,