Struct sfml::audio::SoundRecorderDriver[][src]

pub struct SoundRecorderDriver<'a, R: 'a> { /* fields omitted */ }

Type that “drives” custom sound recorders.

It does the actual recording, and feeds the custom sound recorder with the recorded data.

Implementations

impl<'a, R: SoundRecorder> SoundRecorderDriver<'a, R>[src]

pub fn new(sound_recorder: &'a mut R) -> Self[src]

Creates a new SoundRecorderDriver with the specified SoundRecorder.

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

Start the capture.

The sample_rate 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. You can select which capture device will be used, by passing the name to the set_device method. If none was selected before, the default capture device will be used. You can get a list of the names of all available capture devices by calling available_devices.

Returns whether the start of capture was successful.

pub fn stop(&mut self) -> &mut R[src]

Stop the capture, lending out the underlying SoundRecorder.

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

Get the sample rate.

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).

pub fn set_channel_count(&mut self, channel_count: u32)[src]

Set the channel count of the audio capture device.

This method allows you to specify the number of channels used for recording. Currently only 16-bit mono and 16-bit stereo are supported.

Parameters

  • channel_count Number of channels. Currently only mono (1) and stereo (2) are supported.

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

Get the number of channels used by this recorder.

Currently only mono and stereo are supported, so the value is either 1 (for mono) or 2 (for stereo).

pub fn set_processing_interval(&mut self, interval: Time)[src]

Set the processing interval.

The processing interval controls the period between calls to SoundRecorder::on_process_samples. You may want to use a small interval if you want to process the recorded data in real time, for example.

Note: this is only a hint, the actual period may vary. So don’t rely on this parameter to implement precise timing.

The default processing interval is 100 ms.

#[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<'a, R: Debug + 'a> Debug for SoundRecorderDriver<'a, R>[src]

impl<'a, S> Drop for SoundRecorderDriver<'a, S>[src]

Auto Trait Implementations

impl<'a, R> RefUnwindSafe for SoundRecorderDriver<'a, R> where
    R: RefUnwindSafe

impl<'a, R> !Send for SoundRecorderDriver<'a, R>

impl<'a, R> !Sync for SoundRecorderDriver<'a, R>

impl<'a, R> Unpin for SoundRecorderDriver<'a, R>

impl<'a, R> !UnwindSafe for SoundRecorderDriver<'a, R>

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.