blob: 0026cd0e1b1c2c5174d9282c7204bb7393729fca [file] [log] [blame]
<!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.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Oboe: oboe::StabilizedCallback Class Reference</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="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.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">Oboe
&#160;<span id="projectnumber">1.5</span>
</div>
<div id="projectbrief">A library for creating real-time audio apps on Android</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<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&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespaceoboe.html">oboe</a></li><li class="navelem"><a class="el" href="classoboe_1_1_stabilized_callback.html">StabilizedCallback</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classoboe_1_1_stabilized_callback-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">oboe::StabilizedCallback Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
Inheritance diagram for oboe::StabilizedCallback:</div>
<div class="dyncontent">
<div class="center">
<img src="classoboe_1_1_stabilized_callback.png" usemap="#oboe::StabilizedCallback_map" alt=""/>
<map id="oboe::StabilizedCallback_map" name="oboe::StabilizedCallback_map">
<area href="classoboe_1_1_audio_stream_callback.html" alt="oboe::AudioStreamCallback" shape="rect" coords="103,56,300,80"/>
<area href="classoboe_1_1_audio_stream_data_callback.html" alt="oboe::AudioStreamDataCallback" shape="rect" coords="0,0,197,24"/>
<area href="classoboe_1_1_audio_stream_error_callback.html" alt="oboe::AudioStreamErrorCallback" shape="rect" coords="207,0,404,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a2db099d5fcac6fb939f40be16a3abeae"><td class="memItemLeft" align="right" valign="top"><a id="a2db099d5fcac6fb939f40be16a3abeae"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>StabilizedCallback</b> (<a class="el" href="classoboe_1_1_audio_stream_callback.html">AudioStreamCallback</a> *callback)</td></tr>
<tr class="separator:a2db099d5fcac6fb939f40be16a3abeae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad447e12ebf732cf151655c1fbaf58a49"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceoboe.html#af85fc9910a287df6c5df0ed396bb75cd">DataCallbackResult</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoboe_1_1_stabilized_callback.html#ad447e12ebf732cf151655c1fbaf58a49">onAudioReady</a> (<a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *oboeStream, void *audioData, int32_t numFrames) override</td></tr>
<tr class="separator:ad447e12ebf732cf151655c1fbaf58a49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ec0e9fca3181962ab78716bcda83e10"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoboe_1_1_stabilized_callback.html#a7ec0e9fca3181962ab78716bcda83e10">onErrorBeforeClose</a> (<a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *oboeStream, <a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a> error) override</td></tr>
<tr class="separator:a7ec0e9fca3181962ab78716bcda83e10"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af7521da42c4b08a71e6102994f6f41f4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoboe_1_1_stabilized_callback.html#af7521da42c4b08a71e6102994f6f41f4">onErrorAfterClose</a> (<a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *oboeStream, <a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a> error) override</td></tr>
<tr class="separator:af7521da42c4b08a71e6102994f6f41f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_classoboe_1_1_audio_stream_error_callback"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classoboe_1_1_audio_stream_error_callback')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="classoboe_1_1_audio_stream_error_callback.html">oboe::AudioStreamErrorCallback</a></td></tr>
<tr class="memitem:a5ad4b8936746ecbb2160a9389b117fc3 inherit pub_methods_classoboe_1_1_audio_stream_error_callback"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a5ad4b8936746ecbb2160a9389b117fc3">onError</a> (<a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *, <a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>)</td></tr>
<tr class="separator:a5ad4b8936746ecbb2160a9389b117fc3 inherit pub_methods_classoboe_1_1_audio_stream_error_callback"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ad447e12ebf732cf151655c1fbaf58a49"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad447e12ebf732cf151655c1fbaf58a49">&#9670;&nbsp;</a></span>onAudioReady()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespaceoboe.html#af85fc9910a287df6c5df0ed396bb75cd">DataCallbackResult</a> oboe::StabilizedCallback::onAudioReady </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *&#160;</td>
<td class="paramname"><em>audioStream</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&#160;</td>
<td class="paramname"><em>audioData</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t&#160;</td>
<td class="paramname"><em>numFrames</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>A buffer is ready for processing.</p>
<p>For an output stream, this function should render and write numFrames of data in the stream's current data format to the audioData buffer.</p>
<p>For an input stream, this function should read and process numFrames of data from the audioData buffer.</p>
<p>The audio data is passed through the buffer. So do NOT call read() or write() on the stream that is making the callback.</p>
<p>Note that numFrames can vary unless <a class="el" href="classoboe_1_1_audio_stream_builder.html#a3f397821f61eabaeedaf31064c859a54">AudioStreamBuilder::setFramesPerCallback()</a> is called.</p>
<p>Also note that this callback function should be considered a "real-time" function. It must not do anything that could cause an unbounded delay because that can cause the audio to glitch or pop.</p>
<p>These are things the function should NOT do: </p><ul>
<li>
allocate memory using, for example, malloc() or new </li>
<li>
any file operations such as opening, closing, reading or writing </li>
<li>
any network operations such as streaming </li>
<li>
use any mutexes or other synchronization primitives </li>
<li>
sleep </li>
<li>
oboeStream-&gt;stop(), pause(), flush() or close() </li>
<li>
oboeStream-&gt;read() </li>
<li>
oboeStream-&gt;write() </li>
</ul>
<p>The following are OK to call from the data callback: </p><ul>
<li>
oboeStream-&gt;get*() </li>
<li>
<a class="el" href="namespaceoboe.html#af65aaea3c5d82eee6906664d61c094b3">oboe::convertToText()</a> </li>
<li>
oboeStream-&gt;setBufferSizeInFrames() </li>
</ul>
<p>If you need to move data, eg. MIDI commands, in or out of the callback function then we recommend the use of non-blocking techniques such as an atomic FIFO.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr>
<tr><td class="paramname">audioData</td><td>buffer containing input data or a place to put output data </td></tr>
<tr><td class="paramname">numFrames</td><td>number of frames to be processed </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>DataCallbackResult::Continue or DataCallbackResult::Stop </dd></dl>
<p>Implements <a class="el" href="classoboe_1_1_audio_stream_data_callback.html#ad8a3a9f609df5fd3a5d885cbe1b2204d">oboe::AudioStreamDataCallback</a>.</p>
</div>
</div>
<a id="af7521da42c4b08a71e6102994f6f41f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af7521da42c4b08a71e6102994f6f41f4">&#9670;&nbsp;</a></span>onErrorAfterClose()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void oboe::StabilizedCallback::onErrorAfterClose </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *&#160;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>&#160;</td>
<td class="paramname">&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>This will be called when an error occurs on a stream, such as when the stream is disconnected, and if <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a5ad4b8936746ecbb2160a9389b117fc3">onError()</a> returns false (indicating that the error has not already been handled).</p>
<p>The underlying AAudio or OpenSL ES stream will already be stopped AND closed by Oboe. So the underlying stream cannot be referenced. But you can still query most parameters.</p>
<p>This callback could be used to reopen a new stream on another device.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr>
<tr><td class="paramname">error</td><td></td></tr>
</table>
</dd>
</dl>
<p>Reimplemented from <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a76bd3ef3e00396e10c21812003654cfe">oboe::AudioStreamErrorCallback</a>.</p>
</div>
</div>
<a id="a7ec0e9fca3181962ab78716bcda83e10"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7ec0e9fca3181962ab78716bcda83e10">&#9670;&nbsp;</a></span>onErrorBeforeClose()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void oboe::StabilizedCallback::onErrorBeforeClose </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *&#160;</td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>&#160;</td>
<td class="paramname">&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>This will be called when an error occurs on a stream, such as when the stream is disconnected, and if <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a5ad4b8936746ecbb2160a9389b117fc3">onError()</a> returns false (indicating that the error has not already been handled).</p>
<p>Note that this will be called on a thread created by Oboe.</p>
<p>The underlying stream will already be stopped by Oboe but not yet closed. So the stream can be queried.</p>
<p>Do not close or delete the stream in this method because it will be closed after this method returns.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr>
<tr><td class="paramname">error</td><td></td></tr>
</table>
</dd>
</dl>
<p>Reimplemented from <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a4eb1e4916b71d8231e97b19898bc9bf0">oboe::AudioStreamErrorCallback</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/oboe/<a class="el" href="_stabilized_callback_8h_source.html">StabilizedCallback.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>