diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2013-10-11 01:46:50 +0200 |
|---|---|---|
| committer | Stephen Sinclair <sinclair@music.mcgill.ca> | 2013-10-11 01:46:50 +0200 |
| commit | 0876bbd0bad22677b23342c828bc36c3babbed4e (patch) | |
| tree | dbd91a7beefce7da18aa9319df8328945ad66c77 /doc/html/probe.html | |
| parent | 332b0956ae798ea52073fe5b889696a33e0f11f2 (diff) | |
Release 4.0.0 tarball4.0.0
Diffstat (limited to 'doc/html/probe.html')
| -rw-r--r-- | doc/html/probe.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/doc/html/probe.html b/doc/html/probe.html new file mode 100644 index 0000000..245a7c3 --- /dev/null +++ b/doc/html/probe.html @@ -0,0 +1,72 @@ +<HTML> +<HEAD> +<TITLE>The RtAudio Home Page</TITLE> +<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css"> +<LINK REL="SHORTCUT ICON" HREF="http://www.music.mcgill.ca/~gary/favicon.ico"> +</HEAD> +<BODY BGCOLOR="#FFFFFF"> +<CENTER> +<a class="qindex" href="index.html">Home</a> <a class="qindex" href="annotated.html">Class/Enum List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </CENTER> +<HR> +<!-- Generated by Doxygen 1.4.4 --> +<h1><a class="anchor" name="probe">Probing Device Capabilities</a></h1>A programmer may wish to query the available audio device capabilities before deciding which to use. The following example outlines how this can be done.<p> +<div class="fragment"><pre class="fragment"><span class="comment">// probe.cpp</span> + +<span class="preprocessor">#include <iostream></span> +<span class="preprocessor">#include "<a class="code" href="RtAudio_8h.html">RtAudio.h</a>"</span> + +<span class="keywordtype">int</span> main() +{ + <a class="code" href="classRtAudio.html">RtAudio</a> audio; + + <span class="comment">// Determine the number of devices available</span> + <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> devices = audio.<a class="code" href="classRtAudio.html#a3">getDeviceCount</a>(); + + <span class="comment">// Scan through devices for various capabilities</span> + <a class="code" href="structRtAudio_1_1DeviceInfo.html">RtAudio::DeviceInfo</a> info; + <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=1; i<=devices; i++ ) { + + info = audio.<a class="code" href="classRtAudio.html#a4">getDeviceInfo</a>( i ); + + <span class="keywordflow">if</span> ( info.<a class="code" href="structRtAudio_1_1DeviceInfo.html#o0">probed</a> == <span class="keyword">true</span> ) { + <span class="comment">// Print, for example, the maximum number of output channels for each device</span> + std::cout << <span class="stringliteral">"device = "</span> << i; + std::cout << <span class="stringliteral">": maximum output channels = "</span> << info.<a class="code" href="structRtAudio_1_1DeviceInfo.html#o2">outputChannels</a> << <span class="stringliteral">"\n"</span>; + } + } + + <span class="keywordflow">return</span> 0; +} +</pre></div><p> +The <a class="el" href="structRtAudio_1_1DeviceInfo.html">RtAudio::DeviceInfo</a> structure is defined in <a class="el" href="RtAudio_8h.html">RtAudio.h</a> and provides a variety of information useful in assessing the capabilities of a device:<p> +<div class="fragment"><pre class="fragment"> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structRtAudio_1_1DeviceInfo.html">RtAudio::DeviceInfo</a> { + <span class="keywordtype">bool</span> probed; <span class="comment">// true if the device capabilities were successfully probed.</span> + std::string name; <span class="comment">// Character string device identifier.</span> + <span class="keywordtype">int</span> outputChannels; <span class="comment">// Maximum output channels supported by device.</span> + <span class="keywordtype">int</span> inputChannels; <span class="comment">// Maximum input channels supported by device.</span> + <span class="keywordtype">int</span> duplexChannels; <span class="comment">// Maximum simultaneous input/output channels supported by device.</span> + <span class="keywordtype">bool</span> isDefaultOutput; <span class="comment">// true if this is the default output device.</span> + <span class="keywordtype">bool</span> isDefaultInput; <span class="comment">// true if this is the default input device.</span> + std::vector<int> sampleRates; <span class="comment">// Supported sample rates.</span> + <a class="code" href="RtAudio_8h.html#a1">RtAudioFormat</a> nativeFormats; <span class="comment">// Bit mask of supported data formats.</span> + }; +</pre></div><p> +The following data formats are defined and fully supported by <a class="el" href="classRtAudio.html">RtAudio</a>:<p> +<div class="fragment"><pre class="fragment"> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="RtAudio_8h.html#a1">RtAudioFormat</a>; + <span class="keyword">static</span> <span class="keyword">const</span> RtAudioFormat RTAUDIO_SINT8; <span class="comment">// Signed 8-bit integer</span> + <span class="keyword">static</span> <span class="keyword">const</span> RtAudioFormat RTAUDIO_SINT16; <span class="comment">// Signed 16-bit integer</span> + <span class="keyword">static</span> <span class="keyword">const</span> RtAudioFormat RTAUDIO_SINT24; <span class="comment">// Signed 24-bit integer (lower 3 bytes of 32-bit signed integer.)</span> + <span class="keyword">static</span> <span class="keyword">const</span> RtAudioFormat RTAUDIO_SINT32; <span class="comment">// Signed 32-bit integer</span> + <span class="keyword">static</span> <span class="keyword">const</span> RtAudioFormat RTAUDIO_FLOAT32; <span class="comment">// 32-bit float normalized between +/- 1.0</span> + <span class="keyword">static</span> <span class="keyword">const</span> RtAudioFormat RTAUDIO_FLOAT64; <span class="comment">// 64-bit double normalized between +/- 1.0</span> +</pre></div><p> +The <code>nativeFormats</code> member of the <a class="el" href="structRtAudio_1_1DeviceInfo.html">RtAudio::DeviceInfo</a> structure is a bit mask of the above formats which are natively supported by the device. However, <a class="el" href="classRtAudio.html">RtAudio</a> will automatically provide format conversion if a particular format is not natively supported. When the <code>probed</code> member of the <a class="el" href="structRtAudio_1_1DeviceInfo.html">RtAudio::DeviceInfo</a> structure is false, the remaining structure members are undefined and the device is probably unusable.<p> +Some audio devices may require a minimum channel value greater than one. <a class="el" href="classRtAudio.html">RtAudio</a> will provide automatic channel number compensation when the number of channels set by the user is less than that required by the device. Channel compensation is <em>NOT</em> possible when the number of channels set by the user is greater than that supported by the device.<p> +It should be noted that the capabilities reported by a device driver or underlying audio API are not always accurate and/or may be dependent on a combination of device settings. For this reason, <a class="el" href="classRtAudio.html">RtAudio</a> does not rely on the queried values when attempting to open a stream. <HR> + +<table><tr><td><img src="../images/mcgill.gif" width=165></td> + <td>©2001-2007 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> +</table> + +</BODY> +</HTML> |
