[][src]Struct miniaudio::Context

pub struct Context(_);

An atomically reference counted context.

Implementations

impl Context[src]

pub fn new(
    backends: &[Backend],
    config: Option<&ContextConfig>
) -> Result<Context, Error>
[src]

Methods from Deref<Target = RawContext>

pub fn get_device_info(
    &self,
    device_type: DeviceType,
    device_id: &DeviceId,
    share_mode: ShareMode
) -> Result<DeviceInfo, Error>
[src]

Returns information like name, format, and sample rate, ect. about a device with the given ID.

pub fn set_device_info(
    &self,
    device_type: DeviceType,
    device_id: &DeviceId,
    share_mode: ShareMode,
    device_info: &mut DeviceInfo
) -> Result<(), Error>
[src]

Returns information like name, format, and sample rate, ect. about a device with the given ID. This will place the gathered information into the passed in device_info reference.

pub fn backend(&self) -> Backend[src]

pub fn thread_priority(&self) -> ThreadPriority[src]

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

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

Returns the number of found playback devices.

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

Returns the number of found capture devices.

pub fn playback_devices(&self) -> &[DeviceIdAndName][src]

Returns a slice containing the name and IDs of all found playback devices.

pub fn capture_devices(&self) -> &[DeviceIdAndName][src]

Returns a slice containing the name and IDs of all found capture devices.

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

pub fn with_devices<F>(&self, f: F) -> Result<(), Error> where
    F: FnOnce(&[DeviceIdAndName], &[DeviceIdAndName]), 
[src]

Retrieves basic information about every active playback and capture device. This function will allocate memory internally for device lists. This function will not call the closure if an error occurred.

pub fn with_playback_devices<F>(&self, f: F) -> Result<(), Error> where
    F: FnOnce(&[DeviceIdAndName]), 
[src]

Retrieves basic information about every active playback device. This function will allocate memory internally for device lists. This function will not call the closure if an error occurred.

pub fn with_capture_devices<F>(&self, f: F) -> Result<(), Error> where
    F: FnOnce(&[DeviceIdAndName]), 
[src]

Retrieves basic information about every active capture device. This function will allocate memory internally for device lists. This function will not call the closure if an error occurred.

pub unsafe fn enumerate_devices<F>(&self, callback: F) -> Result<(), Error> where
    F: for<'r, 's> FnMut(&'r RawContext, DeviceType, &'s DeviceIdAndName) -> bool
[src]

Safety

DO NOT call get_device_info or set_device_info while inside of the callback.

Trait Implementations

impl Clone for Context[src]

impl Deref for Context[src]

type Target = RawContext

The resulting type after dereferencing.

Auto Trait Implementations

impl RefUnwindSafe for Context

impl Send for Context

impl Sync for Context

impl Unpin for Context

impl UnwindSafe for Context

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.