200 lines
17 KiB
HTML
200 lines
17 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="rustdoc">
|
||
<meta name="description" content="API documentation for the Rust `AlsaCard` struct in crate `pnmixerlib`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, AlsaCard">
|
||
|
||
<title>pnmixerlib::alsa_card::AlsaCard - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../normalize.css">
|
||
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc struct">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'>Struct AlsaCard</p><div class="block items"><ul><li><a href="#fields">Fields</a></li><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>pnmixerlib</a>::<wbr><a href='index.html'>alsa_card</a></p><script>window.sidebarCurrent = {name: 'AlsaCard', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content">
|
||
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>pnmixerlib</a>::<wbr><a href='index.html'>alsa_card</a>::<wbr><a class="struct" href=''>AlsaCard</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a class='srclink' href='../../src/pnmixerlib/alsa_card.rs.html#42-56' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct AlsaCard {
|
||
pub card: <a class="struct" href="../../alsa/card/struct.Card.html" title="struct alsa::card::Card">Card</a>,
|
||
pub mixer: <a class="struct" href="../../alsa/mixer/struct.Mixer.html" title="struct alsa::mixer::Mixer">Mixer</a>,
|
||
pub selem_id: <a class="struct" href="../../alsa/mixer/struct.SelemId.html" title="struct alsa::mixer::SelemId">SelemId</a>,
|
||
pub watch_ids: <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Cell.html" title="struct core::cell::Cell">Cell</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>>>,
|
||
pub cb: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a><<a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="enum" href="../../pnmixerlib/alsa_card/enum.AlsaEvent.html" title="enum pnmixerlib::alsa_card::AlsaEvent">AlsaEvent</a>)>,
|
||
// some fields omitted
|
||
}</pre><div class='docblock'><p>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).</p>
|
||
</div><h2 id='fields' class='fields'>Fields</h2><span id='structfield.card' class="structfield">
|
||
<span id='card.v' class='invisible'>
|
||
<code>card: <a class="struct" href="../../alsa/card/struct.Card.html" title="struct alsa::card::Card">Card</a></code>
|
||
</span></span><div class='docblock'><p>The raw alsa card.</p>
|
||
</div><span id='structfield.mixer' class="structfield">
|
||
<span id='mixer.v' class='invisible'>
|
||
<code>mixer: <a class="struct" href="../../alsa/mixer/struct.Mixer.html" title="struct alsa::mixer::Mixer">Mixer</a></code>
|
||
</span></span><div class='docblock'><p>The raw mixer.</p>
|
||
</div><span id='structfield.selem_id' class="structfield">
|
||
<span id='selem_id.v' class='invisible'>
|
||
<code>selem_id: <a class="struct" href="../../alsa/mixer/struct.SelemId.html" title="struct alsa::mixer::SelemId">SelemId</a></code>
|
||
</span></span><div class='docblock'><p>The simple element ID. <code>Selem</code> doesn't implement the Copy trait
|
||
so we save the ID instead and can get the <code>Selem</code> by lookup.</p>
|
||
</div><span id='structfield.watch_ids' class="structfield">
|
||
<span id='watch_ids.v' class='invisible'>
|
||
<code>watch_ids: <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Cell.html" title="struct core::cell::Cell">Cell</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>>></code>
|
||
</span></span><div class='docblock'><p>Watch IDs from polling the alsa card. We need them when we
|
||
drop the card, so we can unregister the polling.</p>
|
||
</div><span id='structfield.cb' class="structfield">
|
||
<span id='cb.v' class='invisible'>
|
||
<code>cb: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a><<a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="enum" href="../../pnmixerlib/alsa_card/enum.AlsaEvent.html" title="enum pnmixerlib::alsa_card::AlsaEvent">AlsaEvent</a>)></code>
|
||
</span></span><div class='docblock'><p>Callback for the various <code>AlsaEvent</code>s.</p>
|
||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../pnmixerlib/alsa_card/struct.AlsaCard.html" title="struct pnmixerlib::alsa_card::AlsaCard">AlsaCard</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/pnmixerlib/alsa_card.rs.html#59-260' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(<br> card_name: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, <br> elem_name: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, <br> cb: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a><<a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(<a class="enum" href="../../pnmixerlib/alsa_card/enum.AlsaEvent.html" title="enum pnmixerlib::alsa_card::AlsaEvent">AlsaEvent</a>)><br>) -> <a class="type" href="../../pnmixerlib/errors/type.Result.html" title="type pnmixerlib::errors::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="struct" href="../../pnmixerlib/alsa_card/struct.AlsaCard.html" title="struct pnmixerlib::alsa_card::AlsaCard">AlsaCard</a>>></code></span></h4>
|
||
<div class='docblock'><p>Create a new alsa card. Tries very hard to get a valid, playable
|
||
card and mixer, so this is not a 'strict' function.</p>
|
||
|
||
<h2 id='card_name' class='section-header'><a href='#card_name'><code>card_name</code></a></h2>
|
||
<p>If a card name is provided, it will be tried. If <code>None</code> is provided
|
||
or the given card name does not exist or is not playable, any other
|
||
playable card is tried.</p>
|
||
|
||
<h2 id='elem_name' class='section-header'><a href='#elem_name'><code>elem_name</code></a></h2>
|
||
<p>If an elem name is provided, it will be tried. If <code>None</code> is provided
|
||
or the given elem name does not exist or is not playable, any other
|
||
playable elem is tried.</p>
|
||
|
||
<h2 id='cb' class='section-header'><a href='#cb'><code>cb</code></a></h2>
|
||
<p>Callback for the various <code>AlsaEvent</code>s.</p>
|
||
|
||
<h1 id='returns' class='section-header'><a href='#returns'>Returns</a></h1>
|
||
<p><code>Ok(Box<AlsaCard>)</code> on success, <code>Err(error)</code> otherwise.</p>
|
||
</div><h4 id='method.card_name' class="method"><span id='card_name.v' class='invisible'><code>fn <a href='#method.card_name' class='fnname'>card_name</a>(&self) -> <a class="type" href="../../pnmixerlib/errors/type.Result.html" title="type pnmixerlib::errors::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></code></span></h4>
|
||
<div class='docblock'><p>Get the name of the alsa card.</p>
|
||
</div><h4 id='method.chan_name' class="method"><span id='chan_name.v' class='invisible'><code>fn <a href='#method.chan_name' class='fnname'>chan_name</a>(&self) -> <a class="type" href="../../pnmixerlib/errors/type.Result.html" title="type pnmixerlib::errors::Result">Result</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></code></span></h4>
|
||
<div class='docblock'><p>Get the name of the channel.</p>
|
||
</div><h4 id='method.selem' class="method"><span id='selem.v' class='invisible'><code>fn <a href='#method.selem' class='fnname'>selem</a>(&self) -> <a class="struct" href="../../alsa/mixer/struct.Selem.html" title="struct alsa::mixer::Selem">Selem</a></code></span></h4>
|
||
<div class='docblock'><p>Get the <code>Selem</code>, looked up by the <code>SelemId</code>.</p>
|
||
</div><h4 id='method.get_vol' class="method"><span id='get_vol.v' class='invisible'><code>fn <a href='#method.get_vol' class='fnname'>get_vol</a>(&self) -> <a class="type" href="../../pnmixerlib/errors/type.Result.html" title="type pnmixerlib::errors::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>></code></span></h4>
|
||
<div class='docblock'><p>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 <code>FrontRight</code> channel, because the seems to be
|
||
the safest bet.</p>
|
||
</div><h4 id='method.set_vol' class="method"><span id='set_vol.v' class='invisible'><code>fn <a href='#method.set_vol' class='fnname'>set_vol</a>(&self, new_vol: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="type" href="../../pnmixerlib/errors/type.Result.html" title="type pnmixerlib::errors::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">()</a>></code></span></h4>
|
||
<div class='docblock'><p>Sets the volume of the current card configuration.</p>
|
||
|
||
<h2 id='new_vol' class='section-header'><a href='#new_vol'><code>new_vol</code></a></h2>
|
||
<p>The volume corresponding to the volume range of the <code>Selem</code>. This
|
||
might need to be translated properly first from other formats
|
||
(like percentage).</p>
|
||
</div><h4 id='method.get_volume_range' class="method"><span id='get_volume_range.v' class='invisible'><code>fn <a href='#method.get_volume_range' class='fnname'>get_volume_range</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
||
<div class='docblock'><p>Gets the volume range of the currently selected card configuration.</p>
|
||
|
||
<h1 id='returns-1' class='section-header'><a href='#returns-1'>Returns</a></h1>
|
||
<p><code>(min, max)</code></p>
|
||
</div><h4 id='method.has_mute' class="method"><span id='has_mute.v' class='invisible'><code>fn <a href='#method.has_mute' class='fnname'>has_mute</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></code></span></h4>
|
||
<div class='docblock'><p>Whether the current card configuration can be muted.</p>
|
||
</div><h4 id='method.get_mute' class="method"><span id='get_mute.v' class='invisible'><code>fn <a href='#method.get_mute' class='fnname'>get_mute</a>(&self) -> <a class="type" href="../../pnmixerlib/errors/type.Result.html" title="type pnmixerlib::errors::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>></code></span></h4>
|
||
<div class='docblock'><p>Get the mute state of the current card configuration.</p>
|
||
</div><h4 id='method.set_mute' class="method"><span id='set_mute.v' class='invisible'><code>fn <a href='#method.set_mute' class='fnname'>set_mute</a>(&self, mute: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>) -> <a class="type" href="../../pnmixerlib/errors/type.Result.html" title="type pnmixerlib::errors::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">()</a>></code></span></h4>
|
||
<div class='docblock'><p>Set the mute state of the current card configuration.</p>
|
||
|
||
<h2 id='mute' class='section-header'><a href='#mute'><code>mute</code></a></h2>
|
||
<p>Passing <code>true</code> here means the card will be muted.</p>
|
||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html" title="trait core::ops::drop::Drop">Drop</a> for <a class="struct" href="../../pnmixerlib/alsa_card/struct.AlsaCard.html" title="struct pnmixerlib::alsa_card::AlsaCard">AlsaCard</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/pnmixerlib/alsa_card.rs.html#263-269' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.drop' class="method"><span id='drop.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/drop/trait.Drop.html#tymethod.drop' class='fnname'>drop</a>(&mut self)</code></span></h4>
|
||
<div class='docblock'><p>Destructs the watch IDs corresponding to the current poll descriptors.</p>
|
||
</div></div></section>
|
||
<section id='search' class="content hidden"></section>
|
||
|
||
<section class="footer"></section>
|
||
|
||
<aside id="help" class="hidden">
|
||
<div>
|
||
<h1 class="hidden">Help</h1>
|
||
|
||
<div class="shortcuts">
|
||
<h2>Keyboard Shortcuts</h2>
|
||
|
||
<dl>
|
||
<dt>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
<dt>+</dt>
|
||
<dd>Collapse/expand all sections</dd>
|
||
</dl>
|
||
</div>
|
||
|
||
<div class="infos">
|
||
<h2>Search Tricks</h2>
|
||
|
||
<p>
|
||
Prefix searches with a type followed by a colon (e.g.
|
||
<code>fn:</code>) to restrict the search to a given type.
|
||
</p>
|
||
|
||
<p>
|
||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||
<code>struct</code>, <code>enum</code>,
|
||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||
and <code>const</code>.
|
||
</p>
|
||
|
||
<p>
|
||
Search functions by type signature (e.g.
|
||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../../";
|
||
window.currentCrate = "pnmixerlib";
|
||
</script>
|
||
<script src="../../main.js"></script>
|
||
<script defer src="../../search-index.js"></script>
|
||
</body>
|
||
</html> |