Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > main-testing > by-pkgid > 187676b5433787923dfa2cdd6900c6cd > files > 194

lib64pulseaudio-devel-0.9.15-2.0.7mdv2009.1.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>PulseAudio: Volume Control</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1><a class="anchor" name="volume">Volume Control </a></h1><h2><a class="anchor" name="overv_sec">
Overview</a></h2>
Sinks, sources, sink inputs and samples can all have their own volumes. To deal with these, The PulseAudio libray contains a number of functions that ease handling.<p>
The basic volume type in PulseAudio is the <a class="el" href="volume_8h.html#6d671c65284ff2e94d3773c7368a0352">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>
Volumes commonly span between muted (0%), and normal (100%). It is possible to set volumes to higher than 100%, but clipping might occur.<h2><a class="anchor" name="calc_sec">
Calculations</a></h2>
The volumes in PulseAudio are logarithmic 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#d638dfbc737f126e743584665ea8f557" title="Convert a decibel value to a volume.">pa_sw_volume_from_dB()</a> / <a class="el" href="volume_8h.html#297851419c1e994d9fd2cfbb49aa480a" title="Convert a volume to a decibel value.">pa_sw_volume_to_dB()</a> </li>
<li>Linear - <a class="el" href="volume_8h.html#afb4825a03178ee327e55ae0866b7471" title="Convert a linear factor to a volume.">pa_sw_volume_from_linear()</a> / <a class="el" href="volume_8h.html#04da6c4572a758a0244bbfc81d370cfb" title="Convert a volume to a linear factor.">pa_sw_volume_to_linear()</a></li>
</ul>
For simple multiplication, <a class="el" href="volume_8h.html#1ca01f5bd640e7c5b2d3a6dad9093226" title="Multiply two volume specifications, return the result.">pa_sw_volume_multiply()</a> and <a class="el" href="volume_8h.html#6ae924bdad225c405c1e2f40c22b041b" title="Multiply two per-channel volumes and return the result in *dest.">pa_sw_cvolume_multiply()</a> can be used.<p>
Calculations can only be reliably performed on software volumes as it is commonly unknown what scale hardware volumes relate to.<p>
The functions described above are only valid when used with software volumes. Hence it is usually a better idea to treat all volume values as opaque with a range from PA_VOLUME_MUTED (0%) to PA_VOLUME_NORM (100%) and to refrain from any calculations with them.<h2><a class="anchor" name="conv_sec">
Convenience Functions</a></h2>
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 convenienc functions:<p>
<ul>
<li><a class="el" href="volume_8h.html#ba14d00682b29838ef39ca5a9afe8972" title="Return TRUE when the passed cvolume structure is valid, FALSE otherwise.">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#84b52cdbff47aad9c058df783f342b57" title="Return non-zero when *a == *b.">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#2dd140d5c2fadd1d8cb7aa0eace05109" 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#6b8766a2f30420a83457d2e1f0f139b2" 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#0b374bbe16de9ac047fc4e5f6994390c" 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#0777581d85a1d4bf9c831bdacaac51ac" title="Set the volume of all channels to the specified parameter.">pa_cvolume_set()</a> - Set all 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#a2701828c290031c9bca9036f5148c72" title="Set the volume of all channels to PA_VOLUME_NORM.">pa_cvolume_reset()</a> - Set all 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#04805cb4b83ded75deca9c122977d8fb" title="Set the volume of all channels to PA_VOLUME_MUTED.">pa_cvolume_mute()</a> - Set all 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#0f34f2c6d1b4738bf7f11ff06775dc1f" 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#99f2e389f425b888d3a02ade86d7c85f" 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>
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Sep 2 04:18:20 2009 for PulseAudio by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>