[−][src]Crate portaudio_rs
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();
Modules
device | Info about connected audio devices |
hostapi | Info module for available audio host API's |
stream | Contains the Stream class and associated values |
Enums
PaError | Enum for all possible errors given by PortAudio |
Functions
initialize | Initialize the PortAudio API |
terminate | Terminate the PortAudio API |
version | PortAudio version |
version_text | Human-readable PortAudio version |
Type Definitions
PaResult | A result type wrapping PaError. |