Documentation for 0.11.0

This commit is contained in:
Lars Immisch
2024-05-30 23:19:19 +02:00
parent 6b17f924e4
commit 7a629527e0
14 changed files with 532 additions and 479 deletions

View File

@@ -419,9 +419,7 @@ table.footnote td {
} }
dl { dl {
margin-left: 0; margin: 0;
margin-right: 0;
margin-top: 0;
padding: 0; padding: 0;
} }

View File

@@ -4,7 +4,7 @@
* *
* Sphinx stylesheet -- basic theme. * Sphinx stylesheet -- basic theme.
* *
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details. * :license: BSD, see LICENSE for details.
* *
*/ */
@@ -237,6 +237,10 @@ a.headerlink {
visibility: hidden; visibility: hidden;
} }
a:visited {
color: #551A8B;
}
h1:hover > a.headerlink, h1:hover > a.headerlink,
h2:hover > a.headerlink, h2:hover > a.headerlink,
h3:hover > a.headerlink, h3:hover > a.headerlink,
@@ -670,6 +674,16 @@ dd {
margin-left: 30px; margin-left: 30px;
} }
.sig dd {
margin-top: 0px;
margin-bottom: 0px;
}
.sig dl {
margin-top: 0px;
margin-bottom: 0px;
}
dl > dd:last-child, dl > dd:last-child,
dl > dd:last-child > :last-child { dl > dd:last-child > :last-child {
margin-bottom: 0; margin-bottom: 0;
@@ -738,6 +752,14 @@ abbr, acronym {
cursor: help; cursor: help;
} }
.translated {
background-color: rgba(207, 255, 207, 0.2)
}
.untranslated {
background-color: rgba(255, 207, 207, 0.2)
}
/* -- code displays --------------------------------------------------------- */ /* -- code displays --------------------------------------------------------- */
pre { pre {

View File

@@ -4,7 +4,7 @@
* *
* Base JavaScript utilities for all Sphinx HTML documentation. * Base JavaScript utilities for all Sphinx HTML documentation.
* *
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details. * :license: BSD, see LICENSE for details.
* *
*/ */

View File

@@ -17,6 +17,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
.highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */ .highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #FF0000 } /* Generic.Error */ .highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */ .highlight .gi { color: #00A000 } /* Generic.Inserted */

View File

@@ -4,7 +4,7 @@
* *
* Sphinx JavaScript utilities for the full-text search. * Sphinx JavaScript utilities for the full-text search.
* *
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS. * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details. * :license: BSD, see LICENSE for details.
* *
*/ */
@@ -57,12 +57,12 @@ const _removeChildren = (element) => {
const _escapeRegExp = (string) => const _escapeRegExp = (string) =>
string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
const _displayItem = (item, searchTerms) => { const _displayItem = (item, searchTerms, highlightTerms) => {
const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; const docBuilder = DOCUMENTATION_OPTIONS.BUILDER;
const docUrlRoot = DOCUMENTATION_OPTIONS.URL_ROOT;
const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX;
const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX;
const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY;
const contentRoot = document.documentElement.dataset.content_root;
const [docName, title, anchor, descr, score, _filename] = item; const [docName, title, anchor, descr, score, _filename] = item;
@@ -75,28 +75,35 @@ const _displayItem = (item, searchTerms) => {
if (dirname.match(/\/index\/$/)) if (dirname.match(/\/index\/$/))
dirname = dirname.substring(0, dirname.length - 6); dirname = dirname.substring(0, dirname.length - 6);
else if (dirname === "index/") dirname = ""; else if (dirname === "index/") dirname = "";
requestUrl = docUrlRoot + dirname; requestUrl = contentRoot + dirname;
linkUrl = requestUrl; linkUrl = requestUrl;
} else { } else {
// normal html builders // normal html builders
requestUrl = docUrlRoot + docName + docFileSuffix; requestUrl = contentRoot + docName + docFileSuffix;
linkUrl = docName + docLinkSuffix; linkUrl = docName + docLinkSuffix;
} }
let linkEl = listItem.appendChild(document.createElement("a")); let linkEl = listItem.appendChild(document.createElement("a"));
linkEl.href = linkUrl + anchor; linkEl.href = linkUrl + anchor;
linkEl.dataset.score = score; linkEl.dataset.score = score;
linkEl.innerHTML = title; linkEl.innerHTML = title;
if (descr) if (descr) {
listItem.appendChild(document.createElement("span")).innerHTML = listItem.appendChild(document.createElement("span")).innerHTML =
" (" + descr + ")"; " (" + descr + ")";
// highlight search terms in the description
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
}
else if (showSearchSummary) else if (showSearchSummary)
fetch(requestUrl) fetch(requestUrl)
.then((responseData) => responseData.text()) .then((responseData) => responseData.text())
.then((data) => { .then((data) => {
if (data) if (data)
listItem.appendChild( listItem.appendChild(
Search.makeSearchSummary(data, searchTerms) Search.makeSearchSummary(data, searchTerms, anchor)
); );
// highlight search terms in the summary
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted"));
}); });
Search.output.appendChild(listItem); Search.output.appendChild(listItem);
}; };
@@ -109,26 +116,43 @@ const _finishSearch = (resultCount) => {
); );
else else
Search.status.innerText = _( Search.status.innerText = _(
`Search finished, found ${resultCount} page(s) matching the search query.` "Search finished, found ${resultCount} page(s) matching the search query."
); ).replace('${resultCount}', resultCount);
}; };
const _displayNextItem = ( const _displayNextItem = (
results, results,
resultCount, resultCount,
searchTerms searchTerms,
highlightTerms,
) => { ) => {
// results left, load the summary and display it // results left, load the summary and display it
// this is intended to be dynamic (don't sub resultsCount) // this is intended to be dynamic (don't sub resultsCount)
if (results.length) { if (results.length) {
_displayItem(results.pop(), searchTerms); _displayItem(results.pop(), searchTerms, highlightTerms);
setTimeout( setTimeout(
() => _displayNextItem(results, resultCount, searchTerms), () => _displayNextItem(results, resultCount, searchTerms, highlightTerms),
5 5
); );
} }
// search finished, update title and status message // search finished, update title and status message
else _finishSearch(resultCount); else _finishSearch(resultCount);
}; };
// Helper function used by query() to order search results.
// Each input is an array of [docname, title, anchor, descr, score, filename].
// Order the results by score (in opposite order of appearance, since the
// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically.
const _orderResultsByScoreThenName = (a, b) => {
const leftScore = a[4];
const rightScore = b[4];
if (leftScore === rightScore) {
// same score: sort alphabetically
const leftTitle = a[1].toLowerCase();
const rightTitle = b[1].toLowerCase();
if (leftTitle === rightTitle) return 0;
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
}
return leftScore > rightScore ? 1 : -1;
};
/** /**
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a * Default splitQuery function. Can be overridden in ``sphinx.search`` with a
@@ -152,13 +176,26 @@ const Search = {
_queued_query: null, _queued_query: null,
_pulse_status: -1, _pulse_status: -1,
htmlToText: (htmlString) => { htmlToText: (htmlString, anchor) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() }); for (const removalQuery of [".headerlinks", "script", "style"]) {
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
}
if (anchor) {
const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`);
if (anchorContent) return anchorContent.textContent;
console.warn(
`Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`
);
}
// if anchor not specified or not found, fall back to main content
const docContent = htmlElement.querySelector('[role="main"]'); const docContent = htmlElement.querySelector('[role="main"]');
if (docContent !== undefined) return docContent.textContent; if (docContent) return docContent.textContent;
console.warn( console.warn(
"Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template." "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
); );
return ""; return "";
}, },
@@ -231,16 +268,7 @@ const Search = {
else Search.deferQuery(query); else Search.deferQuery(query);
}, },
/** _parseQuery: (query) => {
* execute search (requires search index to be loaded)
*/
query: (query) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const allTitles = Search._index.alltitles;
const indexEntries = Search._index.indexentries;
// stem the search terms and add them to the correct list // stem the search terms and add them to the correct list
const stemmer = new Stemmer(); const stemmer = new Stemmer();
const searchTerms = new Set(); const searchTerms = new Set();
@@ -276,16 +304,32 @@ const Search = {
// console.info("required: ", [...searchTerms]); // console.info("required: ", [...searchTerms]);
// console.info("excluded: ", [...excludedTerms]); // console.info("excluded: ", [...excludedTerms]);
// array of [docname, title, anchor, descr, score, filename] return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
let results = []; },
/**
* execute search (requires search index to be loaded)
*/
_performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => {
const filenames = Search._index.filenames;
const docNames = Search._index.docnames;
const titles = Search._index.titles;
const allTitles = Search._index.alltitles;
const indexEntries = Search._index.indexentries;
// Collect multiple result groups to be sorted separately and then ordered.
// Each is an array of [docname, title, anchor, descr, score, filename].
const normalResults = [];
const nonMainIndexResults = [];
_removeChildren(document.getElementById("search-progress")); _removeChildren(document.getElementById("search-progress"));
const queryLower = query.toLowerCase(); const queryLower = query.toLowerCase().trim();
for (const [title, foundTitles] of Object.entries(allTitles)) { for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) { if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) { for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length) let score = Math.round(100 * queryLower.length / title.length)
results.push([ normalResults.push([
docNames[file], docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title, titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "", id !== null ? "#" + id : "",
@@ -300,46 +344,47 @@ const Search = {
// search for explicit entries in index directives // search for explicit entries in index directives
for (const [entry, foundEntries] of Object.entries(indexEntries)) { for (const [entry, foundEntries] of Object.entries(indexEntries)) {
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
for (const [file, id] of foundEntries) { for (const [file, id, isMain] of foundEntries) {
let score = Math.round(100 * queryLower.length / entry.length) const score = Math.round(100 * queryLower.length / entry.length);
results.push([ const result = [
docNames[file], docNames[file],
titles[file], titles[file],
id ? "#" + id : "", id ? "#" + id : "",
null, null,
score, score,
filenames[file], filenames[file],
]); ];
if (isMain) {
normalResults.push(result);
} else {
nonMainIndexResults.push(result);
}
} }
} }
} }
// lookup as object // lookup as object
objectTerms.forEach((term) => objectTerms.forEach((term) =>
results.push(...Search.performObjectSearch(term, objectTerms)) normalResults.push(...Search.performObjectSearch(term, objectTerms))
); );
// lookup as search terms in fulltext // lookup as search terms in fulltext
results.push(...Search.performTermsSearch(searchTerms, excludedTerms)); normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
// let the scorer override scores with a custom scoring function // let the scorer override scores with a custom scoring function
if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item))); if (Scorer.score) {
normalResults.forEach((item) => (item[4] = Scorer.score(item)));
nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item)));
}
// now sort the results by score (in opposite order of appearance, since the // Sort each group of results by score and then alphabetically by name.
// display function below uses pop() to retrieve items) and then normalResults.sort(_orderResultsByScoreThenName);
// alphabetically nonMainIndexResults.sort(_orderResultsByScoreThenName);
results.sort((a, b) => {
const leftScore = a[4]; // Combine the result groups in (reverse) order.
const rightScore = b[4]; // Non-main index entries are typically arbitrary cross-references,
if (leftScore === rightScore) { // so display them after other results.
// same score: sort alphabetically let results = [...nonMainIndexResults, ...normalResults];
const leftTitle = a[1].toLowerCase();
const rightTitle = b[1].toLowerCase();
if (leftTitle === rightTitle) return 0;
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
}
return leftScore > rightScore ? 1 : -1;
});
// remove duplicate search results // remove duplicate search results
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
@@ -353,14 +398,19 @@ const Search = {
return acc; return acc;
}, []); }, []);
results = results.reverse(); return results.reverse();
},
query: (query) => {
const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
// for debugging // for debugging
//Search.lastresults = results.slice(); // a copy //Search.lastresults = results.slice(); // a copy
// console.info("search results:", Search.lastresults); // console.info("search results:", Search.lastresults);
// print the results // print the results
_displayNextItem(results, results.length, searchTerms); _displayNextItem(results, results.length, searchTerms, highlightTerms);
}, },
/** /**
@@ -458,14 +508,18 @@ const Search = {
// add support for partial matches // add support for partial matches
if (word.length > 2) { if (word.length > 2) {
const escapedWord = _escapeRegExp(word); const escapedWord = _escapeRegExp(word);
Object.keys(terms).forEach((term) => { if (!terms.hasOwnProperty(word)) {
if (term.match(escapedWord) && !terms[word]) Object.keys(terms).forEach((term) => {
arr.push({ files: terms[term], score: Scorer.partialTerm }); if (term.match(escapedWord))
}); arr.push({ files: terms[term], score: Scorer.partialTerm });
Object.keys(titleTerms).forEach((term) => { });
if (term.match(escapedWord) && !titleTerms[word]) }
arr.push({ files: titleTerms[word], score: Scorer.partialTitle }); if (!titleTerms.hasOwnProperty(word)) {
}); Object.keys(titleTerms).forEach((term) => {
if (term.match(escapedWord))
arr.push({ files: titleTerms[term], score: Scorer.partialTitle });
});
}
} }
// no match but word was a required one // no match but word was a required one
@@ -488,9 +542,8 @@ const Search = {
// create the mapping // create the mapping
files.forEach((file) => { files.forEach((file) => {
if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1) if (!fileMap.has(file)) fileMap.set(file, [word]);
fileMap.get(file).push(word); else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
else fileMap.set(file, [word]);
}); });
}); });
@@ -541,8 +594,8 @@ const Search = {
* search summary for a given text. keywords is a list * search summary for a given text. keywords is a list
* of stemmed words. * of stemmed words.
*/ */
makeSearchSummary: (htmlText, keywords) => { makeSearchSummary: (htmlText, keywords, anchor) => {
const text = Search.htmlToText(htmlText); const text = Search.htmlToText(htmlText, anchor);
if (text === "") return null; if (text === "") return null;
const textLower = text.toLowerCase(); const textLower = text.toLowerCase();

View File

@@ -1,16 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-content_root="./">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &#8212; alsaaudio documentation 0.10.0 documentation</title> <title>Index &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js"></script> <script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="#" /> <link rel="index" title="Index" href="#" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
@@ -60,6 +59,8 @@
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.asoundlib_version">asoundlib_version() (in module alsaaudio)</a> <li><a href="libalsaaudio.html#alsaaudio.asoundlib_version">asoundlib_version() (in module alsaaudio)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.avail">avail() (alsaaudio.PCM method)</a>
</li> </li>
</ul></td> </ul></td>
</tr></table> </tr></table>
@@ -137,7 +138,7 @@
<h2 id="I">I</h2> <h2 id="I">I</h2>
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.PCM.info">info() (alsaaudio.PCM method)</a>, <a href="libalsaaudio.html#id0">[1]</a> <li><a href="libalsaaudio.html#alsaaudio.PCM.info">info() (alsaaudio.PCM method)</a>
</li> </li>
</ul></td> </ul></td>
</tr></table> </tr></table>
@@ -169,15 +170,13 @@
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.PCM.pause">pause() (alsaaudio.PCM method)</a> <li><a href="libalsaaudio.html#alsaaudio.PCM.pause">pause() (alsaaudio.PCM method)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.PCM">PCM (class in alsaaudio)</a>
</li> </li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.pcmmode">pcmmode() (alsaaudio.PCM method)</a> <li><a href="libalsaaudio.html#alsaaudio.PCM.pcmmode">pcmmode() (alsaaudio.PCM method)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.pcms">pcms() (in module alsaaudio)</a>
</li> </li>
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="libalsaaudio.html#alsaaudio.pcms">pcms() (in module alsaaudio)</a>
</li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.pcmtype">pcmtype() (alsaaudio.PCM method)</a> <li><a href="libalsaaudio.html#alsaaudio.PCM.pcmtype">pcmtype() (alsaaudio.PCM method)</a>
</li> </li>
<li><a href="libalsaaudio.html#alsaaudio.Mixer.polldescriptors">polldescriptors() (alsaaudio.Mixer method)</a> <li><a href="libalsaaudio.html#alsaaudio.Mixer.polldescriptors">polldescriptors() (alsaaudio.Mixer method)</a>
@@ -186,6 +185,8 @@
<li><a href="libalsaaudio.html#alsaaudio.PCM.polldescriptors">(alsaaudio.PCM method)</a> <li><a href="libalsaaudio.html#alsaaudio.PCM.polldescriptors">(alsaaudio.PCM method)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="libalsaaudio.html#alsaaudio.PCM.polldescriptors_revents">polldescriptors_revents() (alsaaudio.PCM method)</a>
</li>
</ul></td> </ul></td>
</tr></table> </tr></table>
@@ -252,35 +253,14 @@
</div> </div>
</div> </div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper"><div class="relations">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3> <h3>Related Topics</h3>
<ul> <ul>
<li><a href="index.html">Documentation overview</a><ul> <li><a href="index.html">Documentation overview</a><ul>
</ul></li> </ul></li>
</ul> </ul>
</div> </div>
<div id="searchbox" style="display: none" role="search"> <search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3> <h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper"> <div class="searchformwrapper">
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@@ -288,16 +268,8 @@
<input type="submit" value="Go" /> <input type="submit" value="Go" />
</form> </form>
</div> </div>
</div> </search>
<script>document.getElementById('searchbox').style.display = "block"</script> <script>document.getElementById('searchbox').style.display = "block"</script>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
@@ -306,8 +278,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup. &copy;2017, Lars Immisch & Casper Wilstrup.
| |
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a> Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div> </div>

View File

@@ -1,17 +1,17 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-content_root="./">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>alsaaudio documentation &#8212; alsaaudio documentation 0.10.0 documentation</title> <title>alsaaudio documentation &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js"></script> <script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
<link rel="next" title="Introduction" href="pyalsaaudio.html" /> <link rel="next" title="Introduction" href="pyalsaaudio.html" />
@@ -32,7 +32,7 @@
<div class="body" role="main"> <div class="body" role="main">
<section id="alsaaudio-documentation"> <section id="alsaaudio-documentation">
<h1>alsaaudio documentation<a class="headerlink" href="#alsaaudio-documentation" title="Permalink to this heading"></a></h1> <h1>alsaaudio documentation<a class="headerlink" href="#alsaaudio-documentation" title="Link to this heading"></a></h1>
<div class="toctree-wrapper compound"> <div class="toctree-wrapper compound">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul> <ul>
@@ -58,20 +58,20 @@
</div> </div>
</section> </section>
<section id="download"> <section id="download">
<h1>Download<a class="headerlink" href="#download" title="Permalink to this heading"></a></h1> <h1>Download<a class="headerlink" href="#download" title="Link to this heading"></a></h1>
<ul class="simple"> <ul class="simple">
<li><p><a class="reference external" href="https://pypi.python.org/pypi/pyalsaaudio">Download from pypi</a></p></li> <li><p><a class="reference external" href="https://pypi.python.org/pypi/pyalsaaudio">Download from pypi</a></p></li>
</ul> </ul>
</section> </section>
<section id="github"> <section id="github">
<h1>Github<a class="headerlink" href="#github" title="Permalink to this heading"></a></h1> <h1>Github<a class="headerlink" href="#github" title="Link to this heading"></a></h1>
<ul class="simple"> <ul class="simple">
<li><p><a class="reference external" href="https://github.com/larsimmisch/pyalsaaudio/">Repository</a></p></li> <li><p><a class="reference external" href="https://github.com/larsimmisch/pyalsaaudio/">Repository</a></p></li>
<li><p><a class="reference external" href="https://github.com/larsimmisch/pyalsaaudio/issues">Bug tracker</a></p></li> <li><p><a class="reference external" href="https://github.com/larsimmisch/pyalsaaudio/issues">Bug tracker</a></p></li>
</ul> </ul>
</section> </section>
<section id="indices-and-tables"> <section id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this heading"></a></h1> <h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Link to this heading"></a></h1>
<ul class="simple"> <ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li> <li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li> <li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
@@ -86,27 +86,16 @@
</div> </div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="#">alsaaudio documentation</a></h1> <div>
<h3><a href="#">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">alsaaudio documentation</a></li>
<li><a class="reference internal" href="#download">Download</a></li>
<li><a class="reference internal" href="#github">Github</a></li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul> </ul>
<div class="relations"> </div><div class="relations">
<h3>Related Topics</h3> <h3>Related Topics</h3>
<ul> <ul>
<li><a href="#">Documentation overview</a><ul> <li><a href="#">Documentation overview</a><ul>
@@ -114,7 +103,14 @@
</ul></li> </ul></li>
</ul> </ul>
</div> </div>
<div id="searchbox" style="display: none" role="search"> <div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/index.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3> <h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper"> <div class="searchformwrapper">
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@@ -122,16 +118,8 @@
<input type="submit" value="Go" /> <input type="submit" value="Go" />
</form> </form>
</div> </div>
</div> </search>
<script>document.getElementById('searchbox').style.display = "block"</script> <script>document.getElementById('searchbox').style.display = "block"</script>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
@@ -140,8 +128,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup. &copy;2017, Lars Immisch & Casper Wilstrup.
| |
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a> Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
| |
<a href="_sources/index.rst.txt" <a href="_sources/index.rst.txt"

View File

@@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-content_root="./">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>alsaaudio &#8212; alsaaudio documentation 0.10.0 documentation</title> <title>alsaaudio &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js"></script> <script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> <script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
@@ -33,11 +32,11 @@
<div class="body" role="main"> <div class="body" role="main">
<section id="module-alsaaudio"> <section id="module-alsaaudio">
<span id="alsaaudio"></span><h1><a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><a class="headerlink" href="#module-alsaaudio" title="Permalink to this heading"></a></h1> <span id="alsaaudio"></span><h1><a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><a class="headerlink" href="#module-alsaaudio" title="Link to this heading"></a></h1>
<p>The <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a> module defines functions and classes for using ALSA.</p> <p>The <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a> module defines functions and classes for using ALSA.</p>
<dl class="py function"> <dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.pcms"> <dt class="sig sig-object py" id="alsaaudio.pcms">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">pcms</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.pcms" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">pcms</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.pcms" title="Link to this definition"></a></dt>
<dd><p>List available PCM devices by name.</p> <dd><p>List available PCM devices by name.</p>
<p>Arguments are:</p> <p>Arguments are:</p>
<ul class="simple"> <ul class="simple">
@@ -61,7 +60,7 @@ commandline:</p>
<dl class="py function"> <dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.cards"> <dt class="sig sig-object py" id="alsaaudio.cards">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">cards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.cards" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">cards</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.cards" title="Link to this definition"></a></dt>
<dd><p>List the available ALSA cards by name. This function is only moderately <dd><p>List the available ALSA cards by name. This function is only moderately
useful. If you want to see a list of available PCM devices, use <a class="reference internal" href="#alsaaudio.pcms" title="alsaaudio.pcms"><code class="xref py py-func docutils literal notranslate"><span class="pre">pcms()</span></code></a> useful. If you want to see a list of available PCM devices, use <a class="reference internal" href="#alsaaudio.pcms" title="alsaaudio.pcms"><code class="xref py py-func docutils literal notranslate"><span class="pre">pcms()</span></code></a>
instead.</p> instead.</p>
@@ -69,7 +68,7 @@ instead.</p>
<dl class="py function"> <dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.mixers"> <dt class="sig sig-object py" id="alsaaudio.mixers">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">mixers</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.mixers" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">mixers</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.mixers" title="Link to this definition"></a></dt>
<dd><p>List the available mixers. The arguments are:</p> <dd><p>List the available mixers. The arguments are:</p>
<ul> <ul>
<li><p><em>cardindex</em> - the card index. If this argument is given, the device name <li><p><em>cardindex</em> - the card index. If this argument is given, the device name
@@ -107,20 +106,24 @@ device, not the mixers for the first card.</p></li>
<dl class="py function"> <dl class="py function">
<dt class="sig sig-object py" id="alsaaudio.asoundlib_version"> <dt class="sig sig-object py" id="alsaaudio.asoundlib_version">
<span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">asoundlib_version</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.asoundlib_version" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">asoundlib_version</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#alsaaudio.asoundlib_version" title="Link to this definition"></a></dt>
<dd><p>Return a Python string containing the ALSA version found.</p> <dd><p>Return a Python string containing the ALSA version found.</p>
</dd></dl> </dd></dl>
<section id="pcm-objects"> <section id="pcm-objects">
<span id="id1"></span><h2>PCM Objects<a class="headerlink" href="#pcm-objects" title="Permalink to this heading"></a></h2> <span id="id1"></span><h2>PCM Objects<a class="headerlink" href="#pcm-objects" title="Link to this heading"></a></h2>
<p>PCM objects in <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a> can play or capture (record) PCM <p>PCM objects in <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a> can play or capture (record) PCM
sound through speakers or a microphone. The PCM constructor takes the sound through speakers or a microphone. The PCM constructor takes the
following arguments:</p> following arguments:</p>
<dl class="py class"> <dl class="py class">
<dt class="sig sig-object py" id="alsaaudio.PCM"> <dt class="sig sig-object py">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">PCM</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_NORMAL</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">rate</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">44100</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channels</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">format</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_FORMAT_S16_LE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">periodsize</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">32</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">periods</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM" title="Permalink to this definition"></a></dt> <span class="sig-name descname"><span class="pre">PCM(type:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_PLAYBACK,</span> <span class="pre">mode:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_NORMAL,</span> <span class="pre">rate:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">44100,</span> <span class="pre">channels:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">2,</span></span></dt>
<dd><p>This class is used to represent a PCM device (either for playback and <dt class="sig sig-object py">
recording). The arguments are:</p> <span class="sig-name descname"><span class="pre">format:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_FORMAT_S16_LE,</span> <span class="pre">periodsize:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">32,</span> <span class="pre">periods:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">4,</span></span></dt>
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">device:</span> <span class="pre">str</span> <span class="pre">=</span> <span class="pre">'default',</span> <span class="pre">cardindex:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">-1)</span> <span class="pre">-&gt;</span> <span class="pre">PCM</span></span></dt>
<dd><p>This class is used to represent a PCM device (either for playback or
recording). The constructors arguments are:</p>
<ul class="simple"> <ul class="simple">
<li><p><em>type</em> - can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> <li><p><em>type</em> - can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code>
(default).</p></li> (default).</p></li>
@@ -237,7 +240,14 @@ the <cite>device</cite> keyword argument is ignored.
<p><strong>Note:</strong> This should not be used, as it bypasses most of ALSAs configuration.</p> <p><strong>Note:</strong> This should not be used, as it bypasses most of ALSAs configuration.</p>
</li> </li>
</ul> </ul>
<p>This will construct a PCM object with the given settings.</p> <p>The defaults mentioned above are values passed by :mod:alsaaudio
to ALSA, not anything internal to ALSA.</p>
<p><strong>Note:</strong> For default and non-default values alike, there is no
guarantee that a PCM device supports the requested configuration,
and ALSA may pick realizable values which it believes to be closest
to the request. Therefore, after creating a PCM object, it is
necessary to verify whether its realized configuration is acceptable.
The :func:info method can be used to query it.</p>
<p><em>Changed in 0.10:</em></p> <p><em>Changed in 0.10:</em></p>
<ul class="simple"> <ul class="simple">
<li><p>Added the optional named parameter <cite>periods</cite>.</p></li> <li><p>Added the optional named parameter <cite>periods</cite>.</p></li>
@@ -259,8 +269,19 @@ name of the card. This was always fragile and broke some legitimate usecases.</p
<p>PCM objects have the following methods:</p> <p>PCM objects have the following methods:</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.info"> <dt class="sig sig-object py" id="alsaaudio.PCM.info">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.info" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span></span></span><a class="headerlink" href="#alsaaudio.PCM.info" title="Link to this definition"></a></dt>
<dd><p>The info function returns a dictionary containing the configuration of a PCM device. As ALSA takes into account limitations of the hardware and software devices the configuration achieved might not correspond to the values used during creation. There is therefore a need to check the realised configuration before processing the sound coming from the device or before sending sound to a device. A small subset of parameters can be set, but cannot be queried. These parameters are stored by alsaaudio and returned as they were given by the user, to distinguish them from parameters retrieved from ALSA these parameters have a name prefixed with <strong>“ (call value) “</strong>. Yet another set of properties derives directly from the hardware and can be obtained through ALSA.</p> <dd><p>Returns a dictionary containing the configuration of a PCM device.</p>
<p>A small subset of properties reflects fixed parameters given by the
user, stored within alsaaudio. To distinguish them from properties
retrieved from ALSA when the call is made, they have their name
prefixed with <strong>“ (call value) “</strong>.</p>
<p>Descriptions of properties which can be directly set during PCM object
instantiation carry the prefix “PCM():”, followed by the respective
constructor parameter. Note that due to device limitations, the values
may deviate from those originally requested.</p>
<p>Yet another set of properties cannot be set, and derives directly from
the hardware, possibly depending on other properties. Those properties
descriptions are prefixed with “hw:” below.</p>
<table class="docutils align-default"> <table class="docutils align-default">
<thead> <thead>
<tr class="row-odd"><th class="head"><p>Key</p></th> <tr class="row-odd"><th class="head"><p>Key</p></th>
@@ -362,7 +383,15 @@ name of the card. This was always fragile and broke some legitimate usecases.</p
<td><p>tuple (integer (Hz), integer (Hz))</p></td> <td><p>tuple (integer (Hz), integer (Hz))</p></td>
</tr> </tr>
<tr class="row-odd"><td><p>significant_bits</p></td> <tr class="row-odd"><td><p>significant_bits</p></td>
<td><p><em>significant bits in sample</em></p></td> <td><p><em>significant bits in sample</em> <a class="footnote-reference brackets" href="#tss" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p></td>
<td><p>integer (negative indicates error)</p></td>
</tr>
<tr class="row-even"><td><p>nominal_bits</p></td>
<td><p><em>nominal bits in sample</em> <a class="footnote-reference brackets" href="#tss" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p></td>
<td><p>integer (negative indicates error)</p></td>
</tr>
<tr class="row-odd"><td><p>physical_bits</p></td>
<td><p><em>sample width in bits</em> <a class="footnote-reference brackets" href="#tss" id="id4" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p></td>
<td><p>integer (negative indicates error)</p></td> <td><p>integer (negative indicates error)</p></td>
</tr> </tr>
<tr class="row-even"><td><p>is_batch</p></td> <tr class="row-even"><td><p>is_batch</p></td>
@@ -407,80 +436,82 @@ name of the card. This was always fragile and broke some legitimate usecases.</p
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>The italicized descriptions give a summary of the “full” description as it can be found in the <a class="reference external" href="https://www.alsa-project.org/alsa-doc">ALSA documentation</a>. “hw:”: indicates that the property indicated relates to the hardware. Parameters passed to the PCM object during instantation are prefixed with “PCM():”, they are described there for the keyword argument indicated after “PCM():”.</p> </dd></dl>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="tss" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<span class="backrefs">(<a role="doc-backlink" href="#id2">1</a>,<a role="doc-backlink" href="#id3">2</a>,<a role="doc-backlink" href="#id4">3</a>)</span>
<p>More information in the <a class="reference internal" href="terminology.html#term-sample-size"><span class="std std-ref">terminology section for sample size</span></a></p>
</aside>
</aside>
<blockquote>
<div><p>The italicized descriptions give a summary of the “full” description
as can be found in the
<a class="reference external" href="https://www.alsa-project.org/alsa-doc">ALSA documentation</a>.</p>
<p><em>New in 0.9.1</em></p>
</div></blockquote>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.dumpinfo">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">dumpinfo</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.dumpinfo" title="Link to this definition"></a></dt>
<dd><p>Dumps the PCM objects configured parameters to stdout.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.pcmtype"> <dt class="sig sig-object py" id="alsaaudio.PCM.pcmtype">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmtype</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.pcmtype" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmtype</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.pcmtype" title="Link to this definition"></a></dt>
<dd><p>Returns the type of PCM object. Either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> or <dd><p>Returns the type of PCM object. Either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> or
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code>.</p> <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.pcmmode"> <dt class="sig sig-object py" id="alsaaudio.PCM.pcmmode">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmmode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.pcmmode" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pcmmode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.pcmmode" title="Link to this definition"></a></dt>
<dd><p>Return the mode of the PCM object. One of <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code>, <dd><p>Return the mode of the PCM object. One of <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_ASYNC</span></code>, or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code></p> <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_ASYNC</span></code>, or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code></p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.cardname"> <dt class="sig sig-object py" id="alsaaudio.PCM.cardname">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.cardname" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">string</span></span></span><a class="headerlink" href="#alsaaudio.PCM.cardname" title="Link to this definition"></a></dt>
<dd><p>Return the name of the sound card used by this PCM object.</p> <dd><p>Return the name of the sound card used by this PCM object.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setchannels"> <dt class="sig sig-object py" id="alsaaudio.PCM.setchannels">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setchannels</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nchannels</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setchannels" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setchannels</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nchannels</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setchannels" title="Link to this definition"></a></dt>
<dd><div class="deprecated"> <dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>channels</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p> <p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>channels</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div> </div>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setrate"> <dt class="sig sig-object py" id="alsaaudio.PCM.setrate">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setrate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rate</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setrate" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setrate</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rate</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setrate" title="Link to this definition"></a></dt>
<dd><div class="deprecated"> <dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>rate</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p> <p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>rate</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div> </div>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setformat"> <dt class="sig sig-object py" id="alsaaudio.PCM.setformat">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setformat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">format</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setformat" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setformat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">format</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setformat" title="Link to this definition"></a></dt>
<dd><div class="deprecated"> <dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>format</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p> <p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>format</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div> </div>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.setperiodsize"> <dt class="sig sig-object py" id="alsaaudio.PCM.setperiodsize">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setperiodsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">period</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.setperiodsize" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">setperiodsize</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">period</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.setperiodsize" title="Link to this definition"></a></dt>
<dd><div class="deprecated"> <dd><div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>periodsize</cite> named argument to <a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code></a>.</p> <p><span class="versionmodified deprecated">Deprecated since version 0.9: </span>Use the <cite>periodsize</cite> named argument to <code class="xref py py-func docutils literal notranslate"><span class="pre">PCM()</span></code>.</p>
</div> </div>
</dd></dl> </dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="id0">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">info</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#id0" title="Permalink to this definition"></a></dt>
<dd><p>Returns a dictionary with the PCM objects configured parameters.</p>
<p>Values are retrieved from the ALSA library if they are available;
otherwise they represent those stored by pyalsaaudio, and their keys
are prefixed with (call value) .</p>
<p><em>New in 0.9.1</em></p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.dumpinfo">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">dumpinfo</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.dumpinfo" title="Permalink to this definition"></a></dt>
<dd><p>Dumps the PCM objects configured parameters to stdout.</p>
</dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.state"> <dt class="sig sig-object py" id="alsaaudio.PCM.state">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">state</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.state" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">state</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.state" title="Link to this definition"></a></dt>
<dd><p>Returs the current state of the stream, which can be one of <dd><p>Returs the current state of the stream, which can be one of
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_STATE_OPEN</span></code> (this should not actually happen), <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_STATE_OPEN</span></code> (this should not actually happen),
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_STATE_SETUP</span></code> (after <a class="reference internal" href="#alsaaudio.PCM.drop" title="alsaaudio.PCM.drop"><code class="xref py py-func docutils literal notranslate"><span class="pre">drop()</span></code></a> or <a class="reference internal" href="#alsaaudio.PCM.drain" title="alsaaudio.PCM.drain"><code class="xref py py-func docutils literal notranslate"><span class="pre">drain()</span></code></a>), <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_STATE_SETUP</span></code> (after <a class="reference internal" href="#alsaaudio.PCM.drop" title="alsaaudio.PCM.drop"><code class="xref py py-func docutils literal notranslate"><span class="pre">drop()</span></code></a> or <a class="reference internal" href="#alsaaudio.PCM.drain" title="alsaaudio.PCM.drain"><code class="xref py py-func docutils literal notranslate"><span class="pre">drain()</span></code></a>),
@@ -494,9 +525,22 @@ are prefixed with (call value) .</p>
<p><em>New in 0.10</em></p> <p><em>New in 0.10</em></p>
</dd></dl> </dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.avail">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">avail</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.avail" title="Link to this definition"></a></dt>
<dd><p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects, returns the number of writable
(that is, free) frames in the buffer.</p>
<p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_CAPTURE</span></code> PCM objects, returns the number of readable
(that is, filled) frames in the buffer.</p>
<p>An attempt to read/write more frames than indicated will block (in
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode) or fail and return zero (in
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode).</p>
<p><em>New in 0.11</em></p>
</dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.read"> <dt class="sig sig-object py" id="alsaaudio.PCM.read">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">read</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.read" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">read</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">bytes</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.PCM.read" title="Link to this definition"></a></dt>
<dd><p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode, this function blocks until a full period is <dd><p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode, this function blocks until a full period is
available, and then returns a tuple (length,data) where <em>length</em> is available, and then returns a tuple (length,data) where <em>length</em> is
the number of frames of captured data, and <em>data</em> is the captured the number of frames of captured data, and <em>data</em> is the captured
@@ -505,25 +549,35 @@ periodsize*framesize bytes.</p>
<p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, the call will not block, but will return <p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, the call will not block, but will return
<code class="docutils literal notranslate"><span class="pre">(0,'')</span></code> if no new period has become available since the last <code class="docutils literal notranslate"><span class="pre">(0,'')</span></code> if no new period has become available since the last
call to read.</p> call to read.</p>
<p>In case of an overrun, this function will return a negative size: <code class="xref py py-const docutils literal notranslate"><span class="pre">-EPIPE</span></code>. <p>In case of a buffer overrun, this function will return the negative
This indicates that data was lost, even if the operation itself succeeded. size <code class="xref py py-const docutils literal notranslate"><span class="pre">-EPIPE</span></code>, and no data is read.
Try using a larger periodsize.</p> This indicates that data was lost. To resume capturing, just call read
again, but note that the stream was already corrupted.
To avoid the problem in the future, try using a larger period size
and/or more periods, at the cost of higher latency.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.write"> <dt class="sig sig-object py" id="alsaaudio.PCM.write">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">write</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.write" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">write</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bytes</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.write" title="Link to this definition"></a></dt>
<dd><p>Writes (plays) the sound in data. The length of data <em>must</em> be a <dd><p>Writes (plays) the sound in data. The length of data <em>must</em> be a
multiple of the frame size, and <em>should</em> be exactly the size of a multiple of the frame size, and <em>should</em> be exactly the size of a
period. If less than period size frames are provided, the actual period. If less than period size frames are provided, the actual
playout will not happen until more data is written.</p> playout will not happen until more data is written.</p>
<p>If the device is not in <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, this call will block if <p>If the data was successfully written, the call returns the size of the
the kernel buffer is full, and until enough sound has been played data <em>in frames</em>.</p>
to allow the sound data to be buffered. The call always returns the <p>If the device is not in <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, this call will block
size of the data provided.</p> if the kernel buffer is full, and until enough sound has been played
to allow the sound data to be buffered.</p>
<p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, the call will return immediately, with a <p>In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode, the call will return immediately, with a
return value of zero, if the buffer is full. In this case, the data return value of zero, if the buffer is full. In this case, the data
should be written at a later time.</p> should be written again at a later time.</p>
<p>In case of a buffer underrun, this function will return the negative
size <code class="xref py py-const docutils literal notranslate"><span class="pre">-EPIPE</span></code>, and no data is written.
At this point, the playback was already corrupted. If you want to play
the data nonetheless, call write again with the same data.
To avoid the problem in the future, try using a larger period size
and/or more periods, at the cost of higher latency.</p>
<p>Note that this call completing means only that the samples were buffered <p>Note that this call completing means only that the samples were buffered
in the kernel, and playout will continue afterwards. Make sure that the in the kernel, and playout will continue afterwards. Make sure that the
stream is drained before discarding the PCM handle.</p> stream is drained before discarding the PCM handle.</p>
@@ -531,21 +585,21 @@ stream is drained before discarding the PCM handle.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.pause"> <dt class="sig sig-object py" id="alsaaudio.PCM.pause">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pause</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">enable=True</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.pause" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">pause</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">enable:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">True</span></span></em><span class="optional">]</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.pause" title="Link to this definition"></a></dt>
<dd><p>If <em>enable</em> is <code class="xref py py-const docutils literal notranslate"><span class="pre">True</span></code>, playback or capture is paused. <dd><p>If <em>enable</em> is <code class="xref py py-const docutils literal notranslate"><span class="pre">True</span></code>, playback or capture is paused.
Otherwise, playback/capture is resumed.</p> Otherwise, playback/capture is resumed.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.drop"> <dt class="sig sig-object py" id="alsaaudio.PCM.drop">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drop</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.drop" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drop</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.drop" title="Link to this definition"></a></dt>
<dd><p>Stop the stream and drop residual buffered frames.</p> <dd><p>Stop the stream and drop residual buffered frames.</p>
<p><em>New in 0.9</em></p> <p><em>New in 0.9</em></p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.drain"> <dt class="sig sig-object py" id="alsaaudio.PCM.drain">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drain</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.drain" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">drain</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.drain" title="Link to this definition"></a></dt>
<dd><p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects, play residual buffered frames <dd><p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects, play residual buffered frames
and then stop the stream. In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode, and then stop the stream. In <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode,
this function blocks until all pending playback is drained.</p> this function blocks until all pending playback is drained.</p>
@@ -555,7 +609,7 @@ this function blocks until all pending playback is drained.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.close"> <dt class="sig sig-object py" id="alsaaudio.PCM.close">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.close" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.PCM.close" title="Link to this definition"></a></dt>
<dd><p>Closes the PCM device.</p> <dd><p>Closes the PCM device.</p>
<p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects in <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode, <p>For <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> PCM objects in <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode,
this function blocks until all pending playback is drained.</p> this function blocks until all pending playback is drained.</p>
@@ -563,30 +617,40 @@ this function blocks until all pending playback is drained.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.polldescriptors"> <dt class="sig sig-object py" id="alsaaudio.PCM.polldescriptors">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.polldescriptors" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.PCM.polldescriptors" title="Link to this definition"></a></dt>
<dd><p>Returns a list of tuples of <em>(file descriptor, eventmask)</em> that can be <dd><p>Returns a list of tuples of <em>(file descriptor, eventmask)</em> that can be
used to wait for changes on the PCM with <em>select.poll</em>.</p> used to wait for changes on the PCM with <em>select.poll</em>.</p>
<p>The <em>eventmask</em> value is compatible with <a href="#id3"><span class="problematic" id="id4">`poll.register`__</span></a> in the Python <p>The <em>eventmask</em> value is compatible with <a href="#id6"><span class="problematic" id="id7">`poll.register`__</span></a> in the Python
<code class="xref py py-const docutils literal notranslate"><span class="pre">select</span></code> module.</p> <code class="xref py py-const docutils literal notranslate"><span class="pre">select</span></code> module.</p>
</dd></dl> </dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.polldescriptors_revents">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">polldescriptors_revents</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">descriptors</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.polldescriptors_revents" title="Link to this definition"></a></dt>
<dd><p>Processes the descriptor list returned by <a class="reference internal" href="#alsaaudio.PCM.polldescriptors" title="alsaaudio.PCM.polldescriptors"><code class="xref py py-func docutils literal notranslate"><span class="pre">polldescriptors()</span></code></a> after
using it with <em>select.poll</em>, and returns a single <em>eventmask</em> value that
is meaningful for deciding whether <a class="reference internal" href="#alsaaudio.PCM.read" title="alsaaudio.PCM.read"><code class="xref py py-func docutils literal notranslate"><span class="pre">read()</span></code></a> or <a class="reference internal" href="#alsaaudio.PCM.write" title="alsaaudio.PCM.write"><code class="xref py py-func docutils literal notranslate"><span class="pre">write()</span></code></a> should
be called.</p>
<p><em>New in 0.11</em></p>
</dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.set_tstamp_mode"> <dt class="sig sig-object py" id="alsaaudio.PCM.set_tstamp_mode">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_mode</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">mode=PCM_TSTAMP_ENABLE</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_mode" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_mode</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">mode:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_TSTAMP_ENABLE</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_mode" title="Link to this definition"></a></dt>
<dd><p>Set the ALSA timestamp mode on the device. The mode argument can be set to <dd><p>Set the ALSA timestamp mode on the device. The mode argument can be set to
either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_NONE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_ENABLE</span></code>.</p> either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_NONE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_ENABLE</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.get_tstamp_mode"> <dt class="sig sig-object py" id="alsaaudio.PCM.get_tstamp_mode">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_mode" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_mode</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_mode" title="Link to this definition"></a></dt>
<dd><p>Return the integer value corresponding to the ALSA timestamp mode. The <dd><p>Return the integer value corresponding to the ALSA timestamp mode. The
return value can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_NONE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_ENABLE</span></code>.</p> return value can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_NONE</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_ENABLE</span></code>.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.set_tstamp_type"> <dt class="sig sig-object py" id="alsaaudio.PCM.set_tstamp_type">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_type</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">type=PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_type" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">set_tstamp_type</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="n"><span class="pre">type:</span> <span class="pre">int</span> <span class="pre">=</span> <span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></span></em><span class="optional">]</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.PCM.set_tstamp_type" title="Link to this definition"></a></dt>
<dd><p>Set the ALSA timestamp mode on the device. The type argument <dd><p>Set the ALSA timestamp mode on the device. The type argument
can be set to either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></code>, can be set to either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC_RAW</span></code>.</p> <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC_RAW</span></code>.</p>
@@ -594,7 +658,7 @@ can be set to either <code class="xref py py-const docutils literal notranslate"
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.get_tstamp_type"> <dt class="sig sig-object py" id="alsaaudio.PCM.get_tstamp_type">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_type</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_type" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">get_tstamp_type</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.PCM.get_tstamp_type" title="Link to this definition"></a></dt>
<dd><p>Return the integer value corresponding to the ALSA timestamp type. The <dd><p>Return the integer value corresponding to the ALSA timestamp type. The
return value can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></code>, return value can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_GETTIMEOFDAY</span></code>,
<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC_RAW</span></code>.</p> <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC</span></code> or <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_TSTAMP_TYPE_MONOTONIC_RAW</span></code>.</p>
@@ -602,7 +666,7 @@ return value can be either <code class="xref py py-const docutils literal notran
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.PCM.htimestamp"> <dt class="sig sig-object py" id="alsaaudio.PCM.htimestamp">
<span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">htimestamp</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.PCM.htimestamp" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">PCM.</span></span><span class="sig-name descname"><span class="pre">htimestamp</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.PCM.htimestamp" title="Link to this definition"></a></dt>
<dd><p>Return a Python tuple <em>(seconds, nanoseconds, frames_available_in_buffer)</em>.</p> <dd><p>Return a Python tuple <em>(seconds, nanoseconds, frames_available_in_buffer)</em>.</p>
<p>The type of output is controlled by the tstamp_type, as described in the table below.</p> <p>The type of output is controlled by the tstamp_type, as described in the table below.</p>
<table class="docutils align-default"> <table class="docutils align-default">
@@ -649,7 +713,7 @@ update.</p></td>
<p>The most common reason for problems with playback of PCM audio is that writes <p>The most common reason for problems with playback of PCM audio is that writes
to PCM devices must <em>exactly</em> match the data rate of the device.</p> to PCM devices must <em>exactly</em> match the data rate of the device.</p>
<p>If too little data is written to the device, it will underrun, and <p>If too little data is written to the device, it will underrun, and
ugly clicking sounds will occur. Conversely, of too much data is ugly clicking sounds will occur. Conversely, if too much data is
written to the device, the write function will either block written to the device, the write function will either block
(<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode) or return zero (<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode).</p> (<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NORMAL</span></code> mode) or return zero (<code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_NONBLOCK</span></code> mode).</p>
<p>If your program does nothing but play sound, the best strategy is to put the <p>If your program does nothing but play sound, the best strategy is to put the
@@ -668,11 +732,11 @@ accumulate to quite a lot after a few seconds. Hint: use time.time()
to check how much time has really passed, and add extra writes as nessecary.</p> to check how much time has really passed, and add extra writes as nessecary.</p>
</section> </section>
<section id="mixer-objects"> <section id="mixer-objects">
<span id="id2"></span><h2>Mixer Objects<a class="headerlink" href="#mixer-objects" title="Permalink to this heading"></a></h2> <span id="id5"></span><h2>Mixer Objects<a class="headerlink" href="#mixer-objects" title="Link to this heading"></a></h2>
<p>Mixer objects provides access to the ALSA mixer API.</p> <p>Mixer objects provides access to the ALSA mixer API.</p>
<dl class="py class"> <dl class="py class">
<dt class="sig sig-object py" id="alsaaudio.Mixer"> <dt class="sig sig-object py" id="alsaaudio.Mixer">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">Mixer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">control</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'Master'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer" title="Permalink to this definition"></a></dt> <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">alsaaudio.</span></span><span class="sig-name descname"><span class="pre">Mixer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">control</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'Master'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cardindex</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'default'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#alsaaudio.Mixer" title="alsaaudio.Mixer"><span class="pre">Mixer</span></a></span></span><a class="headerlink" href="#alsaaudio.Mixer" title="Link to this definition"></a></dt>
<dd><p>Arguments are:</p> <dd><p>Arguments are:</p>
<ul class="simple"> <ul class="simple">
<li><p><em>control</em> - specifies which control to manipulate using this mixer <li><p><em>control</em> - specifies which control to manipulate using this mixer
@@ -698,26 +762,26 @@ devices.</p></li>
<p>Mixer objects have the following methods:</p> <p>Mixer objects have the following methods:</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.cardname"> <dt class="sig sig-object py" id="alsaaudio.Mixer.cardname">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.cardname" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">cardname</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.cardname" title="Link to this definition"></a></dt>
<dd><p>Return the name of the sound card used by this Mixer object</p> <dd><p>Return the name of the sound card used by this Mixer object</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.mixer"> <dt class="sig sig-object py" id="alsaaudio.Mixer.mixer">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixer</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.mixer" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixer</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.mixer" title="Link to this definition"></a></dt>
<dd><p>Return the name of the specific mixer controlled by this object, For example <dd><p>Return the name of the specific mixer controlled by this object, For example
<code class="docutils literal notranslate"><span class="pre">'Master'</span></code> or <code class="docutils literal notranslate"><span class="pre">'PCM'</span></code></p> <code class="docutils literal notranslate"><span class="pre">'Master'</span></code> or <code class="docutils literal notranslate"><span class="pre">'PCM'</span></code></p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.mixerid"> <dt class="sig sig-object py" id="alsaaudio.Mixer.mixerid">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixerid</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.mixerid" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">mixerid</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.mixerid" title="Link to this definition"></a></dt>
<dd><p>Return the ID of the ALSA mixer controlled by this object.</p> <dd><p>Return the ID of the ALSA mixer controlled by this object.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.switchcap"> <dt class="sig sig-object py" id="alsaaudio.Mixer.switchcap">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">switchcap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.switchcap" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">switchcap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.switchcap" title="Link to this definition"></a></dt>
<dd><p>Returns a list of the switches which are defined by this specific mixer. <dd><p>Returns a list of the switches which are defined by this specific mixer.
Possible values in this list are:</p> Possible values in this list are:</p>
<table class="docutils align-default"> <table class="docutils align-default">
@@ -756,7 +820,7 @@ Possible values in this list are:</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.volumecap"> <dt class="sig sig-object py" id="alsaaudio.Mixer.volumecap">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">volumecap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.volumecap" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">volumecap</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.volumecap" title="Link to this definition"></a></dt>
<dd><p>Returns a list of the volume control capabilities of this <dd><p>Returns a list of the volume control capabilities of this
mixer. Possible values in the list are:</p> mixer. Possible values in the list are:</p>
<table class="docutils align-default"> <table class="docutils align-default">
@@ -790,7 +854,7 @@ mixer. Possible values in the list are:</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getenum"> <dt class="sig sig-object py" id="alsaaudio.Mixer.getenum">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getenum</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getenum" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getenum</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getenum" title="Link to this definition"></a></dt>
<dd><p>For enumerated controls, return the currently selected item and the list of <dd><p>For enumerated controls, return the currently selected item and the list of
items available.</p> items available.</p>
<p>Returns a tuple <em>(string, list of strings)</em>.</p> <p>Returns a tuple <em>(string, list of strings)</em>.</p>
@@ -816,7 +880,7 @@ control.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setenum"> <dt class="sig sig-object py" id="alsaaudio.Mixer.setenum">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setenum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setenum" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setenum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">index</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setenum" title="Link to this definition"></a></dt>
<dd><p>For enumerated controls, sets the currently selected item. <dd><p>For enumerated controls, sets the currently selected item.
<em>index</em> is an index into the list of available enumerated items returned <em>index</em> is an index into the list of available enumerated items returned
by <a class="reference internal" href="#alsaaudio.Mixer.getenum" title="alsaaudio.Mixer.getenum"><code class="xref py py-func docutils literal notranslate"><span class="pre">getenum()</span></code></a>.</p> by <a class="reference internal" href="#alsaaudio.Mixer.getenum" title="alsaaudio.Mixer.getenum"><code class="xref py py-func docutils literal notranslate"><span class="pre">getenum()</span></code></a>.</p>
@@ -824,7 +888,7 @@ by <a class="reference internal" href="#alsaaudio.Mixer.getenum" title="alsaaudi
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getrange"> <dt class="sig sig-object py" id="alsaaudio.Mixer.getrange">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrange</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">VOLUME_UNITS_RAW</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getrange" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrange</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">VOLUME_UNITS_RAW</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getrange" title="Link to this definition"></a></dt>
<dd><p>Return the volume range of the ALSA mixer controlled by this object. <dd><p>Return the volume range of the ALSA mixer controlled by this object.
The value is a tuple of integers whose meaning is determined by the The value is a tuple of integers whose meaning is determined by the
<em>units</em> argument.</p> <em>units</em> argument.</p>
@@ -838,7 +902,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getvolume"> <dt class="sig sig-object py" id="alsaaudio.Mixer.getvolume">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getvolume" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getvolume" title="Link to this definition"></a></dt>
<dd><p>Returns a list with the current volume settings for each channel. The list <dd><p>Returns a list with the current volume settings for each channel. The list
elements are integers whose meaning is determined by the <em>units</em> argument.</p> elements are integers whose meaning is determined by the <em>units</em> argument.</p>
<p>The optional <em>pcmtype</em> argument can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> or <p>The optional <em>pcmtype</em> argument can be either <code class="xref py py-const docutils literal notranslate"><span class="pre">PCM_PLAYBACK</span></code> or
@@ -851,7 +915,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setvolume"> <dt class="sig sig-object py" id="alsaaudio.Mixer.setvolume">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">volume</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setvolume" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setvolume</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">volume</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pcmtype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">PCM_PLAYBACK</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">VOLUME_UNITS_PERCENTAGE</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setvolume" title="Link to this definition"></a></dt>
<dd><p>Change the current volume settings for this mixer. The <em>volume</em> argument <dd><p>Change the current volume settings for this mixer. The <em>volume</em> argument
is an integer whose meaning is determined by the <em>units</em> argument.</p> is an integer whose meaning is determined by the <em>units</em> argument.</p>
<p>If the optional argument <em>channel</em> is present, the volume is set <p>If the optional argument <em>channel</em> is present, the volume is set
@@ -867,7 +931,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getmute"> <dt class="sig sig-object py" id="alsaaudio.Mixer.getmute">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getmute</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getmute" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getmute</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getmute" title="Link to this definition"></a></dt>
<dd><p>Return a list indicating the current mute setting for each channel. <dd><p>Return a list indicating the current mute setting for each channel.
0 means not muted, 1 means muted.</p> 0 means not muted, 1 means muted.</p>
<p>This method will fail if the mixer has no playback switch capabilities.</p> <p>This method will fail if the mixer has no playback switch capabilities.</p>
@@ -875,7 +939,7 @@ if the mixer has playback channels, otherwise it is <code class="xref py py-cons
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setmute"> <dt class="sig sig-object py" id="alsaaudio.Mixer.setmute">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setmute</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mute</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setmute" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setmute</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mute</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setmute" title="Link to this definition"></a></dt>
<dd><p>Sets the mute flag to a new value. The <em>mute</em> argument is either 0 for not <dd><p>Sets the mute flag to a new value. The <em>mute</em> argument is either 0 for not
muted, or 1 for muted.</p> muted, or 1 for muted.</p>
<p>The optional <em>channel</em> argument controls which channel is <p>The optional <em>channel</em> argument controls which channel is
@@ -885,7 +949,7 @@ muted. The default is to set the mute flag for all channels.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.getrec"> <dt class="sig sig-object py" id="alsaaudio.Mixer.getrec">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrec</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.getrec" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">getrec</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.getrec" title="Link to this definition"></a></dt>
<dd><p>Return a list indicating the current record mute setting for each channel. <dd><p>Return a list indicating the current record mute setting for each channel.
0 means not recording, 1 means recording.</p> 0 means not recording, 1 means recording.</p>
<p>This method will fail if the mixer has no capture switch capabilities.</p> <p>This method will fail if the mixer has no capture switch capabilities.</p>
@@ -893,7 +957,7 @@ muted. The default is to set the mute flag for all channels.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.setrec"> <dt class="sig sig-object py" id="alsaaudio.Mixer.setrec">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setrec</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">capture</span></span></em><span class="optional">[</span>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.setrec" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">setrec</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">capture</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">channel</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.setrec" title="Link to this definition"></a></dt>
<dd><p>Sets the capture mute flag to a new value. The <em>capture</em> argument <dd><p>Sets the capture mute flag to a new value. The <em>capture</em> argument
is either 0 for no capture, or 1 for capture.</p> is either 0 for no capture, or 1 for capture.</p>
<p>The optional <em>channel</em> argument controls which channel is <p>The optional <em>channel</em> argument controls which channel is
@@ -903,16 +967,16 @@ changed. The default is to set the capture flag for all channels.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.polldescriptors"> <dt class="sig sig-object py" id="alsaaudio.Mixer.polldescriptors">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.polldescriptors" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">polldescriptors</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#alsaaudio.Mixer.polldescriptors" title="Link to this definition"></a></dt>
<dd><p>Returns a list of tuples of <em>(file descriptor, eventmask)</em> that can be <dd><p>Returns a list of tuples of <em>(file descriptor, eventmask)</em> that can be
used to wait for changes on the mixer with <em>select.poll</em>.</p> used to wait for changes on the mixer with <em>select.poll</em>.</p>
<p>The <em>eventmask</em> value is compatible with <a href="#id3"><span class="problematic" id="id5">`poll.register`__</span></a> in the Python <p>The <em>eventmask</em> value is compatible with <a href="#id6"><span class="problematic" id="id8">`poll.register`__</span></a> in the Python
<code class="xref py py-const docutils literal notranslate"><span class="pre">select</span></code> module.</p> <code class="xref py py-const docutils literal notranslate"><span class="pre">select</span></code> module.</p>
</dd></dl> </dd></dl>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.handleevents"> <dt class="sig sig-object py" id="alsaaudio.Mixer.handleevents">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">handleevents</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.handleevents" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">handleevents</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">int</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.handleevents" title="Link to this definition"></a></dt>
<dd><p>Acknowledge events on the <a class="reference internal" href="#alsaaudio.Mixer.polldescriptors" title="alsaaudio.Mixer.polldescriptors"><code class="xref py py-func docutils literal notranslate"><span class="pre">polldescriptors()</span></code></a> file descriptors <dd><p>Acknowledge events on the <a class="reference internal" href="#alsaaudio.Mixer.polldescriptors" title="alsaaudio.Mixer.polldescriptors"><code class="xref py py-func docutils literal notranslate"><span class="pre">polldescriptors()</span></code></a> file descriptors
to prevent subsequent polls from returning the same events again. to prevent subsequent polls from returning the same events again.
Returns the number of events that were acknowledged.</p> Returns the number of events that were acknowledged.</p>
@@ -920,7 +984,7 @@ Returns the number of events that were acknowledged.</p>
<dl class="py method"> <dl class="py method">
<dt class="sig sig-object py" id="alsaaudio.Mixer.close"> <dt class="sig sig-object py" id="alsaaudio.Mixer.close">
<span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#alsaaudio.Mixer.close" title="Permalink to this definition"></a></dt> <span class="sig-prename descclassname"><span class="pre">Mixer.</span></span><span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="headerlink" href="#alsaaudio.Mixer.close" title="Link to this definition"></a></dt>
<dd><p>Closes the Mixer device.</p> <dd><p>Closes the Mixer device.</p>
</dd></dl> </dd></dl>
@@ -943,7 +1007,7 @@ understand half of the API, and that which I do understand has come from a
painful trial and error process.</p> painful trial and error process.</p>
</section> </section>
<section id="examples"> <section id="examples">
<span id="pcm-example"></span><h2>Examples<a class="headerlink" href="#examples" title="Permalink to this heading"></a></h2> <span id="pcm-example"></span><h2>Examples<a class="headerlink" href="#examples" title="Link to this heading"></a></h2>
<p>The following example are provided:</p> <p>The following example are provided:</p>
<ul class="simple"> <ul class="simple">
<li><p><cite>playwav.py</cite></p></li> <li><p><cite>playwav.py</cite></p></li>
@@ -967,7 +1031,7 @@ painful trial and error process.</p>
<p>mixertest.py accepts the commandline options <em>-d &lt;device&gt;</em> and <p>mixertest.py accepts the commandline options <em>-d &lt;device&gt;</em> and
<em>-c &lt;cardindex&gt;</em>.</p> <em>-c &lt;cardindex&gt;</em>.</p>
<section id="playwav-py"> <section id="playwav-py">
<h3>playwav.py<a class="headerlink" href="#playwav-py" title="Permalink to this heading"></a></h3> <h3>playwav.py<a class="headerlink" href="#playwav-py" title="Link to this heading"></a></h3>
<p><strong>playwav.py</strong> plays a wav file.</p> <p><strong>playwav.py</strong> plays a wav file.</p>
<p>To test PCM playback (on your default soundcard), run:</p> <p>To test PCM playback (on your default soundcard), run:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python playwav.py &lt;wav file&gt; <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python playwav.py &lt;wav file&gt;
@@ -975,7 +1039,7 @@ painful trial and error process.</p>
</div> </div>
</section> </section>
<section id="recordtest-py-and-playbacktest-py"> <section id="recordtest-py-and-playbacktest-py">
<h3>recordtest.py and playbacktest.py<a class="headerlink" href="#recordtest-py-and-playbacktest-py" title="Permalink to this heading"></a></h3> <h3>recordtest.py and playbacktest.py<a class="headerlink" href="#recordtest-py-and-playbacktest-py" title="Link to this heading"></a></h3>
<p><strong>recordtest.py</strong> and <strong>playbacktest.py</strong> will record and play a raw <p><strong>recordtest.py</strong> and <strong>playbacktest.py</strong> will record and play a raw
sound file in CD quality.</p> sound file in CD quality.</p>
<p>To test PCM recordings (on your default soundcard), run:</p> <p>To test PCM recordings (on your default soundcard), run:</p>
@@ -990,7 +1054,7 @@ with <code class="docutils literal notranslate"><span class="pre">Ctl-C</span></
</div> </div>
</section> </section>
<section id="mixertest-py"> <section id="mixertest-py">
<h3>mixertest.py<a class="headerlink" href="#mixertest-py" title="Permalink to this heading"></a></h3> <h3>mixertest.py<a class="headerlink" href="#mixertest-py" title="Link to this heading"></a></h3>
<p>Without arguments, <strong>mixertest.py</strong> will list all available <em>controls</em> on the <p>Without arguments, <strong>mixertest.py</strong> will list all available <em>controls</em> on the
default soundcard.</p> default soundcard.</p>
<p>The output might look like this:</p> <p>The output might look like this:</p>
@@ -1052,36 +1116,75 @@ Channel 1 volume: 61%
</div> </div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1> <div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><ul>
<li><a class="reference internal" href="#alsaaudio.pcms"><code class="docutils literal notranslate"><span class="pre">pcms()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.cards"><code class="docutils literal notranslate"><span class="pre">cards()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.mixers"><code class="docutils literal notranslate"><span class="pre">mixers()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.asoundlib_version"><code class="docutils literal notranslate"><span class="pre">asoundlib_version()</span></code></a></li>
<li><a class="reference internal" href="#pcm-objects">PCM Objects</a><ul>
<h3>Navigation</h3> <li><a class="reference internal" href="#alsaaudio.PCM.info"><code class="docutils literal notranslate"><span class="pre">PCM.info()</span></code></a></li>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> <li><a class="reference internal" href="#alsaaudio.PCM.dumpinfo"><code class="docutils literal notranslate"><span class="pre">PCM.dumpinfo()</span></code></a></li>
<ul class="current"> <li><a class="reference internal" href="#alsaaudio.PCM.pcmtype"><code class="docutils literal notranslate"><span class="pre">PCM.pcmtype()</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.pcmmode"><code class="docutils literal notranslate"><span class="pre">PCM.pcmmode()</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.cardname"><code class="docutils literal notranslate"><span class="pre">PCM.cardname()</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.setchannels"><code class="docutils literal notranslate"><span class="pre">PCM.setchannels()</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.setrate"><code class="docutils literal notranslate"><span class="pre">PCM.setrate()</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.setformat"><code class="docutils literal notranslate"><span class="pre">PCM.setformat()</span></code></a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a><ul> <li><a class="reference internal" href="#alsaaudio.PCM.setperiodsize"><code class="docutils literal notranslate"><span class="pre">PCM.setperiodsize()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.pcms"><code class="docutils literal notranslate"><span class="pre">pcms()</span></code></a></li> <li><a class="reference internal" href="#alsaaudio.PCM.state"><code class="docutils literal notranslate"><span class="pre">PCM.state()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.cards"><code class="docutils literal notranslate"><span class="pre">cards()</span></code></a></li> <li><a class="reference internal" href="#alsaaudio.PCM.avail"><code class="docutils literal notranslate"><span class="pre">PCM.avail()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.mixers"><code class="docutils literal notranslate"><span class="pre">mixers()</span></code></a></li> <li><a class="reference internal" href="#alsaaudio.PCM.read"><code class="docutils literal notranslate"><span class="pre">PCM.read()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#alsaaudio.asoundlib_version"><code class="docutils literal notranslate"><span class="pre">asoundlib_version()</span></code></a></li> <li><a class="reference internal" href="#alsaaudio.PCM.write"><code class="docutils literal notranslate"><span class="pre">PCM.write()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#pcm-objects">PCM Objects</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.pause"><code class="docutils literal notranslate"><span class="pre">PCM.pause()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#mixer-objects">Mixer Objects</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.drop"><code class="docutils literal notranslate"><span class="pre">PCM.drop()</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="#examples">Examples</a></li> <li><a class="reference internal" href="#alsaaudio.PCM.drain"><code class="docutils literal notranslate"><span class="pre">PCM.drain()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.close"><code class="docutils literal notranslate"><span class="pre">PCM.close()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.polldescriptors"><code class="docutils literal notranslate"><span class="pre">PCM.polldescriptors()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.polldescriptors_revents"><code class="docutils literal notranslate"><span class="pre">PCM.polldescriptors_revents()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.set_tstamp_mode"><code class="docutils literal notranslate"><span class="pre">PCM.set_tstamp_mode()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.get_tstamp_mode"><code class="docutils literal notranslate"><span class="pre">PCM.get_tstamp_mode()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.set_tstamp_type"><code class="docutils literal notranslate"><span class="pre">PCM.set_tstamp_type()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.get_tstamp_type"><code class="docutils literal notranslate"><span class="pre">PCM.get_tstamp_type()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.PCM.htimestamp"><code class="docutils literal notranslate"><span class="pre">PCM.htimestamp()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#mixer-objects">Mixer Objects</a><ul>
<li><a class="reference internal" href="#alsaaudio.Mixer"><code class="docutils literal notranslate"><span class="pre">Mixer</span></code></a><ul>
<li><a class="reference internal" href="#alsaaudio.Mixer.cardname"><code class="docutils literal notranslate"><span class="pre">Mixer.cardname()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.mixer"><code class="docutils literal notranslate"><span class="pre">Mixer.mixer()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.mixerid"><code class="docutils literal notranslate"><span class="pre">Mixer.mixerid()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.switchcap"><code class="docutils literal notranslate"><span class="pre">Mixer.switchcap()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.volumecap"><code class="docutils literal notranslate"><span class="pre">Mixer.volumecap()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getenum"><code class="docutils literal notranslate"><span class="pre">Mixer.getenum()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setenum"><code class="docutils literal notranslate"><span class="pre">Mixer.setenum()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getrange"><code class="docutils literal notranslate"><span class="pre">Mixer.getrange()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getvolume"><code class="docutils literal notranslate"><span class="pre">Mixer.getvolume()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setvolume"><code class="docutils literal notranslate"><span class="pre">Mixer.setvolume()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getmute"><code class="docutils literal notranslate"><span class="pre">Mixer.getmute()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setmute"><code class="docutils literal notranslate"><span class="pre">Mixer.setmute()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.getrec"><code class="docutils literal notranslate"><span class="pre">Mixer.getrec()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.setrec"><code class="docutils literal notranslate"><span class="pre">Mixer.setrec()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.polldescriptors"><code class="docutils literal notranslate"><span class="pre">Mixer.polldescriptors()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.handleevents"><code class="docutils literal notranslate"><span class="pre">Mixer.handleevents()</span></code></a></li>
<li><a class="reference internal" href="#alsaaudio.Mixer.close"><code class="docutils literal notranslate"><span class="pre">Mixer.close()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#examples">Examples</a><ul>
<li><a class="reference internal" href="#playwav-py">playwav.py</a></li>
<li><a class="reference internal" href="#recordtest-py-and-playbacktest-py">recordtest.py and playbacktest.py</a></li>
<li><a class="reference internal" href="#mixertest-py">mixertest.py</a></li>
</ul>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
<div class="relations"> </div><div class="relations">
<h3>Related Topics</h3> <h3>Related Topics</h3>
<ul> <ul>
<li><a href="index.html">Documentation overview</a><ul> <li><a href="index.html">Documentation overview</a><ul>
@@ -1089,7 +1192,14 @@ Channel 1 volume: 61%
</ul></li> </ul></li>
</ul> </ul>
</div> </div>
<div id="searchbox" style="display: none" role="search"> <div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/libalsaaudio.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3> <h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper"> <div class="searchformwrapper">
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@@ -1097,16 +1207,8 @@ Channel 1 volume: 61%
<input type="submit" value="Go" /> <input type="submit" value="Go" />
</form> </form>
</div> </div>
</div> </search>
<script>document.getElementById('searchbox').style.display = "block"</script> <script>document.getElementById('searchbox').style.display = "block"</script>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
@@ -1115,8 +1217,8 @@ Channel 1 volume: 61%
&copy;2017, Lars Immisch & Casper Wilstrup. &copy;2017, Lars Immisch & Casper Wilstrup.
| |
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a> Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
| |
<a href="_sources/libalsaaudio.rst.txt" <a href="_sources/libalsaaudio.rst.txt"

Binary file not shown.

View File

@@ -1,16 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-content_root="./">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Module Index &#8212; alsaaudio documentation 0.10.0 documentation</title> <title>Python Module Index &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js"></script> <script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
@@ -60,35 +59,14 @@
</div> </div>
</div> </div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper"><div class="relations">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3> <h3>Related Topics</h3>
<ul> <ul>
<li><a href="index.html">Documentation overview</a><ul> <li><a href="index.html">Documentation overview</a><ul>
</ul></li> </ul></li>
</ul> </ul>
</div> </div>
<div id="searchbox" style="display: none" role="search"> <search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3> <h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper"> <div class="searchformwrapper">
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@@ -96,16 +74,8 @@
<input type="submit" value="Go" /> <input type="submit" value="Go" />
</form> </form>
</div> </div>
</div> </search>
<script>document.getElementById('searchbox').style.display = "block"</script> <script>document.getElementById('searchbox').style.display = "block"</script>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
@@ -114,8 +84,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup. &copy;2017, Lars Immisch & Casper Wilstrup.
| |
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a> Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div> </div>

View File

@@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-content_root="./">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Introduction &#8212; alsaaudio documentation 0.10.0 documentation</title> <title>Introduction &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js"></script> <script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
<link rel="next" title="PCM Terminology and Concepts" href="terminology.html" /> <link rel="next" title="PCM Terminology and Concepts" href="terminology.html" />
@@ -33,7 +32,7 @@
<div class="body" role="main"> <div class="body" role="main">
<section id="introduction"> <section id="introduction">
<h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to this heading"></a></h1> <h1>Introduction<a class="headerlink" href="#introduction" title="Link to this heading"></a></h1>
<dl class="field-list simple"> <dl class="field-list simple">
<dt class="field-odd">Author<span class="colon">:</span></dt> <dt class="field-odd">Author<span class="colon">:</span></dt>
<dd class="field-odd"><p>Casper Wilstrup &lt;<a class="reference external" href="mailto:cwi&#37;&#52;&#48;aves&#46;dk">cwi<span>&#64;</span>aves<span>&#46;</span>dk</a>&gt;</p> <dd class="field-odd"><p>Casper Wilstrup &lt;<a class="reference external" href="mailto:cwi&#37;&#52;&#48;aves&#46;dk">cwi<span>&#64;</span>aves<span>&#46;</span>dk</a>&gt;</p>
@@ -56,7 +55,7 @@ bugs in this API, and those should be reported to the ALSA team - not me.</p>
</aside> </aside>
</section> </section>
<section id="what-is-alsa"> <section id="what-is-alsa">
<h1>What is ALSA<a class="headerlink" href="#what-is-alsa" title="Permalink to this heading"></a></h1> <h1>What is ALSA<a class="headerlink" href="#what-is-alsa" title="Link to this heading"></a></h1>
<p>The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI <p>The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
functionality to the Linux operating system.</p> functionality to the Linux operating system.</p>
<p>Logically ALSA consists of these components:</p> <p>Logically ALSA consists of these components:</p>
@@ -72,7 +71,7 @@ all ALSA capable applications.</p></li>
<p>More information about ALSA may be found on the project homepage <p>More information about ALSA may be found on the project homepage
<a class="reference external" href="http://www.alsa-project.org">http://www.alsa-project.org</a></p> <a class="reference external" href="http://www.alsa-project.org">http://www.alsa-project.org</a></p>
<section id="alsa-and-python"> <section id="alsa-and-python">
<h2>ALSA and Python<a class="headerlink" href="#alsa-and-python" title="Permalink to this heading"></a></h2> <h2>ALSA and Python<a class="headerlink" href="#alsa-and-python" title="Link to this heading"></a></h2>
<p>The older Linux sound API (OSS) which is now deprecated is well supported <p>The older Linux sound API (OSS) which is now deprecated is well supported
by the standard Python library, through the ossaudiodev module. No native ALSA by the standard Python library, through the ossaudiodev module. No native ALSA
support exists in the standard library.</p> support exists in the standard library.</p>
@@ -89,7 +88,7 @@ appreciated.</p>
</section> </section>
</section> </section>
<section id="installation"> <section id="installation">
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this heading"></a></h1> <h1>Installation<a class="headerlink" href="#installation" title="Link to this heading"></a></h1>
<p>Note: the wrappers link with the alsasound library (from the alsa-lib package) <p>Note: the wrappers link with the alsasound library (from the alsa-lib package)
and need the ALSA headers for compilation. Verify that you have and need the ALSA headers for compilation. Verify that you have
/usr/lib/libasound.so and /usr/include/alsa (or similar paths) before building.</p> /usr/lib/libasound.so and /usr/include/alsa (or similar paths) before building.</p>
@@ -108,7 +107,7 @@ ship with ALSA kernels.</p>
</div> </div>
</section> </section>
<section id="testing"> <section id="testing">
<h1>Testing<a class="headerlink" href="#testing" title="Permalink to this heading"></a></h1> <h1>Testing<a class="headerlink" href="#testing" title="Link to this heading"></a></h1>
<p>Make sure that <code class="code docutils literal notranslate"><span class="pre">aplay</span></code> plays a file through the soundcard you want, then <p>Make sure that <code class="code docutils literal notranslate"><span class="pre">aplay</span></code> plays a file through the soundcard you want, then
try:</p> try:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python playwav.py &lt;filename.wav&gt; <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ python playwav.py &lt;filename.wav&gt;
@@ -143,30 +142,19 @@ a real problem.</p>
</div> </div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1> <div>
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Introduction</a></li>
<li><a class="reference internal" href="#what-is-alsa">What is ALSA</a><ul>
<li><a class="reference internal" href="#alsa-and-python">ALSA and Python</a></li>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="#what-is-alsa">What is ALSA</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#alsa-and-python">ALSA and Python</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a></li> <li><a class="reference internal" href="#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="#testing">Testing</a></li> <li><a class="reference internal" href="#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul> </ul>
<div class="relations"> </div><div class="relations">
<h3>Related Topics</h3> <h3>Related Topics</h3>
<ul> <ul>
<li><a href="index.html">Documentation overview</a><ul> <li><a href="index.html">Documentation overview</a><ul>
@@ -175,7 +163,14 @@ a real problem.</p>
</ul></li> </ul></li>
</ul> </ul>
</div> </div>
<div id="searchbox" style="display: none" role="search"> <div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pyalsaaudio.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3> <h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper"> <div class="searchformwrapper">
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@@ -183,16 +178,8 @@ a real problem.</p>
<input type="submit" value="Go" /> <input type="submit" value="Go" />
</form> </form>
</div> </div>
</div> </search>
<script>document.getElementById('searchbox').style.display = "block"</script> <script>document.getElementById('searchbox').style.display = "block"</script>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
@@ -201,8 +188,8 @@ a real problem.</p>
&copy;2017, Lars Immisch & Casper Wilstrup. &copy;2017, Lars Immisch & Casper Wilstrup.
| |
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a> Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
| |
<a href="_sources/pyalsaaudio.rst.txt" <a href="_sources/pyalsaaudio.rst.txt"

View File

@@ -1,23 +1,23 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-content_root="./">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Search &#8212; alsaaudio documentation 0.10.0 documentation</title> <title>Search &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js"></script> <script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/searchtools.js"></script> <script src="_static/searchtools.js"></script>
<script src="_static/language_data.js"></script> <script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="#" /> <link rel="search" title="Search" href="#" />
<script src="searchindex.js" defer></script> <script src="searchindex.js" defer="defer"></script>
<meta name="robots" content="noindex" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" /> <link rel="stylesheet" href="_static/custom.css" type="text/css" />
@@ -60,10 +60,7 @@
</form> </form>
<div id="search-results"></div>
<div id="search-results">
</div>
</div> </div>
@@ -71,42 +68,13 @@
</div> </div>
</div> </div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper"><div class="relations">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1"><a class="reference internal" href="terminology.html">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3> <h3>Related Topics</h3>
<ul> <ul>
<li><a href="index.html">Documentation overview</a><ul> <li><a href="index.html">Documentation overview</a><ul>
</ul></li> </ul></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
@@ -115,8 +83,8 @@
&copy;2017, Lars Immisch & Casper Wilstrup. &copy;2017, Lars Immisch & Casper Wilstrup.
| |
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a> Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div> </div>

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,16 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" data-content_root="./">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>PCM Terminology and Concepts &#8212; alsaaudio documentation 0.10.0 documentation</title> <title>PCM Terminology and Concepts &#8212; alsaaudio documentation 0.11.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css" /> <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css" /> <link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=cb25574f" />
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/documentation_options.js?v=f3b36f1a"></script>
<script src="_static/doctools.js"></script> <script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js"></script> <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" /> <link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" /> <link rel="search" title="Search" href="search.html" />
<link rel="next" title="alsaaudio" href="libalsaaudio.html" /> <link rel="next" title="alsaaudio" href="libalsaaudio.html" />
@@ -33,7 +32,7 @@
<div class="body" role="main"> <div class="body" role="main">
<section id="pcm-terminology-and-concepts"> <section id="pcm-terminology-and-concepts">
<h1>PCM Terminology and Concepts<a class="headerlink" href="#pcm-terminology-and-concepts" title="Permalink to this heading"></a></h1> <h1>PCM Terminology and Concepts<a class="headerlink" href="#pcm-terminology-and-concepts" title="Link to this heading"></a></h1>
<p>In order to use PCM devices it is useful to be familiar with some concepts and <p>In order to use PCM devices it is useful to be familiar with some concepts and
terminology.</p> terminology.</p>
<dl> <dl>
@@ -101,6 +100,21 @@ each write should contain exactly 32 frames of sound data, and each
read will return either 32 frames of data or nothing at all.</p> read will return either 32 frames of data or nothing at all.</p>
</dd> </dd>
</dl> </dl>
<dl id="term-sample-size">
<dt>Sample size</dt><dd><p>Each sample takes <em>physical_bits</em> of space. <em>nominal_bits</em> tells
how many least significant bits are used. This is the bit depth
in the format name and sometimes called just <em>sample bits</em> or
<em>format width</em>. <em>significant_bits</em> tells how many most significant
bits of the <em>nominal_bits</em> are used by the sample. This can be thought
of as the <em>sample resolution</em>. This is visualized as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">MSB</span> <span class="o">|</span><span class="mi">00000000</span> <span class="n">XXXXXXXX</span> <span class="n">XXXXXXXX</span> <span class="mi">00000000</span><span class="o">|</span> <span class="n">LSB</span>
<span class="o">|--</span><span class="n">significant</span><span class="o">--|</span>
<span class="o">|---------</span><span class="n">nominal</span><span class="o">---------|</span>
<span class="o">|-------------</span><span class="n">physical</span><span class="o">--------------|</span>
</pre></div>
</div>
</dd>
</dl>
<p>Once you understand these concepts, you will be ready to use the PCM API. Read <p>Once you understand these concepts, you will be ready to use the PCM API. Read
on.</p> on.</p>
</section> </section>
@@ -111,28 +125,7 @@ on.</p>
</div> </div>
</div> </div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper"> <div class="sphinxsidebarwrapper"><div class="relations">
<h1 class="logo"><a href="index.html">alsaaudio documentation</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#what-is-alsa">What is ALSA</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="pyalsaaudio.html#testing">Testing</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">PCM Terminology and Concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="libalsaaudio.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">alsaaudio</span></code></a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3> <h3>Related Topics</h3>
<ul> <ul>
<li><a href="index.html">Documentation overview</a><ul> <li><a href="index.html">Documentation overview</a><ul>
@@ -141,7 +134,14 @@ on.</p>
</ul></li> </ul></li>
</ul> </ul>
</div> </div>
<div id="searchbox" style="display: none" role="search"> <div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/terminology.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3> <h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper"> <div class="searchformwrapper">
<form class="search" action="search.html" method="get"> <form class="search" action="search.html" method="get">
@@ -149,16 +149,8 @@ on.</p>
<input type="submit" value="Go" /> <input type="submit" value="Go" />
</form> </form>
</div> </div>
</div> </search>
<script>document.getElementById('searchbox').style.display = "block"</script> <script>document.getElementById('searchbox').style.display = "block"</script>
</div> </div>
</div> </div>
<div class="clearer"></div> <div class="clearer"></div>
@@ -167,8 +159,8 @@ on.</p>
&copy;2017, Lars Immisch & Casper Wilstrup. &copy;2017, Lars Immisch & Casper Wilstrup.
| |
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a> Powered by <a href="http://sphinx-doc.org/">Sphinx 7.3.7</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a> &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
| |
<a href="_sources/terminology.rst.txt" <a href="_sources/terminology.rst.txt"