Struct pnmixerlib::audio::Audio [] [src]

pub struct Audio {
    pub acard: RefCell<Box<AlsaCard>>,
    pub last_action_timestamp: Rc<RefCell<i64>>,
    pub handlers: Handlers,
    pub scroll_step: Cell<u32>,
    // some fields omitted
}

High-level Audio struct, which could theoretically be backend agnostic.

Fields

The alsa card.

Last timestamp of an internal action we triggered, e.g. by setting the volume or the mute state.

A set of handlers that react to audio signals. We can connect to these.

The step at which to increase/decrease the volume. This value is basically from the preferences.

Methods

impl Audio
[src]

Create a new Audio instance. This tries very hard to get a working configuration from the backend.

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.

Returns

Ok(Audio) on success, Err(error) otherwise.

Switches the current alsa card. Behaves the same way in regards to card_name and elem_name as the Audio::new() method.

user

Where the card switch originates from.

Current volume.

Current volume level, nicely usable for e.g. selecting from a set of images.

Set the current volume.

new_vol

Set the volume to this value.

user

Where the card switch originates from.

dir

The "direction" of the volume change, e.g. is it a decrease or increase. This helps with rounding problems.

auto_unmute

Whether to automatically unmute if the volume changes.

Increase the volume. The step to increasy by is taken from self.scroll_step.

user

Where the card switch originates from.

Decrease the volume. The step to decrease by is taken from self.scroll_step.

user

Where the card switch originates from.

Whether the current audio configuration can be muted.

Get the mute state of the current audio configuration.

Set the mute state of the current audio configuration.

Toggle the mute state of the current audio configuration.

Connect a signal handler to the audio subsystem. This can be done from anywhere, e.g. in the UI code to react to certain signals. Multiple handlers for the same signals are fine, they will be executed in order.

Get the current card name.

Get the currently playable channel names.

Get the current active channel name.