Root/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | <!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> <title>SFML - Simple and Fast Multimedia Library</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <!--<link rel='stylesheet' type='text/css' href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>--> <link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" /> </head> <body> <div id="banner-container"> <div id="banner"> <span id="sfml">SFML</span> </div> </div> <div id="content"> <!-- Generated by Doxygen 1.8.2 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.htm"><span>Main Page</span></a></li> <li><a href="modules.htm"><span>Modules</span></a></li> <li class="current"><a href="annotated.htm"><span>Classes</span></a></li> <li><a href="files.htm"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.htm"><span>Class List</span></a></li> <li><a href="classes.htm"><span>Class Index</span></a></li> <li><a href="hierarchy.htm"><span>Class Hierarchy</span></a></li> <li><a href="functions.htm"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1SoundBufferRecorder.htm">SoundBufferRecorder</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="#pub-static-methods">Static Public Member Functions</a> | <a href="#pro-methods">Protected Member Functions</a> | <a href="classsf_1_1SoundBufferRecorder-members.htm">List of all members</a> </div> <div class="headertitle"> <div class="title">sf::SoundBufferRecorder Class Reference<div class="ingroups"><a class="el" href="group__audio.htm">Audio module</a></div></div> </div> </div><!--header--> <div class="contents"> <p>Specialized <a class="el" href="classsf_1_1SoundRecorder.htm" title="Abstract base class for capturing sound data.">SoundRecorder</a> which stores the captured audio data into a sound buffer. <a href="classsf_1_1SoundBufferRecorder.htm#details">More...</a></p> <p><code>#include <<a class="el" href="SoundBufferRecorder_8hpp_source.htm">SoundBufferRecorder.hpp</a>></code></p> <div class="dynheader"> Inheritance diagram for sf::SoundBufferRecorder:</div> <div class="dyncontent"> <div class="center"> <img src="classsf_1_1SoundBufferRecorder.png" usemap="#sf::SoundBufferRecorder_map" alt=""/> <map id="sf::SoundBufferRecorder_map" name="sf::SoundBufferRecorder_map"> <area href="classsf_1_1SoundRecorder.htm" title="Abstract base class for capturing sound data." alt="sf::SoundRecorder" shape="rect" coords="0,0,152,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:a84fd636ad22f434bafe2a7c15a8e5107"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBufferRecorder.htm#a84fd636ad22f434bafe2a7c15a8e5107">getBuffer</a> () const </td></tr> <tr class="memdesc:a84fd636ad22f434bafe2a7c15a8e5107"><td class="mdescLeft"> </td><td class="mdescRight">Get the sound buffer containing the captured audio data. <a href="#a84fd636ad22f434bafe2a7c15a8e5107"></a><br/></td></tr> <tr class="separator:a84fd636ad22f434bafe2a7c15a8e5107"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a777e633114f7221cd7554a6ed486259e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundRecorder.htm#a777e633114f7221cd7554a6ed486259e">start</a> (unsigned int sampleRate=44100)</td></tr> <tr class="memdesc:a777e633114f7221cd7554a6ed486259e"><td class="mdescLeft"> </td><td class="mdescRight">Start the capture. <a href="#a777e633114f7221cd7554a6ed486259e"></a><br/></td></tr> <tr class="separator:a777e633114f7221cd7554a6ed486259e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8d9c8346aa9aa409cfed4a1101159c4c"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundRecorder.htm#a8d9c8346aa9aa409cfed4a1101159c4c">stop</a> ()</td></tr> <tr class="memdesc:a8d9c8346aa9aa409cfed4a1101159c4c"><td class="mdescLeft"> </td><td class="mdescRight">Stop the capture. <a href="#a8d9c8346aa9aa409cfed4a1101159c4c"></a><br/></td></tr> <tr class="separator:a8d9c8346aa9aa409cfed4a1101159c4c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1f3726cbe0a2b2b291b36beea57960d7"><td class="memItemLeft" align="right" valign="top">unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundRecorder.htm#a1f3726cbe0a2b2b291b36beea57960d7">getSampleRate</a> () const </td></tr> <tr class="memdesc:a1f3726cbe0a2b2b291b36beea57960d7"><td class="mdescLeft"> </td><td class="mdescRight">Get the sample rate. <a href="#a1f3726cbe0a2b2b291b36beea57960d7"></a><br/></td></tr> <tr class="separator:a1f3726cbe0a2b2b291b36beea57960d7"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a> Static Public Member Functions</h2></td></tr> <tr class="memitem:aab2bd0fee9e48d6cfd449b1cb078ce5a"><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundRecorder.htm#aab2bd0fee9e48d6cfd449b1cb078ce5a">isAvailable</a> ()</td></tr> <tr class="memdesc:aab2bd0fee9e48d6cfd449b1cb078ce5a"><td class="mdescLeft"> </td><td class="mdescRight">Check if the system supports audio capture. <a href="#aab2bd0fee9e48d6cfd449b1cb078ce5a"></a><br/></td></tr> <tr class="separator:aab2bd0fee9e48d6cfd449b1cb078ce5a"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a> Protected Member Functions</h2></td></tr> <tr class="memitem:a531a7445fc8a48eaf9fc039c83f17c6f"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBufferRecorder.htm#a531a7445fc8a48eaf9fc039c83f17c6f">onStart</a> ()</td></tr> <tr class="memdesc:a531a7445fc8a48eaf9fc039c83f17c6f"><td class="mdescLeft"> </td><td class="mdescRight">Start capturing audio data. <a href="#a531a7445fc8a48eaf9fc039c83f17c6f"></a><br/></td></tr> <tr class="separator:a531a7445fc8a48eaf9fc039c83f17c6f"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a9ceb94de14632ae8c1b78faf603b4767"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBufferRecorder.htm#a9ceb94de14632ae8c1b78faf603b4767">onProcessSamples</a> (const Int16 *samples, std::size_t sampleCount)</td></tr> <tr class="memdesc:a9ceb94de14632ae8c1b78faf603b4767"><td class="mdescLeft"> </td><td class="mdescRight">Process a new chunk of recorded samples. <a href="#a9ceb94de14632ae8c1b78faf603b4767"></a><br/></td></tr> <tr class="separator:a9ceb94de14632ae8c1b78faf603b4767"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ab8e53849312413431873a5869d509f1e"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBufferRecorder.htm#ab8e53849312413431873a5869d509f1e">onStop</a> ()</td></tr> <tr class="memdesc:ab8e53849312413431873a5869d509f1e"><td class="mdescLeft"> </td><td class="mdescRight">Stop capturing audio data. <a href="#ab8e53849312413431873a5869d509f1e"></a><br/></td></tr> <tr class="separator:ab8e53849312413431873a5869d509f1e"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Specialized <a class="el" href="classsf_1_1SoundRecorder.htm" title="Abstract base class for capturing sound data.">SoundRecorder</a> which stores the captured audio data into a sound buffer. </p> <p><a class="el" href="classsf_1_1SoundBufferRecorder.htm" title="Specialized SoundRecorder which stores the captured audio data into a sound buffer.">sf::SoundBufferRecorder</a> allows to access a recorded sound through a <a class="el" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a>, so that it can be played, saved to a file, etc.</p> <p>It has the same simple interface as its base class (<a class="el" href="classsf_1_1SoundRecorder.htm#a777e633114f7221cd7554a6ed486259e" title="Start the capture.">start()</a>, <a class="el" href="classsf_1_1SoundRecorder.htm#a8d9c8346aa9aa409cfed4a1101159c4c" title="Stop the capture.">stop()</a>) and adds a function to retrieve the recorded sound buffer (<a class="el" href="classsf_1_1SoundBufferRecorder.htm#a84fd636ad22f434bafe2a7c15a8e5107" title="Get the sound buffer containing the captured audio data.">getBuffer()</a>).</p> <p>As usual, don't forget to call the <a class="el" href="classsf_1_1SoundRecorder.htm#aab2bd0fee9e48d6cfd449b1cb078ce5a" title="Check if the system supports audio capture.">isAvailable()</a> function before using this class (see <a class="el" href="classsf_1_1SoundRecorder.htm" title="Abstract base class for capturing sound data.">sf::SoundRecorder</a> for more details about this).</p> <p>Usage example: </p> <div class="fragment"><div class="line"><span class="keywordflow">if</span> (<a class="code" href="classsf_1_1SoundRecorder.htm#aab2bd0fee9e48d6cfd449b1cb078ce5a" title="Check if the system supports audio capture.">sf::SoundBufferRecorder::isAvailable</a>())</div> <div class="line">{</div> <div class="line"> <span class="comment">// Record some audio data</span></div> <div class="line"> <a class="code" href="classsf_1_1SoundBufferRecorder.htm" title="Specialized SoundRecorder which stores the captured audio data into a sound buffer.">sf::SoundBufferRecorder</a> recorder;</div> <div class="line"> recorder.<a class="code" href="classsf_1_1SoundRecorder.htm#a777e633114f7221cd7554a6ed486259e" title="Start the capture.">start</a>();</div> <div class="line"> ...</div> <div class="line"> recorder.<a class="code" href="classsf_1_1SoundRecorder.htm#a8d9c8346aa9aa409cfed4a1101159c4c" title="Stop the capture.">stop</a>();</div> <div class="line"></div> <div class="line"> <span class="comment">// Get the buffer containing the captured audio data</span></div> <div class="line"> <span class="keyword">const</span> <a class="code" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a>& buffer = recorder.<a class="code" href="classsf_1_1SoundBufferRecorder.htm#a84fd636ad22f434bafe2a7c15a8e5107" title="Get the sound buffer containing the captured audio data.">getBuffer</a>();</div> <div class="line"></div> <div class="line"> <span class="comment">// Save it to a file (for example...)</span></div> <div class="line"> buffer.<a class="code" href="classsf_1_1SoundBuffer.htm#ab2083dc1a934c64959d9e3f162328a76" title="Save the sound buffer to an audio file.">saveToFile</a>(<span class="stringliteral">"my_record.ogg"</span>);</div> <div class="line">}</div> </div><!-- fragment --><dl class="section see"><dt>See Also</dt><dd><a class="el" href="classsf_1_1SoundRecorder.htm" title="Abstract base class for capturing sound data.">sf::SoundRecorder</a> </dd></dl> <p>Definition at line <a class="el" href="SoundBufferRecorder_8hpp_source.htm#l00044">44</a> of file <a class="el" href="SoundBufferRecorder_8hpp_source.htm">SoundBufferRecorder.hpp</a>.</p> </div><h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="a84fd636ad22f434bafe2a7c15a8e5107"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a>& sf::SoundBufferRecorder::getBuffer </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div><div class="memdoc"> <p>Get the sound buffer containing the captured audio data. </p> <p>The sound buffer is valid only after the capture has ended. This function provides a read-only access to the internal sound buffer, but it can be copied if you need to make any modification to it.</p> <dl class="section return"><dt>Returns</dt><dd>Read-only access to the sound buffer </dd></dl> </div> </div> <a class="anchor" id="a1f3726cbe0a2b2b291b36beea57960d7"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">unsigned int sf::SoundRecorder::getSampleRate </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inherited</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Get the sample rate. </p> <p>The sample rate defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality).</p> <dl class="section return"><dt>Returns</dt><dd>Sample rate, in samples per second </dd></dl> </div> </div> <a class="anchor" id="aab2bd0fee9e48d6cfd449b1cb078ce5a"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">static bool sf::SoundRecorder::isAvailable </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">static</span><span class="mlabel">inherited</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Check if the system supports audio capture. </p> <p>This function should always be called before using the audio capture features. If it returns false, then any attempt to use <a class="el" href="classsf_1_1SoundRecorder.htm" title="Abstract base class for capturing sound data.">sf::SoundRecorder</a> or one of its derived classes will fail.</p> <dl class="section return"><dt>Returns</dt><dd>True if audio capture is supported, false otherwise </dd></dl> </div> </div> <a class="anchor" id="a9ceb94de14632ae8c1b78faf603b4767"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual bool sf::SoundBufferRecorder::onProcessSamples </td> <td>(</td> <td class="paramtype">const Int16 * </td> <td class="paramname"><em>samples</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">std::size_t </td> <td class="paramname"><em>sampleCount</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Process a new chunk of recorded samples. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">samples</td><td>Pointer to the new chunk of recorded samples </td></tr> <tr><td class="paramname">sampleCount</td><td>Number of samples pointed by <em>samples</em> </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>True to continue the capture, or false to stop it </dd></dl> <p>Implements <a class="el" href="classsf_1_1SoundRecorder.htm#a2670124cbe7a87c7e46b4840807f4fd7">sf::SoundRecorder</a>.</p> </div> </div> <a class="anchor" id="a531a7445fc8a48eaf9fc039c83f17c6f"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual bool sf::SoundBufferRecorder::onStart </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Start capturing audio data. </p> <dl class="section return"><dt>Returns</dt><dd>True to start the capture, or false to abort it </dd></dl> <p>Reimplemented from <a class="el" href="classsf_1_1SoundRecorder.htm#a7af418fb036201d3f85745bef78ce77f">sf::SoundRecorder</a>.</p> </div> </div> <a class="anchor" id="ab8e53849312413431873a5869d509f1e"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual void sf::SoundBufferRecorder::onStop </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Stop capturing audio data. </p> <p>Reimplemented from <a class="el" href="classsf_1_1SoundRecorder.htm#aefc36138ca1e96c658301280e4a31b64">sf::SoundRecorder</a>.</p> </div> </div> <a class="anchor" id="a777e633114f7221cd7554a6ed486259e"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">void sf::SoundRecorder::start </td> <td>(</td> <td class="paramtype">unsigned int </td> <td class="paramname"><em>sampleRate</em> = <code>44100</code></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inherited</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Start the capture. </p> <p>The <em>sampleRate</em> parameter defines the number of audio samples captured per second. The higher, the better the quality (for example, 44100 samples/sec is CD quality). This function uses its own thread so that it doesn't block the rest of the program while the capture runs. Please note that only one capture can happen at the same time.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">sampleRate</td><td>Desired capture rate, in number of samples per second</td></tr> </table> </dd> </dl> <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classsf_1_1SoundRecorder.htm#a8d9c8346aa9aa409cfed4a1101159c4c" title="Stop the capture.">stop</a> </dd></dl> </div> </div> <a class="anchor" id="a8d9c8346aa9aa409cfed4a1101159c4c"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">void sf::SoundRecorder::stop </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inherited</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Stop the capture. </p> <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classsf_1_1SoundRecorder.htm#a777e633114f7221cd7554a6ed486259e" title="Start the capture.">start</a> </dd></dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="SoundBufferRecorder_8hpp_source.htm">SoundBufferRecorder.hpp</a></li> </ul> </div><!-- contents --> </div> <div id="footer-container"> <div id="footer"> Copyright � Laurent Gomila :: Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> :: </div> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-41898676-1', 'srchub.org'); ga('send', 'pageview'); |
Source at commit tip created 11 years 11 months ago. By Nathan Adams, Initial commit |
---|