[][src]Struct cpal::SupportedFormat

pub struct SupportedFormat {
    pub channels: ChannelCount,
    pub min_sample_rate: SampleRate,
    pub max_sample_rate: SampleRate,
    pub data_type: SampleFormat,
}

Describes a range of supported stream formats.

Fields

channels: ChannelCountmin_sample_rate: SampleRate

Minimum value for the samples rate of the supported formats.

max_sample_rate: SampleRate

Maximum value for the samples rate of the supported formats.

data_type: SampleFormat

Type of data expected by the device.

Methods

impl SupportedFormat[src]

pub fn with_max_sample_rate(self) -> Format[src]

Turns this SupportedFormat into a Format corresponding to the maximum samples rate.

pub fn cmp_default_heuristics(&self, other: &Self) -> Ordering[src]

A comparison function which compares two SupportedFormats in terms of their priority of use as a default stream format.

Some backends do not provide a default stream format for their audio devices. In these cases, CPAL attempts to decide on a reasonable default format for the user. To do this we use the "greatest" of all supported stream formats when compared with this method.

Formats are prioritised by the following heuristics:

Channels:

  • Stereo
  • Mono
  • Max available channels

Sample format:

  • f32
  • i16
  • u16

Sample rate:

  • 44100 (cd quality)
  • Max sample rate

Trait Implementations

impl From<Format> for SupportedFormat[src]

impl Clone for SupportedFormat[src]

impl Eq for SupportedFormat[src]

impl PartialEq<SupportedFormat> for SupportedFormat[src]

impl Debug for SupportedFormat[src]

impl StructuralPartialEq for SupportedFormat[src]

impl StructuralEq for SupportedFormat[src]

Auto Trait Implementations

Blanket Implementations

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 = !

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.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]