Struct sfml::audio::SoundBufferRecorder[][src]

pub struct SoundBufferRecorder { /* fields omitted */ }

Specialized SoundRecorder which stores the captured audio data into a sound buffer.

SoundBufferRecorder allows to access a recorded sound through a SoundBuffer, so that it can be played, saved to a file, etc.

As usual, don’t forget to call the is_available function before using this type (see SoundRecorder for more details about this).

Implementations

impl SoundBufferRecorder[src]

#[must_use]pub fn new() -> SoundBufferRecorder[src]

Create a new sound buffer recorder

pub fn start(&mut self, sample_rate: u32) -> bool[src]

Start the capture of a sound buffer recorder

The sampleRate parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn’t block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.

Arguments

  • sample_rate - Desired capture rate, in number of samples per second

pub fn stop(&mut self)[src]

Stop the capture of a sound recorder

#[must_use]pub fn sample_rate(&self) -> u32[src]

Get the sample rate of a sound buffer recorder

The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).

Return the sample rate, in samples per second

#[must_use]pub fn buffer(&self) -> &SoundBuffer[src]

Get the sound buffer containing the captured audio data

The sound buffer is valid only after the capture has ended. This function provides a read-only access to the internal sound buffer, but it can be copied if you need to make any modification to it.

Return Read-only access to the sound buffer

#[must_use]pub fn device(&self) -> String[src]

Get the name of the current audio capture device.

pub fn set_device(&mut self, name: &str) -> Result<(), SetDeviceError>[src]

Set the audio capture device.

This function sets the audio capture device to the device with the given name. It can be called on the fly (i.e: while recording). If you do so while recording and opening the device fails, it stops the recording.

Trait Implementations

impl Debug for SoundBufferRecorder[src]

impl Default for SoundBufferRecorder[src]

impl Drop for SoundBufferRecorder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.