Rustup
This commit is contained in:
parent
1adfa820c6
commit
a6c1b14d66
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "cpal"
|
name = "cpal"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
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"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
|
|
||||||
name = "alsa-sys"
|
name = "alsa-sys"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
|
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
description = "Bindings for the ALSA project (Advanced Linux Sound Architecture)"
|
description = "Bindings for the ALSA project (Advanced Linux Sound Architecture)"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extern crate "pkg-config" as pkg_config;
|
extern crate pkg_config;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
pkg_config::find_library("alsa").unwrap();
|
pkg_config::find_library("alsa").unwrap();
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
let packet = packet.unwrap();
|
let packet = packet.unwrap();
|
||||||
let vorbis::Packet { channels, rate, data, .. } = packet;
|
let vorbis::Packet { channels, rate, data, .. } = packet;
|
||||||
|
|
||||||
let mut data = data.as_slice();
|
let mut data = &data[..];
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if data.len() == 0 {
|
if data.len() == 0 {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extern crate "alsa-sys" as alsa;
|
extern crate alsa_sys as alsa;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
use std::{ffi, iter, mem};
|
use std::{ffi, iter, mem};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
extern crate "coreaudio-rs" as coreaudio;
|
extern crate coreaudio_rs as coreaudio;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
use self::coreaudio::audio_unit::{AudioUnit, Type, SubType};
|
use self::coreaudio::audio_unit::{AudioUnit, Type, SubType};
|
||||||
|
|
12
src/lib.rs
12
src/lib.rs
|
@ -47,7 +47,7 @@ a conversion on your data.
|
||||||
If you have the possibility, you should try to match the format of the voice.
|
If you have the possibility, you should try to match the format of the voice.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#![feature(box_syntax, core, unsafe_destructor)]
|
#![feature(box_syntax, core, unsafe_destructor, thread_sleep, std_misc)]
|
||||||
#![unstable]
|
#![unstable]
|
||||||
|
|
||||||
pub use samples_formats::{SampleFormat, Sample};
|
pub use samples_formats::{SampleFormat, Sample};
|
||||||
|
@ -269,14 +269,14 @@ impl<'a, T> Drop for Buffer<'a, T> where T: Sample {
|
||||||
let buffer = conversion.intermediate_buffer;
|
let buffer = conversion.intermediate_buffer;
|
||||||
|
|
||||||
let buffer = if conversion.from_channels != conversion.to_channels {
|
let buffer = if conversion.from_channels != conversion.to_channels {
|
||||||
conversions::convert_channels(buffer.as_slice(), conversion.from_channels,
|
conversions::convert_channels(&buffer, conversion.from_channels,
|
||||||
conversion.to_channels)
|
conversion.to_channels)
|
||||||
} else {
|
} else {
|
||||||
buffer
|
buffer
|
||||||
};
|
};
|
||||||
|
|
||||||
let buffer = if conversion.from_sample_rate != conversion.to_sample_rate {
|
let buffer = if conversion.from_sample_rate != conversion.to_sample_rate {
|
||||||
conversions::convert_samples_rate(buffer.as_slice(), conversion.from_sample_rate,
|
conversions::convert_samples_rate(&buffer, conversion.from_sample_rate,
|
||||||
conversion.to_sample_rate,
|
conversion.to_sample_rate,
|
||||||
conversion.to_channels)
|
conversion.to_channels)
|
||||||
} else {
|
} else {
|
||||||
|
@ -309,15 +309,15 @@ impl<'a, T> Drop for Buffer<'a, T> where T: Sample {
|
||||||
|
|
||||||
match conversion.to_format {
|
match conversion.to_format {
|
||||||
SampleFormat::I16 => {
|
SampleFormat::I16 => {
|
||||||
let buffer = Sample::to_vec_i16(buffer.as_slice());
|
let buffer = Sample::to_vec_i16(&buffer);
|
||||||
write_to_buf!(buffer, output, i16);
|
write_to_buf!(buffer, output, i16);
|
||||||
},
|
},
|
||||||
SampleFormat::U16 => {
|
SampleFormat::U16 => {
|
||||||
let buffer = Sample::to_vec_u16(buffer.as_slice());
|
let buffer = Sample::to_vec_u16(&buffer);
|
||||||
write_to_buf!(buffer, output, u16);
|
write_to_buf!(buffer, output, u16);
|
||||||
},
|
},
|
||||||
SampleFormat::F32 => {
|
SampleFormat::F32 => {
|
||||||
let buffer = Sample::to_vec_f32(buffer.as_slice());
|
let buffer = Sample::to_vec_f32(&buffer);
|
||||||
write_to_buf!(buffer, output, f32);
|
write_to_buf!(buffer, output, f32);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ impl Sample for u16 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_vec_f32(input: &[u16]) -> Cow<[f32]> {
|
fn to_vec_f32(input: &[u16]) -> Cow<[f32]> {
|
||||||
Cow::Owned(Sample::to_vec_f32(Sample::to_vec_i16(input).as_slice()).to_vec())
|
Cow::Owned(Sample::to_vec_f32(&Sample::to_vec_i16(input)).to_vec())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_sys as ole32;
|
||||||
|
|
||||||
use std::{slice, mem, ptr};
|
use std::{slice, mem, ptr};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
Loading…
Reference in New Issue