<!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"/> <title>Async: AsyncAudioDebugger.h Source File</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.6.2-20100208 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_d583404e3b046262ade615a4e7154c3b.html">include</a> </div> </div> <div class="contents"> <h1>AsyncAudioDebugger.h</h1><a href="AsyncAudioDebugger_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00028"></a>00028 <span class="preprocessor">#ifndef AUDIO_DEBUGGER_INCLUDED</span> <a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define AUDIO_DEBUGGER_INCLUDED</span> <a name="l00030"></a>00030 <span class="preprocessor"></span> <a name="l00031"></a>00031 <a name="l00032"></a>00032 <span class="comment">/****************************************************************************</span> <a name="l00033"></a>00033 <span class="comment"> *</span> <a name="l00034"></a>00034 <span class="comment"> * System Includes</span> <a name="l00035"></a>00035 <span class="comment"> *</span> <a name="l00036"></a>00036 <span class="comment"> ****************************************************************************/</span> <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="preprocessor">#include <iostream></span> <a name="l00039"></a>00039 <span class="preprocessor">#include <string></span> <a name="l00040"></a>00040 <a name="l00041"></a>00041 <a name="l00042"></a>00042 <span class="comment">/****************************************************************************</span> <a name="l00043"></a>00043 <span class="comment"> *</span> <a name="l00044"></a>00044 <span class="comment"> * Project Includes</span> <a name="l00045"></a>00045 <span class="comment"> *</span> <a name="l00046"></a>00046 <span class="comment"> ****************************************************************************/</span> <a name="l00047"></a>00047 <a name="l00048"></a>00048 <span class="preprocessor">#include <<a class="code" href="AsyncAudioSink_8h.html" title="This file contains the base class for an audio sink.">AsyncAudioSink.h</a>></span> <a name="l00049"></a>00049 <span class="preprocessor">#include <<a class="code" href="AsyncAudioSource_8h.html" title="This file contains the base class for an audio source.">AsyncAudioSource.h</a>></span> <a name="l00050"></a>00050 <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="comment">/****************************************************************************</span> <a name="l00053"></a>00053 <span class="comment"> *</span> <a name="l00054"></a>00054 <span class="comment"> * Local Includes</span> <a name="l00055"></a>00055 <span class="comment"> *</span> <a name="l00056"></a>00056 <span class="comment"> ****************************************************************************/</span> <a name="l00057"></a>00057 <a name="l00058"></a>00058 <a name="l00059"></a>00059 <a name="l00060"></a>00060 <span class="comment">/****************************************************************************</span> <a name="l00061"></a>00061 <span class="comment"> *</span> <a name="l00062"></a>00062 <span class="comment"> * Forward declarations</span> <a name="l00063"></a>00063 <span class="comment"> *</span> <a name="l00064"></a>00064 <span class="comment"> ****************************************************************************/</span> <a name="l00065"></a>00065 <a name="l00066"></a>00066 <a name="l00067"></a>00067 <a name="l00068"></a>00068 <span class="comment">/****************************************************************************</span> <a name="l00069"></a>00069 <span class="comment"> *</span> <a name="l00070"></a>00070 <span class="comment"> * Namespace</span> <a name="l00071"></a>00071 <span class="comment"> *</span> <a name="l00072"></a>00072 <span class="comment"> ****************************************************************************/</span> <a name="l00073"></a>00073 <a name="l00074"></a>00074 <span class="keyword">namespace </span>Async <a name="l00075"></a>00075 { <a name="l00076"></a>00076 <a name="l00077"></a>00077 <a name="l00078"></a>00078 <span class="comment">/****************************************************************************</span> <a name="l00079"></a>00079 <span class="comment"> *</span> <a name="l00080"></a>00080 <span class="comment"> * Forward declarations of classes inside of the declared namespace</span> <a name="l00081"></a>00081 <span class="comment"> *</span> <a name="l00082"></a>00082 <span class="comment"> ****************************************************************************/</span> <a name="l00083"></a>00083 <a name="l00084"></a>00084 <a name="l00085"></a>00085 <a name="l00086"></a>00086 <span class="comment">/****************************************************************************</span> <a name="l00087"></a>00087 <span class="comment"> *</span> <a name="l00088"></a>00088 <span class="comment"> * Defines & typedefs</span> <a name="l00089"></a>00089 <span class="comment"> *</span> <a name="l00090"></a>00090 <span class="comment"> ****************************************************************************/</span> <a name="l00091"></a>00091 <a name="l00092"></a>00092 <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="comment">/****************************************************************************</span> <a name="l00095"></a>00095 <span class="comment"> *</span> <a name="l00096"></a>00096 <span class="comment"> * Exported Global Variables</span> <a name="l00097"></a>00097 <span class="comment"> *</span> <a name="l00098"></a>00098 <span class="comment"> ****************************************************************************/</span> <a name="l00099"></a>00099 <a name="l00100"></a>00100 <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="comment">/****************************************************************************</span> <a name="l00103"></a>00103 <span class="comment"> *</span> <a name="l00104"></a>00104 <span class="comment"> * Class definitions</span> <a name="l00105"></a>00105 <span class="comment"> *</span> <a name="l00106"></a>00106 <span class="comment"> ****************************************************************************/</span> <a name="l00107"></a>00107 <a name="l00117"></a><a class="code" href="classAsync_1_1AudioDebugger.html">00117</a> <span class="keyword">class </span><a class="code" href="classAsync_1_1AudioDebugger.html" title="This class is used to debug an audio stream.">AudioDebugger</a> : <span class="keyword">public</span> <a class="code" href="classAsync_1_1AudioSink.html" title="The base class for an audio sink.">AudioSink</a>, <span class="keyword">public</span> <a class="code" href="classAsync_1_1AudioSource.html" title="The base class for an audio source.">AudioSource</a> <a name="l00118"></a>00118 { <a name="l00119"></a>00119 <span class="keyword">public</span>: <a name="l00123"></a><a class="code" href="classAsync_1_1AudioDebugger.html#a8fdbbafc75d6bcb539ca53c08e811ce5">00123</a> <a class="code" href="classAsync_1_1AudioDebugger.html#a8fdbbafc75d6bcb539ca53c08e811ce5" title="Default constuctor.">AudioDebugger</a>(<a class="code" href="classAsync_1_1AudioSource.html" title="The base class for an audio source.">Async::AudioSource</a> *src=0) <a name="l00124"></a>00124 : name(<span class="stringliteral">"AudioDebugger"</span>) <a name="l00125"></a>00125 { <a name="l00126"></a>00126 <span class="keywordflow">if</span> (src != 0) <a name="l00127"></a>00127 { <a name="l00128"></a>00128 <a class="code" href="classAsync_1_1AudioSink.html" title="The base class for an audio sink.">Async::AudioSink</a> *<a class="code" href="classAsync_1_1AudioSource.html#a3272e7519e762bcb26b33413db082eac" title="Get the registered audio sink.">sink</a> = src->sink(); <a name="l00129"></a>00129 <span class="keywordflow">if</span> (sink != 0) <a name="l00130"></a>00130 { <a name="l00131"></a>00131 src->unregisterSink(); <a name="l00132"></a>00132 <a class="code" href="classAsync_1_1AudioSource.html#a2254f2e73c5033ee28a569bd205ed345" title="Register an audio sink to provide samples to.">registerSink</a>(sink); <a name="l00133"></a>00133 } <a name="l00134"></a>00134 <a class="code" href="classAsync_1_1AudioSink.html#a355c87f3f763af97de92f5b9ac4b6327" title="Register an audio source to provide samples to this sink.">registerSource</a>(src); <a name="l00135"></a>00135 } <a name="l00136"></a>00136 } <a name="l00137"></a>00137 <a name="l00141"></a><a class="code" href="classAsync_1_1AudioDebugger.html#a696647c2d64b4c61c08413c4ac9ed1c9">00141</a> <span class="keyword">virtual</span> <a class="code" href="classAsync_1_1AudioDebugger.html#a696647c2d64b4c61c08413c4ac9ed1c9" title="Destructor.">~AudioDebugger</a>(<span class="keywordtype">void</span>) {} <a name="l00142"></a>00142 <a name="l00147"></a><a class="code" href="classAsync_1_1AudioDebugger.html#a62057f190705df3e860318e661237266">00147</a> <span class="keywordtype">void</span> <a class="code" href="classAsync_1_1AudioDebugger.html#a62057f190705df3e860318e661237266" title="Set the name that is displayed before debug messages.">setName</a>(std::string debug_name) { name = debug_name; } <a name="l00148"></a>00148 <a name="l00160"></a><a class="code" href="classAsync_1_1AudioDebugger.html#add5fadedaeccb9bbabe0f4997a0f6316">00160</a> <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="classAsync_1_1AudioDebugger.html#add5fadedaeccb9bbabe0f4997a0f6316" title="Write samples into this audio sink.">writeSamples</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> *samples, <span class="keywordtype">int</span> count) <a name="l00161"></a>00161 { <a name="l00162"></a>00162 <span class="keywordtype">int</span> ret = <a class="code" href="classAsync_1_1AudioSource.html#ad23a249abf0f8fd39d364301364740a6">sinkWriteSamples</a>(samples, count); <a name="l00163"></a>00163 std::cout << name << <span class="stringliteral">"::writeSamples: count="</span> << count <a name="l00164"></a>00164 << <span class="stringliteral">" ret="</span> << ret << std::endl; <a name="l00165"></a>00165 <span class="keywordflow">return</span> ret; <a name="l00166"></a>00166 } <a name="l00167"></a>00167 <a name="l00176"></a><a class="code" href="classAsync_1_1AudioDebugger.html#ab9355e40edacee5e4b4c719f8b3835b6">00176</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classAsync_1_1AudioDebugger.html#ab9355e40edacee5e4b4c719f8b3835b6" title="Tell the sink to flush the previously written samples.">flushSamples</a>(<span class="keywordtype">void</span>) <a name="l00177"></a>00177 { <a name="l00178"></a>00178 std::cout << name << <span class="stringliteral">"::flushSamples\n"</span>; <a name="l00179"></a>00179 <a class="code" href="classAsync_1_1AudioSource.html#a5837ec95fef7d668d1c5241cee54646c">sinkFlushSamples</a>(); <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <a name="l00189"></a><a class="code" href="classAsync_1_1AudioDebugger.html#a4a62029f82467d6038b7f54022b189eb">00189</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classAsync_1_1AudioDebugger.html#a4a62029f82467d6038b7f54022b189eb" title="Resume audio output to the sink.">resumeOutput</a>(<span class="keywordtype">void</span>) <a name="l00190"></a>00190 { <a name="l00191"></a>00191 std::cout << name << <span class="stringliteral">"::resumeOutput\n"</span>; <a name="l00192"></a>00192 <a class="code" href="classAsync_1_1AudioSink.html#a4c16d7b78aade12abc0b57ec1db95f62" title="Tell the source that we are ready to accept more samples.">sourceResumeOutput</a>(); <a name="l00193"></a>00193 } <a name="l00194"></a>00194 <a name="l00202"></a><a class="code" href="classAsync_1_1AudioDebugger.html#aa8efeb9d75957a35673454cac5e25d68">00202</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classAsync_1_1AudioDebugger.html#aa8efeb9d75957a35673454cac5e25d68" title="The registered sink has flushed all samples.">allSamplesFlushed</a>(<span class="keywordtype">void</span>) <a name="l00203"></a>00203 { <a name="l00204"></a>00204 std::cout << name << <span class="stringliteral">"::allSamplesFlushed\n"</span>; <a name="l00205"></a>00205 <a class="code" href="classAsync_1_1AudioSink.html#a2548622eb5c52ef80f3bd297f290be3c" title="Tell the source that all samples have been flushed.">sourceAllSamplesFlushed</a>(); <a name="l00206"></a>00206 } <a name="l00207"></a>00207 <a name="l00208"></a>00208 <span class="keyword">protected</span>: <a name="l00209"></a>00209 <a name="l00210"></a>00210 <span class="keyword">private</span>: <a name="l00211"></a>00211 std::string name; <a name="l00212"></a>00212 <a name="l00213"></a>00213 <a class="code" href="classAsync_1_1AudioDebugger.html#a8fdbbafc75d6bcb539ca53c08e811ce5" title="Default constuctor.">AudioDebugger</a>(<span class="keyword">const</span> <a class="code" href="classAsync_1_1AudioDebugger.html" title="This class is used to debug an audio stream.">AudioDebugger</a>&); <a name="l00214"></a>00214 <a class="code" href="classAsync_1_1AudioDebugger.html" title="This class is used to debug an audio stream.">AudioDebugger</a>& operator=(<span class="keyword">const</span> <a class="code" href="classAsync_1_1AudioDebugger.html" title="This class is used to debug an audio stream.">AudioDebugger</a>&); <a name="l00215"></a>00215 <a name="l00216"></a>00216 }; <span class="comment">/* AudioDebugger */</span> <a name="l00217"></a>00217 <a name="l00218"></a>00218 <a name="l00219"></a>00219 } <span class="comment">/* namespace */</span> <a name="l00220"></a>00220 <a name="l00221"></a>00221 <span class="preprocessor">#endif </span><span class="comment">/* AUDIO_DEBUGGER_INCLUDED */</span> <a name="l00222"></a>00222 <a name="l00223"></a>00223 <a name="l00224"></a>00224 <a name="l00225"></a>00225 <span class="comment">/*</span> <a name="l00226"></a>00226 <span class="comment"> * This file has not been truncated</span> <a name="l00227"></a>00227 <span class="comment"> */</span> <a name="l00228"></a>00228 </pre></div></div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>