1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5<meta http-equiv="X-UA-Compatible" content="IE=9"/> 6<meta name="generator" content="Doxygen 1.8.15"/> 7<meta name="viewport" content="width=device-width, initial-scale=1"/> 8<title>Oboe: oboe::StabilizedCallback Class Reference</title> 9<link href="tabs.css" rel="stylesheet" type="text/css"/> 10<script type="text/javascript" src="jquery.js"></script> 11<script type="text/javascript" src="dynsections.js"></script> 12<link href="search/search.css" rel="stylesheet" type="text/css"/> 13<script type="text/javascript" src="search/searchdata.js"></script> 14<script type="text/javascript" src="search/search.js"></script> 15<link href="doxygen.css" rel="stylesheet" type="text/css" /> 16</head> 17<body> 18<div id="top"><!-- do not remove this div, it is closed by doxygen! --> 19<div id="titlearea"> 20<table cellspacing="0" cellpadding="0"> 21 <tbody> 22 <tr style="height: 56px;"> 23 <td id="projectalign" style="padding-left: 0.5em;"> 24 <div id="projectname">Oboe 25  <span id="projectnumber">1.5</span> 26 </div> 27 <div id="projectbrief">A library for creating real-time audio apps on Android</div> 28 </td> 29 </tr> 30 </tbody> 31</table> 32</div> 33<!-- end header part --> 34<!-- Generated by Doxygen 1.8.15 --> 35<script type="text/javascript"> 36/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ 37var searchBox = new SearchBox("searchBox", "search",false,'Search'); 38/* @license-end */ 39</script> 40<script type="text/javascript" src="menudata.js"></script> 41<script type="text/javascript" src="menu.js"></script> 42<script type="text/javascript"> 43/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ 44$(function() { 45 initMenu('',true,false,'search.php','Search'); 46 $(document).ready(function() { init_search(); }); 47}); 48/* @license-end */</script> 49<div id="main-nav"></div> 50<!-- window showing the filter options --> 51<div id="MSearchSelectWindow" 52 onmouseover="return searchBox.OnSearchSelectShow()" 53 onmouseout="return searchBox.OnSearchSelectHide()" 54 onkeydown="return searchBox.OnSearchSelectKey(event)"> 55</div> 56 57<!-- iframe showing the search results (closed by default) --> 58<div id="MSearchResultsWindow"> 59<iframe src="javascript:void(0)" frameborder="0" 60 name="MSearchResults" id="MSearchResults"> 61</iframe> 62</div> 63 64<div id="nav-path" class="navpath"> 65 <ul> 66<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> 67</div> 68</div><!-- top --> 69<div class="header"> 70 <div class="summary"> 71<a href="#pub-methods">Public Member Functions</a> | 72<a href="classoboe_1_1_stabilized_callback-members.html">List of all members</a> </div> 73 <div class="headertitle"> 74<div class="title">oboe::StabilizedCallback Class Reference</div> </div> 75</div><!--header--> 76<div class="contents"> 77<div class="dynheader"> 78Inheritance diagram for oboe::StabilizedCallback:</div> 79<div class="dyncontent"> 80 <div class="center"> 81 <img src="classoboe_1_1_stabilized_callback.png" usemap="#oboe::StabilizedCallback_map" alt=""/> 82 <map id="oboe::StabilizedCallback_map" name="oboe::StabilizedCallback_map"> 83<area href="classoboe_1_1_audio_stream_callback.html" alt="oboe::AudioStreamCallback" shape="rect" coords="103,56,300,80"/> 84<area href="classoboe_1_1_audio_stream_data_callback.html" alt="oboe::AudioStreamDataCallback" shape="rect" coords="0,0,197,24"/> 85<area href="classoboe_1_1_audio_stream_error_callback.html" alt="oboe::AudioStreamErrorCallback" shape="rect" coords="207,0,404,24"/> 86 </map> 87</div></div> 88<table class="memberdecls"> 89<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> 90Public Member Functions</h2></td></tr> 91<tr class="memitem:a2db099d5fcac6fb939f40be16a3abeae"><td class="memItemLeft" align="right" valign="top"><a id="a2db099d5fcac6fb939f40be16a3abeae"></a> 92 </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> 93<tr class="separator:a2db099d5fcac6fb939f40be16a3abeae"><td class="memSeparator" colspan="2"> </td></tr> 94<tr class="memitem:ad447e12ebf732cf151655c1fbaf58a49"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceoboe.html#af85fc9910a287df6c5df0ed396bb75cd">DataCallbackResult</a> </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> 95<tr class="separator:ad447e12ebf732cf151655c1fbaf58a49"><td class="memSeparator" colspan="2"> </td></tr> 96<tr class="memitem:a7ec0e9fca3181962ab78716bcda83e10"><td class="memItemLeft" align="right" valign="top">void </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> 97<tr class="separator:a7ec0e9fca3181962ab78716bcda83e10"><td class="memSeparator" colspan="2"> </td></tr> 98<tr class="memitem:af7521da42c4b08a71e6102994f6f41f4"><td class="memItemLeft" align="right" valign="top">void </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> 99<tr class="separator:af7521da42c4b08a71e6102994f6f41f4"><td class="memSeparator" colspan="2"> </td></tr> 100<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="-"/> Public Member Functions inherited from <a class="el" href="classoboe_1_1_audio_stream_error_callback.html">oboe::AudioStreamErrorCallback</a></td></tr> 101<tr class="memitem:a5ad4b8936746ecbb2160a9389b117fc3 inherit pub_methods_classoboe_1_1_audio_stream_error_callback"><td class="memItemLeft" align="right" valign="top">virtual bool </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> 102<tr class="separator:a5ad4b8936746ecbb2160a9389b117fc3 inherit pub_methods_classoboe_1_1_audio_stream_error_callback"><td class="memSeparator" colspan="2"> </td></tr> 103</table> 104<h2 class="groupheader">Member Function Documentation</h2> 105<a id="ad447e12ebf732cf151655c1fbaf58a49"></a> 106<h2 class="memtitle"><span class="permalink"><a href="#ad447e12ebf732cf151655c1fbaf58a49">◆ </a></span>onAudioReady()</h2> 107 108<div class="memitem"> 109<div class="memproto"> 110<table class="mlabels"> 111 <tr> 112 <td class="mlabels-left"> 113 <table class="memname"> 114 <tr> 115 <td class="memname"><a class="el" href="namespaceoboe.html#af85fc9910a287df6c5df0ed396bb75cd">DataCallbackResult</a> oboe::StabilizedCallback::onAudioReady </td> 116 <td>(</td> 117 <td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> * </td> 118 <td class="paramname"><em>audioStream</em>, </td> 119 </tr> 120 <tr> 121 <td class="paramkey"></td> 122 <td></td> 123 <td class="paramtype">void * </td> 124 <td class="paramname"><em>audioData</em>, </td> 125 </tr> 126 <tr> 127 <td class="paramkey"></td> 128 <td></td> 129 <td class="paramtype">int32_t </td> 130 <td class="paramname"><em>numFrames</em> </td> 131 </tr> 132 <tr> 133 <td></td> 134 <td>)</td> 135 <td></td><td></td> 136 </tr> 137 </table> 138 </td> 139 <td class="mlabels-right"> 140<span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> 141 </tr> 142</table> 143</div><div class="memdoc"> 144<p>A buffer is ready for processing.</p> 145<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> 146<p>For an input stream, this function should read and process numFrames of data from the audioData buffer.</p> 147<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> 148<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> 149<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> 150<p>These are things the function should NOT do: </p><ul> 151<li> 152allocate memory using, for example, malloc() or new </li> 153<li> 154any file operations such as opening, closing, reading or writing </li> 155<li> 156any network operations such as streaming </li> 157<li> 158use any mutexes or other synchronization primitives </li> 159<li> 160sleep </li> 161<li> 162oboeStream->stop(), pause(), flush() or close() </li> 163<li> 164oboeStream->read() </li> 165<li> 166oboeStream->write() </li> 167</ul> 168<p>The following are OK to call from the data callback: </p><ul> 169<li> 170oboeStream->get*() </li> 171<li> 172<a class="el" href="namespaceoboe.html#af65aaea3c5d82eee6906664d61c094b3">oboe::convertToText()</a> </li> 173<li> 174oboeStream->setBufferSizeInFrames() </li> 175</ul> 176<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> 177<dl class="params"><dt>Parameters</dt><dd> 178 <table class="params"> 179 <tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr> 180 <tr><td class="paramname">audioData</td><td>buffer containing input data or a place to put output data </td></tr> 181 <tr><td class="paramname">numFrames</td><td>number of frames to be processed </td></tr> 182 </table> 183 </dd> 184</dl> 185<dl class="section return"><dt>Returns</dt><dd>DataCallbackResult::Continue or DataCallbackResult::Stop </dd></dl> 186 187<p>Implements <a class="el" href="classoboe_1_1_audio_stream_data_callback.html#ad8a3a9f609df5fd3a5d885cbe1b2204d">oboe::AudioStreamDataCallback</a>.</p> 188 189</div> 190</div> 191<a id="af7521da42c4b08a71e6102994f6f41f4"></a> 192<h2 class="memtitle"><span class="permalink"><a href="#af7521da42c4b08a71e6102994f6f41f4">◆ </a></span>onErrorAfterClose()</h2> 193 194<div class="memitem"> 195<div class="memproto"> 196<table class="mlabels"> 197 <tr> 198 <td class="mlabels-left"> 199 <table class="memname"> 200 <tr> 201 <td class="memname">void oboe::StabilizedCallback::onErrorAfterClose </td> 202 <td>(</td> 203 <td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> * </td> 204 <td class="paramname">, </td> 205 </tr> 206 <tr> 207 <td class="paramkey"></td> 208 <td></td> 209 <td class="paramtype"><a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a> </td> 210 <td class="paramname"> </td> 211 </tr> 212 <tr> 213 <td></td> 214 <td>)</td> 215 <td></td><td></td> 216 </tr> 217 </table> 218 </td> 219 <td class="mlabels-right"> 220<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> 221 </tr> 222</table> 223</div><div class="memdoc"> 224<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> 225<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> 226<p>This callback could be used to reopen a new stream on another device.</p> 227<dl class="params"><dt>Parameters</dt><dd> 228 <table class="params"> 229 <tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr> 230 <tr><td class="paramname">error</td><td></td></tr> 231 </table> 232 </dd> 233</dl> 234 235<p>Reimplemented from <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a76bd3ef3e00396e10c21812003654cfe">oboe::AudioStreamErrorCallback</a>.</p> 236 237</div> 238</div> 239<a id="a7ec0e9fca3181962ab78716bcda83e10"></a> 240<h2 class="memtitle"><span class="permalink"><a href="#a7ec0e9fca3181962ab78716bcda83e10">◆ </a></span>onErrorBeforeClose()</h2> 241 242<div class="memitem"> 243<div class="memproto"> 244<table class="mlabels"> 245 <tr> 246 <td class="mlabels-left"> 247 <table class="memname"> 248 <tr> 249 <td class="memname">void oboe::StabilizedCallback::onErrorBeforeClose </td> 250 <td>(</td> 251 <td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> * </td> 252 <td class="paramname">, </td> 253 </tr> 254 <tr> 255 <td class="paramkey"></td> 256 <td></td> 257 <td class="paramtype"><a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a> </td> 258 <td class="paramname"> </td> 259 </tr> 260 <tr> 261 <td></td> 262 <td>)</td> 263 <td></td><td></td> 264 </tr> 265 </table> 266 </td> 267 <td class="mlabels-right"> 268<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> 269 </tr> 270</table> 271</div><div class="memdoc"> 272<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> 273<p>Note that this will be called on a thread created by Oboe.</p> 274<p>The underlying stream will already be stopped by Oboe but not yet closed. So the stream can be queried.</p> 275<p>Do not close or delete the stream in this method because it will be closed after this method returns.</p> 276<dl class="params"><dt>Parameters</dt><dd> 277 <table class="params"> 278 <tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr> 279 <tr><td class="paramname">error</td><td></td></tr> 280 </table> 281 </dd> 282</dl> 283 284<p>Reimplemented from <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a4eb1e4916b71d8231e97b19898bc9bf0">oboe::AudioStreamErrorCallback</a>.</p> 285 286</div> 287</div> 288<hr/>The documentation for this class was generated from the following file:<ul> 289<li>include/oboe/<a class="el" href="_stabilized_callback_8h_source.html">StabilizedCallback.h</a></li> 290</ul> 291</div><!-- contents --> 292<!-- start footer part --> 293<hr class="footer"/><address class="footer"><small> 294Generated by  <a href="http://www.doxygen.org/index.html"> 295<img class="footer" src="doxygen.png" alt="doxygen"/> 296</a> 1.8.15 297</small></address> 298</body> 299</html> 300