utils as mod

This commit is contained in:
Tom Gowan 2018-10-31 10:34:14 +11:00 committed by mitchmindtree
parent ed50bb9923
commit 91f2edb277
6 changed files with 7 additions and 10 deletions

View File

@ -17,7 +17,6 @@ hound = "3.4"
[target.'cfg(any(target_os = "windows" ))'.dependencies] [target.'cfg(any(target_os = "windows" ))'.dependencies]
asio-sys = { version = "0.1", path = "asio-sys" } asio-sys = { version = "0.1", path = "asio-sys" }
asio_utils = { version = "0.1", path = "src/platform/windows/asio/asio_utils" }
[target.'cfg(target_os = "windows")'.dependencies] [target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3", features = ["audiosessiontypes", "audioclient", "coml2api", "combaseapi", "debug", "devpkey", "handleapi", "ksmedia", "mmdeviceapi", "objbase", "std", "synchapi", "winuser"] } winapi = { version = "0.3", features = ["audiosessiontypes", "audioclient", "coml2api", "combaseapi", "debug", "devpkey", "handleapi", "ksmedia", "mmdeviceapi", "objbase", "std", "synchapi", "winuser"] }

View File

@ -1,6 +0,0 @@
[package]
name = "asio_utils"
version = "0.1.0"
authors = ["Tom Gowan <s3549186@student.rmit.edu.au>"]
[dependencies]

View File

@ -1,6 +1,8 @@
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use std::marker::Copy;
/// Interleave the buffer from asio to cpal /// Interleave the buffer from asio to cpal
/// asio: LLLLRRRR /// asio: LLLLRRRR
/// cpal: LRLRLRLR /// cpal: LRLRLRLR
@ -11,7 +13,7 @@ mod tests;
/// this check is ommited for performance /// this check is ommited for performance
pub fn interleave<T>(channels: &[Vec<T>], target: &mut Vec<T>) pub fn interleave<T>(channels: &[Vec<T>], target: &mut Vec<T>)
where where
T: std::marker::Copy, T: Copy,
{ {
assert!(!channels.is_empty()); assert!(!channels.is_empty());
target.clear(); target.clear();
@ -28,7 +30,7 @@ where
/// asio: 111122223333 /// asio: 111122223333
pub fn deinterleave<T>(cpal_buffer: &[T], asio_channels: &mut [Vec<T>]) pub fn deinterleave<T>(cpal_buffer: &[T], asio_channels: &mut [Vec<T>])
where where
T: std::marker::Copy, T: Copy,
{ {
for ch in asio_channels.iter_mut() { for ch in asio_channels.iter_mut() {
ch.clear(); ch.clear();

View File

@ -6,3 +6,4 @@ pub use self::stream::{InputBuffer, OutputBuffer, EventLoop, StreamId};
mod device; mod device;
mod stream; mod stream;
mod asio_utils;

View File

@ -1,5 +1,5 @@
extern crate asio_sys as sys; extern crate asio_sys as sys;
extern crate asio_utils as au;
use std; use std;
use Format; use Format;
@ -12,6 +12,7 @@ use std::sync::{Arc, Mutex};
use std::mem; use std::mem;
use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::atomic::{AtomicUsize, Ordering};
use SampleFormat; use SampleFormat;
use super::asio_utils as au;
pub struct EventLoop { pub struct EventLoop {
asio_streams: Arc<Mutex<sys::AsioStreams>>, asio_streams: Arc<Mutex<sys::AsioStreams>>,