Struct ears::Recorder [] [src]

pub struct Recorder {
    // some fields omitted
}

Record audio

This class provide easy audio recording using. The Recorder allow the user to record sound, then save it in a file, or create a SoundData object to play the recorded sound in the same program. A special context, RecordContext is needed to create the Recorder object. The Recorder work in it's own task.

Examples

use ears::Recorder;

fn main() -> () {
    // Create a new context to record audio
    let context = ears::init_in().unwrap();
    // Create the recorder
    let mut recorder = Recorder::new(context);
    // Start to record something
    recorder.start();

    // Do some other stuff here

    // Stop the recorder
    recorder.stop();
    // Then store the recorded data in a file
    recorder.save_to_file("hello_file");
}

Methods

impl Recorder

fn new(record_context: RecordContext) -> Recorder

Create a new audio recorder

fn start(&mut self)

fn stop(&mut self) -> bool

fn save_to_file(&mut self, filename: &str) -> bool