Struct RawDevice

Source
pub struct RawDevice(/* private fields */);

Implementations§

Source§

impl RawDevice

Source

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

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.

Source

pub fn context(&self) -> &RawContext

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

Source

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

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.

Source

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

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.

Source

pub fn is_started(&self) -> bool

Returns true if this device has started.

Source

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

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.

Source

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

Retrieves the master volume factor for the device.

Source

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

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.

Source

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

Retrieves the master gain in decibels.

Source

pub fn sample_rate(&self) -> u32

Source

pub fn resampling(&self) -> ResampleAlgorithm

Source

pub fn capture(&self) -> &DeviceCapture

Source

pub fn playback(&self) -> &DevicePlayback

Trait Implementations§

Source§

impl Drop for RawDevice

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for RawDevice

Source§

impl Sync for RawDevice

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.