Current File : //proc/self/root/kunden/kunden/usr/share/doc/pulseaudio-libs-devel/html/volume.html |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PulseAudio: Volume Control</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">PulseAudio
 <span id="projectnumber">15.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('volume.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">Volume Control </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="overv_sec"></a>
Overview</h1>
<p>Sinks, sources, sink inputs, source outputs and samples can all have their own volumes. To deal with these, The PulseAudio library contains a number of functions that ease handling.</p>
<p>The basic volume type in PulseAudio is the <a class="el" href="volume_8h.html#a6d671c65284ff2e94d3773c7368a0352">pa_volume_t</a> type. Most of the time, applications will use the aggregated <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure that can store the volume of all channels at once.</p>
<p>Volumes commonly span between muted (0%), and normal (100%). It is possible to set volumes to higher than 100%, but clipping might occur.</p>
<p>There is no single well-defined meaning attached to the 100% volume for a sink input. In fact, it depends on the server configuration. With flat volumes enabled, it means the maximum volume that the sound hardware is capable of, which is usually so high that you absolutely must not set sink input volume to 100% unless the the user explicitly requests that (note that usually you shouldn't set the volume anyway if the user doesn't explicitly request it, instead, let PulseAudio decide the volume for the sink input). With flat volumes disabled the sink input volume is relative to the sink volume, so 100% sink input volume means that the sink input is played at the current sink volume level. In this case 100% is often a good default volume for a sink input, although you still should let PulseAudio decide the default volume. It is possible to figure out whether flat volume mode is in effect for a given sink by calling <a class="el" href="introspect_8h.html#a446ffde2b8adea89940adcba40be319c" title="Get information about a sink by its name.">pa_context_get_sink_info_by_name()</a>.</p>
<h1><a class="anchor" id="calc_sec"></a>
Calculations</h1>
<p>The volumes in PulseAudio are cubic in nature and applications shouldn't perform calculations with them directly. Instead, they should be converted to and from either dB or a linear scale:</p>
<ul>
<li>dB - <a class="el" href="volume_8h.html#ad638dfbc737f126e743584665ea8f557" title="Convert a decibel value to a volume (amplitude, not power).">pa_sw_volume_from_dB()</a> / <a class="el" href="volume_8h.html#a297851419c1e994d9fd2cfbb49aa480a" title="Convert a volume to a decibel value (amplitude, not power).">pa_sw_volume_to_dB()</a> </li>
<li>Linear - <a class="el" href="volume_8h.html#aafb4825a03178ee327e55ae0866b7471" title="Convert a linear factor to a volume.">pa_sw_volume_from_linear()</a> / <a class="el" href="volume_8h.html#a04da6c4572a758a0244bbfc81d370cfb" title="Convert a volume to a linear factor.">pa_sw_volume_to_linear()</a></li>
</ul>
<p>For simple multiplication, <a class="el" href="volume_8h.html#a1ca01f5bd640e7c5b2d3a6dad9093226" title="Multiply two volume specifications, return the result.">pa_sw_volume_multiply()</a> and <a class="el" href="volume_8h.html#a6ae924bdad225c405c1e2f40c22b041b" title="Multiply two per-channel volumes and return the result in *dest.">pa_sw_cvolume_multiply()</a> can be used.</p>
<p>It's often unknown what scale hardware volumes relate to. Don't use the above functions on sink and source volumes, unless the sink or source in question has the PA_SINK_DECIBEL_VOLUME or PA_SOURCE_DECIBEL_VOLUME flag set. The conversion functions are rarely needed anyway, most of the time it's sufficient to treat all volumes as opaque with a range from PA_VOLUME_MUTED (0%) to PA_VOLUME_NORM (100%).</p>
<h1><a class="anchor" id="conv_sec"></a>
Convenience Functions</h1>
<p>To handle the <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure, the PulseAudio library provides a number of convenience functions:</p>
<ul>
<li><a class="el" href="volume_8h.html#aba14d00682b29838ef39ca5a9afe8972" title="Return non-zero when the passed cvolume structure is valid.">pa_cvolume_valid()</a> - Tests if a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure is valid. </li>
<li><a class="el" href="volume_8h.html#a84b52cdbff47aad9c058df783f342b57" title="Return non-zero when *a == *b, checking that both a and b have the same number of channels and that t...">pa_cvolume_equal()</a> - Tests if two <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structures are identical. </li>
<li><a class="el" href="volume_8h.html#a2dd140d5c2fadd1d8cb7aa0eace05109" title="Return non-zero if the volume of all channels is equal to the specified value.">pa_cvolume_channels_equal_to()</a> - Tests if all channels of a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure have a given volume. </li>
<li><a class="el" href="volume_8h.html#a6b8766a2f30420a83457d2e1f0f139b2" title="Return 1 if the specified volume has all channels muted.">pa_cvolume_is_muted()</a> - Tests if all channels of a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure are muted. </li>
<li><a class="el" href="volume_8h.html#a0b374bbe16de9ac047fc4e5f6994390c" title="Return 1 if the specified volume has all channels on normal level.">pa_cvolume_is_norm()</a> - Tests if all channels of a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure are at a normal volume. </li>
<li><a class="el" href="volume_8h.html#a0777581d85a1d4bf9c831bdacaac51ac" title="Set the volume of the specified number of channels to the volume v.">pa_cvolume_set()</a> - Set the first n channels of a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure to a certain volume. </li>
<li><a class="el" href="volume_8h.html#aa2701828c290031c9bca9036f5148c72" title="Set the volume of the first n channels to PA_VOLUME_NORM.">pa_cvolume_reset()</a> - Set the first n channels of a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure to a normal volume. </li>
<li><a class="el" href="volume_8h.html#a04805cb4b83ded75deca9c122977d8fb" title="Set the volume of the first n channels to PA_VOLUME_MUTED.">pa_cvolume_mute()</a> - Set the first n channels of a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure to a muted volume. </li>
<li><a class="el" href="volume_8h.html#a0f34f2c6d1b4738bf7f11ff06775dc1f" title="Return the average volume of all channels.">pa_cvolume_avg()</a> - Return the average volume of all channels. </li>
<li><a class="el" href="volume_8h.html#a99f2e389f425b888d3a02ade86d7c85f" title="Pretty print a volume structure.">pa_cvolume_snprint()</a> - Pretty print a <a class="el" href="structpa__cvolume.html" title="A structure encapsulating a per-channel volume.">pa_cvolume</a> structure. </li>
</ul>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>