Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
examples/ | H | 03-May-2022 | - | 219 | 181 | |
script/ | H | 03-May-2022 | - | 4 | 3 | |
src/ | H | 03-May-2022 | - | 1,183 | 827 | |
.cargo-checksum.json | H A D | 03-May-2022 | 89 | 1 | 1 | |
.cargo_vcs_info.json | H A D | 14-May-2020 | 74 | 6 | 5 | |
.gitignore | H A D | 11-Jun-2019 | 18 | 3 | 2 | |
.travis.yml | H A D | 11-Jun-2019 | 490 | 26 | 19 | |
Cargo.lock | H A D | 14-May-2020 | 1.6 KiB | 41 | 35 | |
Cargo.toml | H A D | 14-May-2020 | 830 | 30 | 25 | |
Cargo.toml.orig-cargo | H A D | 14-May-2020 | 288 | 15 | 12 | |
LICENSE | H A D | 11-Jun-2019 | 1.1 KiB | 21 | 16 | |
README.md | H A D | 11-Jun-2019 | 1.2 KiB | 53 | 39 |
README.md
1portaudio-rs 2============ 3 4[![Build Status](https://travis-ci.org/mvdnes/portaudio-rs.svg?branch=master)](https://travis-ci.org/mvdnes/portaudio-rs) 5 6[Documentation](https://mvdnes.github.io/rust-docs/portaudio-rs/portaudio_rs/index.html) 7 8PortAudio bindings for Rust 9 10See http://portaudio.com/ 11 12Example 13------- 14 15```rust 16extern crate portaudio_rs as portaudio; 17 18fn demo() -> portaudio::PaResult 19{ 20 let stream = try!(portaudio::stream::Stream::open_default( 21 0, // input channels 22 1, // output channels 23 44100.0, // sample rate 24 portaudio::stream::FRAMES_PER_BUFFER_UNSPECIFIED, 25 None // no callback 26 )); 27 28 try!(stream.start()); 29 30 let mut phase = 0.0f32; 31 let mut buffer = Vec::with_capacity(44100); 32 for _i in (0..44100) 33 { 34 // Small amplitude such that the test does not produce sound 35 buffer.push(phase * 0.001); 36 37 phase += 0.03; 38 if phase > 1.0 { phase -= 2.0; } 39 } 40 41 try!(stream.write(&buffer)); 42 43 Ok(()) 44} 45 46fn main() 47{ 48 portaudio::initialize().unwrap(); 49 println!("{:?}", demo()); 50 portaudio::terminate().unwrap(); 51} 52``` 53