[][src]Struct miniaudio::Device

pub struct Device(_);

Methods

impl Device[src]

pub fn new(
    context: Option<Context>,
    config: &DeviceConfig
) -> Result<Device, Error>
[src]

pub fn start(&self) -> Result<(), Error>[src]

Starts the device. For playback devices this begins playback. For capture devices this begins recording. Use stop to stop this device.

WARNING This should not be called from a callback.

pub fn stop(&self) -> Result<(), Error>[src]

Stops this device. For playback devices this stops playback. For capture devices this stops recording. Use start to start this device again.

WARNING This should not be called from a callback.

Methods from Deref<Target = RawDevice>

pub fn owned_context(&self) -> Option<&'static RawContext>[src]

This will return the context owned by this device. A context that was passed into this device via new is not owned by this device and if you need a reference to that use context instead.

pub fn context(&self) -> &RawContext[src]

This will return a pointer to the context being used by this device.

pub unsafe fn raw_start(&self) -> Result<(), Error>[src]

Starts the device. For playback devices this begins playback. For capture devices this begins recording. Use stop to stop this device.

Safety

This should not be called from a callback.

pub unsafe fn raw_stop(&self) -> Result<(), Error>[src]

Stops this device. For playback devices this stops playback. For capture devices this stops recording. Use start to start this device again.

Safety

This should not be called from a callback.

pub fn is_started(&self) -> bool[src]

Returns true if this device has started.

pub fn set_master_volume(&self, volume: f32) -> Result<(), Error>[src]

Sets the master volume factor for the device.

The volume factor must be between 0 (silence) and 1 (full volume). Use set_master_gain_db() to use decibel notation, where 0 is full volume and values less than 0 decreases the volume.

Callback Safety

Safe. If you set the volume in the data callback, that data written to the output buffer will have the new volume applied.

pub fn get_master_volume(&self) -> Result<f32, Error>[src]

Retrieves the master volume factor for the device.

pub fn set_master_gain_db(&self, gain_db: f32) -> Result<(), Error>[src]

Sets the master volume for the device as gain in decibels.

A gain of 0 is full volume, whereas a gain of < 0 will decrease the volume.

The volume factor must be between 0 (silence) and 1 (full volume). Use set_master_gain_db() to use decibel notation, where 0 is full volume and values less than 0 decreases the volume.

Callback Safety

Safe. If you set the volume in the data callback, that data written to the output buffer will have the new volume applied.

pub fn get_master_gain_db(&self) -> Result<f32, Error>[src]

Retrieves the master gain in decibels.

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

pub fn resampling(&self) -> ResampleAlgorithm[src]

pub fn capture(&self) -> &DeviceCapture[src]

pub fn playback(&self) -> &DevicePlayback[src]

Trait Implementations

impl Clone for Device[src]

impl Deref for Device[src]

type Target = RawDevice

The resulting type after dereferencing.

Auto Trait Implementations

impl RefUnwindSafe for Device

impl !Send for Device

impl !Sync for Device

impl Unpin for Device

impl UnwindSafe for Device

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.