From 284f12f1cb228f4e2ca529954bf1b93943a8b2af Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 20 Jan 2015 16:45:47 +0100 Subject: [PATCH] Update for winapi --- Cargo.toml | 10 +++++++--- src/wasapi/mod.rs | 7 ++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 686c780..b0f8554 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cpal" -version = "0.0.9-pre" +version = "0.0.10-pre" authors = ["Pierre Krieger "] description = "Cross-platform audio playing library in pure Rust." repository = "https://github.com/tomaka/cpal" @@ -11,11 +11,15 @@ keywords = ["audio", "sound"] [target.i686-pc-windows-gnu.dependencies.winapi] version = "0" -features = ["ole32"] [target.x86_64-pc-windows-gnu.dependencies.winapi] version = "0" -features = ["ole32"] + +[target.i686-pc-windows-gnu.dependencies.ole32-sys] +version = "0" + +[target.x86_64-pc-windows-gnu.dependencies.ole32-sys] +version = "0" [target.i686-unknown-linux-gnu.dependencies.alsa-sys] version = "0" diff --git a/src/wasapi/mod.rs b/src/wasapi/mod.rs index df2253e..7efe374 100644 --- a/src/wasapi/mod.rs +++ b/src/wasapi/mod.rs @@ -1,5 +1,6 @@ extern crate libc; extern crate winapi; +extern crate "ole32-sys" as ole32; use std::{slice, mem, ptr}; @@ -156,13 +157,13 @@ impl<'a, T> Buffer<'a, T> { fn init() -> Result { // FIXME: release everything unsafe { - try!(check_result(winapi::CoInitializeEx(::std::ptr::null_mut(), 0))); + try!(check_result(ole32::CoInitializeEx(::std::ptr::null_mut(), 0))); // building the devices enumerator object let enumerator = { let mut enumerator: *mut winapi::IMMDeviceEnumerator = ::std::mem::uninitialized(); - let hresult = winapi::CoCreateInstance(&winapi::CLSID_MMDeviceEnumerator, + let hresult = ole32::CoCreateInstance(&winapi::CLSID_MMDeviceEnumerator, ptr::null_mut(), winapi::CLSCTX_ALL, &winapi::IID_IMMDeviceEnumerator, mem::transmute(&mut enumerator)); @@ -221,7 +222,7 @@ fn init() -> Result { 0, 10000000, 0, format, ptr::null()); if !format_ptr.is_null() { - winapi::CoTaskMemFree(format_ptr as *mut libc::c_void); + ole32::CoTaskMemFree(format_ptr as *mut libc::c_void); } try!(check_result(hresult));