Struct cpal::SupportedFormat[][src]

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

Minimum value for the samples rate of the supported formats.

Maximum value for the samples rate of the supported formats.

Type of data expected by the device.

Methods

impl SupportedFormat
[src]

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

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 Debug for SupportedFormat
[src]

Formats the value using the given formatter. Read more

impl Clone for SupportedFormat
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for SupportedFormat
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for SupportedFormat
[src]

impl From<Format> for SupportedFormat
[src]

Performs the conversion.

Auto Trait Implementations