1 unstable release

Uses old Rust 2015

0.1.1 Mar 6, 2017

#7 in #port-audio

Download history 304/week @ 2024-09-01 281/week @ 2024-09-08 356/week @ 2024-09-15 427/week @ 2024-09-22 432/week @ 2024-09-29 262/week @ 2024-10-06 539/week @ 2024-10-13 675/week @ 2024-10-20 662/week @ 2024-10-27 449/week @ 2024-11-03 302/week @ 2024-11-10 396/week @ 2024-11-17 491/week @ 2024-11-24 383/week @ 2024-12-01 559/week @ 2024-12-08 418/week @ 2024-12-15

1,895 downloads per month
Used in 10 crates (via portaudio-rs)

MIT license

11KB
209 lines

portaudio-rs

Build Status

Documentation

PortAudio bindings for Rust

See http://portaudio.com/

Example

extern crate portaudio_rs as portaudio;

fn demo() -> portaudio::PaResult
{
    let stream = portaudio::stream::Stream::open_default(
                          0, // input channels
                          1, // output channels
                          44100.0, // sample rate
                          portaudio::stream::FRAMES_PER_BUFFER_UNSPECIFIED,
                          None // no callback
                 )?;

    stream.start()?;

    let mut phase = 0.0f32;
    let mut buffer = Vec::with_capacity(44100);
    for _i in 0..44100
    {
        // Small amplitude such that the test does not produce sound
        buffer.push(phase * 0.001);

        phase += 0.03;
        if phase > 1.0 { phase -= 2.0; }
    }

    stream.write(&buffer)?;

    Ok(())
}

fn main()
{
    portaudio::initialize().unwrap();
    println!("{:?}", demo());
    portaudio::terminate().unwrap();
}

Dependencies

~47KB