1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#![crate_type = "lib"] #![crate_name = "portaudio_rs"] #![warn(missing_docs)] //! PortAudio bindings for Rust //! //! # Example //! //! ``` //! fn demo() -> portaudio_rs::PaResult //! { //! let stream = portaudio_rs::stream::Stream::open_default( //! 0, // input channels //! 1, // output channels //! 44100.0, // sample rate //! portaudio_rs::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(()) //! } //! //! portaudio_rs::initialize().unwrap(); //! println!("{:?}", demo()); //! portaudio_rs::terminate().unwrap(); //! ``` extern crate libc; #[macro_use] extern crate bitflags; extern crate portaudio_sys as ll; pub use pa::{PaError, PaResult, initialize, terminate, version, version_text}; pub mod stream; mod pa; pub mod hostapi; pub mod device; mod util;