# Module alsa::hctl [−] [src]

HCtl API - for mixer control and jack detection

# Example

Print all jacks and their status

    for a in ::alsa::card::Iter::new().map(|x| x.unwrap()) {
        use std::ffi::CString;
        use alsa::hctl::HCtl;
        let h = HCtl::open(&CString::new(format!("hw:{}", a.get_index())).unwrap(), false).unwrap();
        h.load().unwrap();
        for b in h.elem_iter() {
            use alsa::ctl::ElemIface;
            let id = b.get_id().unwrap();
            if id.get_interface() != ElemIface::Card { continue; }
            let name = id.get_name().unwrap();
            if !name.ends_with(" Jack") { continue; }
            if name.ends_with(" Phantom Jack") {
                println!("{} is always present", &name[..name.len()-13])
            }
            else { println!("{} is {}", &name[..name.len()-5],
                if b.read().unwrap().get_boolean(0).unwrap() { "plugged in" } else { "unplugged" })
            }
        }
    }

## Structs

Elem | snd_hctl_elem_t wrapper
ElemIter | Iterates over elements for a `HCtl`
HCtl | snd_hctl_t wrapper

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)