Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
16KB

  1. <HTML>
  2. <HEAD>
  3. <TITLE>The RtAudio Home Page</TITLE>
  4. <LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
  5. <LINK REL="SHORTCUT ICON" HREF="http://www.music.mcgill.ca/~gary/favicon.ico">
  6. </HEAD>
  7. <BODY BGCOLOR="#FFFFFF">
  8. <CENTER>
  9. <a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="annotated.html">Class/Enum List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </CENTER>
  10. <HR>
  11. <!-- Generated by Doxygen 1.8.2 -->
  12. </div><!-- top -->
  13. <div class="header">
  14. <div class="summary">
  15. <a href="#nested-classes">Classes</a> &#124;
  16. <a href="#typedef-members">Typedefs</a> </div>
  17. <div class="headertitle">
  18. <div class="title">RtAudio.h File Reference</div> </div>
  19. </div><!--header-->
  20. <div class="contents">
  21. <div class="textblock"><code>#include &lt;string&gt;</code><br/>
  22. <code>#include &lt;vector&gt;</code><br/>
  23. <code>#include &quot;RtError.h&quot;</code><br/>
  24. <code>#include &lt;sstream&gt;</code><br/>
  25. </div>
  26. <p><a href="RtAudio_8h_source.html">Go to the source code of this file.</a></p>
  27. <table class="memberdecls">
  28. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
  29. Classes</h2></td></tr>
  30. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classRtAudio.html">RtAudio</a></td></tr>
  31. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Realtime audio i/o C++ classes. <a href="classRtAudio.html#details">More...</a><br/></td></tr>
  32. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  33. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structRtAudio_1_1DeviceInfo.html">RtAudio::DeviceInfo</a></td></tr>
  34. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The public device information structure for returning queried values. <a href="structRtAudio_1_1DeviceInfo.html#details">More...</a><br/></td></tr>
  35. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  36. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structRtAudio_1_1StreamParameters.html">RtAudio::StreamParameters</a></td></tr>
  37. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure for specifying input or ouput stream parameters. <a href="structRtAudio_1_1StreamParameters.html#details">More...</a><br/></td></tr>
  38. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  39. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structRtAudio_1_1StreamOptions.html">RtAudio::StreamOptions</a></td></tr>
  40. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The structure for specifying stream options. <a href="structRtAudio_1_1StreamOptions.html#details">More...</a><br/></td></tr>
  41. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  42. </table><table class="memberdecls">
  43. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
  44. Typedefs</h2></td></tr>
  45. <tr class="memitem:aafca92882d25915560018873221e44b8"><td class="memItemLeft" align="right" valign="top">typedef unsigned long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8">RtAudioFormat</a></td></tr>
  46. <tr class="memdesc:aafca92882d25915560018873221e44b8"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> data format type. <a href="#aafca92882d25915560018873221e44b8"></a><br/></td></tr>
  47. <tr class="separator:aafca92882d25915560018873221e44b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  48. <tr class="memitem:a2c0f59b200dcec4d4e760f9166b29c41"><td class="memItemLeft" align="right" valign="top">typedef unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41">RtAudioStreamFlags</a></td></tr>
  49. <tr class="memdesc:a2c0f59b200dcec4d4e760f9166b29c41"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream option flags. <a href="#a2c0f59b200dcec4d4e760f9166b29c41"></a><br/></td></tr>
  50. <tr class="separator:a2c0f59b200dcec4d4e760f9166b29c41"><td class="memSeparator" colspan="2">&#160;</td></tr>
  51. <tr class="memitem:a80e306d363583da3b0a1b65d9b57c806"><td class="memItemLeft" align="right" valign="top">typedef unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a></td></tr>
  52. <tr class="memdesc:a80e306d363583da3b0a1b65d9b57c806"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream status (over- or underflow) flags. <a href="#a80e306d363583da3b0a1b65d9b57c806"></a><br/></td></tr>
  53. <tr class="separator:a80e306d363583da3b0a1b65d9b57c806"><td class="memSeparator" colspan="2">&#160;</td></tr>
  54. <tr class="memitem:a112c7b7e25a974977f6fc094cef1a31f"><td class="memItemLeft" align="right" valign="top">typedef int(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#a112c7b7e25a974977f6fc094cef1a31f">RtAudioCallback</a> )(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, <a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a> status, void *userData)</td></tr>
  55. <tr class="memdesc:a112c7b7e25a974977f6fc094cef1a31f"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> callback function prototype. <a href="#a112c7b7e25a974977f6fc094cef1a31f"></a><br/></td></tr>
  56. <tr class="separator:a112c7b7e25a974977f6fc094cef1a31f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  57. <tr class="memitem:a2c8c34d284ae138dd29b53375ec9f062"><td class="memItemLeft" align="right" valign="top">typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="RtAudio_8h.html#a2c8c34d284ae138dd29b53375ec9f062">RtAudioErrorCallback</a> )(<a class="el" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac">RtError::Type</a> type, const std::string &amp;errorText)</td></tr>
  58. <tr class="memdesc:a2c8c34d284ae138dd29b53375ec9f062"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> error callback function prototype. <a href="#a2c8c34d284ae138dd29b53375ec9f062"></a><br/></td></tr>
  59. <tr class="separator:a2c8c34d284ae138dd29b53375ec9f062"><td class="memSeparator" colspan="2">&#160;</td></tr>
  60. </table>
  61. <h2 class="groupheader">Typedef Documentation</h2>
  62. <a class="anchor" id="aafca92882d25915560018873221e44b8"></a>
  63. <div class="memitem">
  64. <div class="memproto">
  65. <table class="memname">
  66. <tr>
  67. <td class="memname">typedef unsigned long <a class="el" href="RtAudio_8h.html#aafca92882d25915560018873221e44b8">RtAudioFormat</a></td>
  68. </tr>
  69. </table>
  70. </div><div class="memdoc">
  71. <p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> data format type. </p>
  72. <p>Support for signed integers and floats. Audio data fed to/from an <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream is assumed to ALWAYS be in host byte order. The internal routines will automatically take care of any necessary byte-swapping between the host format and the soundcard. Thus, endian-ness is not a concern in the following format definitions.</p>
  73. <ul>
  74. <li><em>RTAUDIO_SINT8:</em> 8-bit signed integer.</li>
  75. <li><em>RTAUDIO_SINT16:</em> 16-bit signed integer.</li>
  76. <li><em>RTAUDIO_SINT24:</em> 24-bit signed integer.</li>
  77. <li><em>RTAUDIO_SINT32:</em> 32-bit signed integer.</li>
  78. <li><em>RTAUDIO_FLOAT32:</em> Normalized between plus/minus 1.0.</li>
  79. <li><em>RTAUDIO_FLOAT64:</em> Normalized between plus/minus 1.0. </li>
  80. </ul>
  81. </div>
  82. </div>
  83. <a class="anchor" id="a2c0f59b200dcec4d4e760f9166b29c41"></a>
  84. <div class="memitem">
  85. <div class="memproto">
  86. <table class="memname">
  87. <tr>
  88. <td class="memname">typedef unsigned long <a class="el" href="RtAudio_8h.html#a2c0f59b200dcec4d4e760f9166b29c41">RtAudioStreamFlags</a></td>
  89. </tr>
  90. </table>
  91. </div><div class="memdoc">
  92. <p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream option flags. </p>
  93. <p>The following flags can be OR'ed together to allow a client to make changes to the default stream behavior:</p>
  94. <ul>
  95. <li><em>RTAUDIO_NONINTERLEAVED:</em> Use non-interleaved buffers (default = interleaved).</li>
  96. <li><em>RTAUDIO_MINIMIZE_LATENCY:</em> Attempt to set stream parameters for lowest possible latency.</li>
  97. <li><em>RTAUDIO_HOG_DEVICE:</em> Attempt grab device for exclusive use.</li>
  98. <li><em>RTAUDIO_ALSA_USE_DEFAULT:</em> Use the "default" PCM device (ALSA only).</li>
  99. </ul>
  100. <p>By default, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> streams pass and receive audio data from the client in an interleaved format. By passing the RTAUDIO_NONINTERLEAVED flag to the openStream() function, audio data will instead be presented in non-interleaved buffers. In this case, each buffer argument in the RtAudioCallback function will point to a single array of data, with <code>nFrames</code> samples for each channel concatenated back-to-back. For example, the first sample of data for the second channel would be located at index <code>nFrames</code> (assuming the <code>buffer</code> pointer was recast to the correct data type for the stream).</p>
  101. <p>Certain audio APIs offer a number of parameters that influence the I/O latency of a stream. By default, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to set these parameters internally for robust (glitch-free) performance (though some APIs, like Windows Direct Sound, make this difficult). By passing the RTAUDIO_MINIMIZE_LATENCY flag to the openStream() function, internal stream settings will be influenced in an attempt to minimize stream latency, though possibly at the expense of stream performance.</p>
  102. <p>If the RTAUDIO_HOG_DEVICE flag is set, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs.</p>
  103. <p>If the RTAUDIO_SCHEDULE_REALTIME flag is set, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to select realtime scheduling (round-robin) for the callback thread.</p>
  104. <p>If the RTAUDIO_ALSA_USE_DEFAULT flag is set, <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> will attempt to open the "default" PCM device when using the ALSA API. Note that this will override any specified input or output device id. </p>
  105. </div>
  106. </div>
  107. <a class="anchor" id="a80e306d363583da3b0a1b65d9b57c806"></a>
  108. <div class="memitem">
  109. <div class="memproto">
  110. <table class="memname">
  111. <tr>
  112. <td class="memname">typedef unsigned long <a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a></td>
  113. </tr>
  114. </table>
  115. </div><div class="memdoc">
  116. <p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> stream status (over- or underflow) flags. </p>
  117. <p>Notification of a stream over- or underflow is indicated by a non-zero stream <code>status</code> argument in the RtAudioCallback function. The stream status can be one of the following two options, depending on whether the stream is open for output and/or input:</p>
  118. <ul>
  119. <li><em>RTAUDIO_INPUT_OVERFLOW:</em> Input data was discarded because of an overflow condition at the driver.</li>
  120. <li><em>RTAUDIO_OUTPUT_UNDERFLOW:</em> The output buffer ran low, likely producing a break in the output sound. </li>
  121. </ul>
  122. </div>
  123. </div>
  124. <a class="anchor" id="a112c7b7e25a974977f6fc094cef1a31f"></a>
  125. <div class="memitem">
  126. <div class="memproto">
  127. <table class="memname">
  128. <tr>
  129. <td class="memname">typedef int(* RtAudioCallback)(void *outputBuffer, void *inputBuffer, unsigned int nFrames, double streamTime, <a class="el" href="RtAudio_8h.html#a80e306d363583da3b0a1b65d9b57c806">RtAudioStreamStatus</a> status, void *userData)</td>
  130. </tr>
  131. </table>
  132. </div><div class="memdoc">
  133. <p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> callback function prototype. </p>
  134. <p>All <a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> clients must create a function of type RtAudioCallback to read and/or write data from/to the audio stream. When the underlying audio system is ready for new input or output data, this function will be invoked.</p>
  135. <dl class="params"><dt>Parameters</dt><dd>
  136. <table class="params">
  137. <tr><td class="paramname">outputBuffer</td><td>For output (or duplex) streams, the client should write <code>nFrames</code> of audio sample frames into this buffer. This argument should be recast to the datatype specified when the stream was opened. For input-only streams, this argument will be NULL.</td></tr>
  138. <tr><td class="paramname">inputBuffer</td><td>For input (or duplex) streams, this buffer will hold <code>nFrames</code> of input audio sample frames. This argument should be recast to the datatype specified when the stream was opened. For output-only streams, this argument will be NULL.</td></tr>
  139. <tr><td class="paramname">nFrames</td><td>The number of sample frames of input or output data in the buffers. The actual buffer size in bytes is dependent on the data type and number of channels in use.</td></tr>
  140. <tr><td class="paramname">streamTime</td><td>The number of seconds that have elapsed since the stream was started.</td></tr>
  141. <tr><td class="paramname">status</td><td>If non-zero, this argument indicates a data overflow or underflow condition for the stream. The particular condition can be determined by comparison with the RtAudioStreamStatus flags.</td></tr>
  142. <tr><td class="paramname">userData</td><td>A pointer to optional data provided by the client when opening the stream (default = NULL).</td></tr>
  143. </table>
  144. </dd>
  145. </dl>
  146. <p>To continue normal stream operation, the RtAudioCallback function should return a value of zero. To stop the stream and drain the output buffer, the function should return a value of one. To abort the stream immediately, the client should return a value of two. </p>
  147. </div>
  148. </div>
  149. <a class="anchor" id="a2c8c34d284ae138dd29b53375ec9f062"></a>
  150. <div class="memitem">
  151. <div class="memproto">
  152. <table class="memname">
  153. <tr>
  154. <td class="memname">typedef void(* RtAudioErrorCallback)(<a class="el" href="classRtError.html#ab04667aae01bffc354a9ac6bda6903ac">RtError::Type</a> type, const std::string &amp;errorText)</td>
  155. </tr>
  156. </table>
  157. </div><div class="memdoc">
  158. <p><a class="el" href="classRtAudio.html" title="Realtime audio i/o C++ classes.">RtAudio</a> error callback function prototype. </p>
  159. <dl class="params"><dt>Parameters</dt><dd>
  160. <table class="params">
  161. <tr><td class="paramname">type</td><td>Type of error. </td></tr>
  162. <tr><td class="paramname">errorText</td><td>Error description. </td></tr>
  163. </table>
  164. </dd>
  165. </dl>
  166. </div>
  167. </div>
  168. </div><!-- contents -->
  169. <HR>
  170. <table><tr><td><img src="../images/mcgill.gif" width=165></td>
  171. <td>&copy;2001-2013 Gary P. Scavone, McGill University. All Rights Reserved.<br>Maintained by <a href="http://www.music.mcgill.ca/~gary/">Gary P. Scavone</a>.</td></tr>
  172. </table>
  173. </BODY>
  174. </HTML>