From 93073f1ff7c9fad5569ea7b30402e14713514958 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Mon, 30 Mar 2015 11:06:46 +0200 Subject: [PATCH] Update for change in rustc and winapi --- Cargo.toml | 6 +++--- src/alsa/mod.rs | 2 +- src/lib.rs | 9 ++++----- src/wasapi/mod.rs | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c8b052b..c30f06a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "cpal" -version = "0.0.17" +version = "0.0.18" authors = ["Pierre Krieger "] description = "Cross-platform audio playing library in pure Rust." repository = "https://github.com/tomaka/cpal" @@ -19,10 +19,10 @@ version = "0" version = "0" [target.i686-pc-windows-gnu.dependencies.ole32-sys] -version = "0" +version = "0.1" [target.x86_64-pc-windows-gnu.dependencies.ole32-sys] -version = "0" +version = "0.1" [target.i686-unknown-linux-gnu.dependencies.alsa-sys] version = "0" diff --git a/src/alsa/mod.rs b/src/alsa/mod.rs index 9c40dc5..53d5d0d 100644 --- a/src/alsa/mod.rs +++ b/src/alsa/mod.rs @@ -87,7 +87,7 @@ impl Drop for Voice { impl<'a, T> Buffer<'a, T> { pub fn get_buffer<'b>(&'b mut self) -> &'b mut [T] { - self.buffer.as_mut_slice() + &mut self.buffer } pub fn finish(self) { diff --git a/src/lib.rs b/src/lib.rs index c598016..b53e742 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -48,7 +48,6 @@ If you have the possibility, you should try to match the format of the voice. */ #![feature(box_syntax, core, unsafe_destructor, thread_sleep, std_misc)] -#![unstable] pub use samples_formats::{SampleFormat, Sample}; @@ -99,7 +98,7 @@ pub struct SamplesRate(pub u32); /// You should destroy this object as soon as possible. Data is only committed when it /// is destroyed. #[must_use] -pub struct Buffer<'a, T: 'a> { +pub struct Buffer<'a, T: 'a> where T: Sample { // also contains something, taken by `Drop` target: Option>, @@ -244,7 +243,7 @@ impl Voice { } } -impl<'a, T> Deref for Buffer<'a, T> { +impl<'a, T> Deref for Buffer<'a, T> where T: Sample { type Target = [T]; fn deref(&self) -> &[T] { @@ -252,10 +251,10 @@ impl<'a, T> Deref for Buffer<'a, T> { } } -impl<'a, T> DerefMut for Buffer<'a, T> { +impl<'a, T> DerefMut for Buffer<'a, T> where T: Sample { fn deref_mut(&mut self) -> &mut [T] { if let Some(ref mut conversion) = self.conversion { - conversion.intermediate_buffer.as_mut_slice() + &mut conversion.intermediate_buffer } else { self.target.as_mut().unwrap().get_buffer() } diff --git a/src/wasapi/mod.rs b/src/wasapi/mod.rs index bb43d65..e96c401 100644 --- a/src/wasapi/mod.rs +++ b/src/wasapi/mod.rs @@ -1,6 +1,6 @@ extern crate libc; extern crate winapi; -extern crate ole32_sys as ole32; +extern crate ole32; use std::{slice, mem, ptr}; use std::marker::PhantomData;