Struct pnmixerlib::alsa_card::AlsaCard [] [src]

pub struct AlsaCard {
    pub card: Card,
    pub mixer: Mixer,
    pub selem_id: SelemId,
    pub watch_ids: Cell<Vec<u32>>,
    pub cb: Rc<Fn(AlsaEvent)>,
    // some fields omitted
}

A fairly high-level alsa card struct. We save some redundant information in order to access it more easily, in addition to some information that is not purely alsa related (like callbacks).

Fields

The raw alsa card.

The raw mixer.

The simple element ID. Selem doesn't implement the Copy trait so we save the ID instead and can get the Selem by lookup.

Watch IDs from polling the alsa card. We need them when we drop the card, so we can unregister the polling.

Callback for the various AlsaEvents.

Methods

impl AlsaCard
[src]

Create a new alsa card. Tries very hard to get a valid, playable card and mixer, so this is not a 'strict' function.

card_name

If a card name is provided, it will be tried. If None is provided or the given card name does not exist or is not playable, any other playable card is tried.

elem_name

If an elem name is provided, it will be tried. If None is provided or the given elem name does not exist or is not playable, any other playable elem is tried.

cb

Callback for the various AlsaEvents.

Returns

Ok(Box<AlsaCard>) on success, Err(error) otherwise.

Get the name of the alsa card.

Get the name of the channel.

Get the Selem, looked up by the SelemId.

Get the current volume. The returned value corresponds to the volume range and might need to be interpreted (such as converting to percentage). This always gets the volume of the FrontRight channel, because the seems to be the safest bet.

Sets the volume of the current card configuration.

new_vol

The volume corresponding to the volume range of the Selem. This might need to be translated properly first from other formats (like percentage).

Gets the volume range of the currently selected card configuration.

Returns

(min, max)

Whether the current card configuration can be muted.

Get the mute state of the current card configuration.

Set the mute state of the current card configuration.

mute

Passing true here means the card will be muted.

Trait Implementations

impl Drop for AlsaCard
[src]

Destructs the watch IDs corresponding to the current poll descriptors.