• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H03-May-2022-219181

script/H03-May-2022-43

src/H03-May-2022-1,183827

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D14-May-202074 65

.gitignoreH A D11-Jun-201918 32

.travis.ymlH A D11-Jun-2019490 2619

Cargo.lockH A D14-May-20201.6 KiB4135

Cargo.tomlH A D14-May-2020830 3025

Cargo.toml.orig-cargoH A D14-May-2020288 1512

LICENSEH A D11-Jun-20191.1 KiB2116

README.mdH A D11-Jun-20191.2 KiB5339

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