Merge pull request #35 from tomaka/rustup

Update for change in rustc and winapi
This commit is contained in:
tomaka 2015-03-30 11:42:26 +02:00
commit b5eba32ee5
4 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,7 @@
[package] [package]
name = "cpal" name = "cpal"
version = "0.0.17" version = "0.0.18"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"] authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform audio playing library in pure Rust." description = "Cross-platform audio playing library in pure Rust."
repository = "https://github.com/tomaka/cpal" repository = "https://github.com/tomaka/cpal"
@ -19,10 +19,10 @@ version = "0"
version = "0" version = "0"
[target.i686-pc-windows-gnu.dependencies.ole32-sys] [target.i686-pc-windows-gnu.dependencies.ole32-sys]
version = "0" version = "0.1"
[target.x86_64-pc-windows-gnu.dependencies.ole32-sys] [target.x86_64-pc-windows-gnu.dependencies.ole32-sys]
version = "0" version = "0.1"
[target.i686-unknown-linux-gnu.dependencies.alsa-sys] [target.i686-unknown-linux-gnu.dependencies.alsa-sys]
version = "0" version = "0"

View File

@ -87,7 +87,7 @@ impl Drop for Voice {
impl<'a, T> Buffer<'a, T> { impl<'a, T> Buffer<'a, T> {
pub fn get_buffer<'b>(&'b mut self) -> &'b mut [T] { pub fn get_buffer<'b>(&'b mut self) -> &'b mut [T] {
self.buffer.as_mut_slice() &mut self.buffer
} }
pub fn finish(self) { pub fn finish(self) {

View File

@ -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)] #![feature(box_syntax, core, unsafe_destructor, thread_sleep, std_misc)]
#![unstable]
pub use samples_formats::{SampleFormat, Sample}; 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 /// You should destroy this object as soon as possible. Data is only committed when it
/// is destroyed. /// is destroyed.
#[must_use] #[must_use]
pub struct Buffer<'a, T: 'a> { pub struct Buffer<'a, T: 'a> where T: Sample {
// also contains something, taken by `Drop` // also contains something, taken by `Drop`
target: Option<cpal_impl::Buffer<'a, T>>, target: Option<cpal_impl::Buffer<'a, T>>,
@ -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]; type Target = [T];
fn deref(&self) -> &[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] { fn deref_mut(&mut self) -> &mut [T] {
if let Some(ref mut conversion) = self.conversion { if let Some(ref mut conversion) = self.conversion {
conversion.intermediate_buffer.as_mut_slice() &mut conversion.intermediate_buffer
} else { } else {
self.target.as_mut().unwrap().get_buffer() self.target.as_mut().unwrap().get_buffer()
} }

View File

@ -1,6 +1,6 @@
extern crate libc; extern crate libc;
extern crate winapi; extern crate winapi;
extern crate ole32_sys as ole32; extern crate ole32;
use std::{slice, mem, ptr}; use std::{slice, mem, ptr};
use std::marker::PhantomData; use std::marker::PhantomData;