[−][src]Struct miniaudio::Device
Methods
impl Device
[src]
pub fn new(
context: Option<Context>,
config: &DeviceConfig
) -> Result<Device, Error>
[src]
context: Option<Context>,
config: &DeviceConfig
) -> Result<Device, Error>
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,