Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > a41e5ac5fb332416cb8019ae392f1f99 > files > 243

lib64pulseaudio-devel-10.0-1.1.mga6.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PulseAudio: Sample Cache</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>
<script type="text/javascript">
  $(document).ready(initResizable);
</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
   &#160;<span id="projectnumber">10.0.0-1.1.mga6</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</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">
$(document).ready(function(){initNavTree('scache.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">Sample Cache </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="overv_sec"></a>
Overview</h1>
<p>The sample cache provides a simple way of overcoming high network latencies and reducing bandwidth. Instead of streaming a sound precisely when it should be played, it is stored on the server and only the command to start playing it needs to be sent.</p>
<h1><a class="anchor" id="create_sec"></a>
Creation</h1>
<p>To create a sample, the normal stream API is used (see <a class="el" href="streams.html">Audio Streams</a>). The function <a class="el" href="scache_8h.html#a4725d83c96ddb3a4c67954bf5ec3a8c1" title="Make this stream a sample upload stream. ">pa_stream_connect_upload()</a> will make sure the stream is stored as a sample on the server.</p>
<p>To complete the upload, <a class="el" href="scache_8h.html#a892d5d35de5ec726b8fa151abd87b92b" title="Finish the sample upload, the stream name will become the sample name. ">pa_stream_finish_upload()</a> is called and the sample will receive the same name as the stream. If the upload should be aborted, simply call <a class="el" href="stream_8h.html#aa4e0c83264f3935911e6b30e6f8ef2b1" title="Disconnect a stream from a source/sink. ">pa_stream_disconnect()</a>.</p>
<h1><a class="anchor" id="play_sec"></a>
Playing samples</h1>
<p>To play back a sample, simply call <a class="el" href="scache_8h.html#adb1bf81ecef03f8bae77e5e3ab30464f" title="Play a sample from the sample cache to the specified device. ">pa_context_play_sample()</a>:</p>
<div class="fragment"><div class="line"><a class="code" href="operation_8h.html#a5614a07f2e7a129e4cb16596ed452a0c">pa_operation</a> *o;</div><div class="line"></div><div class="line">o = <a class="code" href="scache_8h.html#adb1bf81ecef03f8bae77e5e3ab30464f">pa_context_play_sample</a>(my_context,</div><div class="line">                           <span class="stringliteral">&quot;sample2&quot;</span>,       <span class="comment">// Name of my sample</span></div><div class="line">                           NULL,            <span class="comment">// Use default sink</span></div><div class="line">                           <a class="code" href="volume_8h.html#aded56902e68e0f8ab576339bde55960e">PA_VOLUME_NORM</a>,  <span class="comment">// Full volume</span></div><div class="line">                           NULL,            <span class="comment">// Don&#39;t need a callback</span></div><div class="line">                           NULL</div><div class="line">                           );</div><div class="line"><span class="keywordflow">if</span> (o)</div><div class="line">    <a class="code" href="operation_8h.html#a8d2ef9bb2ff961ee31675882bf125227">pa_operation_unref</a>(o);</div></div><!-- fragment --><h1><a class="anchor" id="rem_sec"></a>
Removing samples</h1>
<p>When a sample is no longer needed, it should be removed on the server to save resources. The sample is deleted using <a class="el" href="scache_8h.html#a8c5e594fd912cd5badab7804eae22ba9" title="Remove a sample from the sample cache. ">pa_context_remove_sample()</a>. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="index.html">index</a></li><li class="navelem"><a class="el" href="async.html">Asynchronous API</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>