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
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QAudioDeviceInfo Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAudioDeviceInfo Class Reference<br /><sup><sup>[<a href="qtmultimedia.html">QtMultimedia</a> module]</sup></sup></h1><p>The QAudioDeviceInfo class provides an interface to query audio
devices and their functionality. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qaudiodeviceinfo.html#QAudioDeviceInfo">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qaudiodeviceinfo.html#QAudioDeviceInfo-2">__init__</a></b> (<i>self</i>, QAudioDeviceInfo <i>other</i>)</li><li><div class="fn" />QString <b><a href="qaudiodeviceinfo.html#deviceName">deviceName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qaudiodeviceinfo.html#isFormatSupported">isFormatSupported</a></b> (<i>self</i>, QAudioFormat <i>format</i>)</li><li><div class="fn" />bool <b><a href="qaudiodeviceinfo.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />QAudioFormat <b><a href="qaudiodeviceinfo.html#nearestFormat">nearestFormat</a></b> (<i>self</i>, QAudioFormat <i>format</i>)</li><li><div class="fn" />QAudioFormat <b><a href="qaudiodeviceinfo.html#preferredFormat">preferredFormat</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#supportedByteOrders">supportedByteOrders</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#supportedChannelCounts">supportedChannelCounts</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#supportedChannels">supportedChannels</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qaudiodeviceinfo.html#supportedCodecs">supportedCodecs</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#supportedFrequencies">supportedFrequencies</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#supportedSampleRates">supportedSampleRates</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#supportedSampleSizes">supportedSampleSizes</a></b> (<i>self</i>)</li><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#supportedSampleTypes">supportedSampleTypes</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />unknown-type <b><a href="qaudiodeviceinfo.html#availableDevices">availableDevices</a></b> (QAudio.Mode <i>mode</i>)</li><li><div class="fn" />QAudioDeviceInfo <b><a href="qaudiodeviceinfo.html#defaultInputDevice">defaultInputDevice</a></b> ()</li><li><div class="fn" />QAudioDeviceInfo <b><a href="qaudiodeviceinfo.html#defaultOutputDevice">defaultOutputDevice</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAudioDeviceInfo class provides an interface to query audio
devices and their functionality.</p>
<p>QAudioDeviceInfo lets you query for audio devices--such as sound
cards and USB headsets--that are currently available on the system.
The audio devices available are dependent on the platform or audio
plugins installed.</p>
<p>You can also query each device for the formats it supports. A
format in this context is a set consisting of a specific byte
order, channel, codec, frequency, sample rate, and sample type. A
format is represented by the <a href="qaudioformat.html">QAudioFormat</a> class.</p>
<p>The values supported by the the device for each of these
parameters can be fetched with <a href="qaudiodeviceinfo.html#supportedByteOrders">supportedByteOrders</a>(),
<a href="qaudiodeviceinfo.html#supportedChannelCounts">supportedChannelCounts</a>(),
<a href="qaudiodeviceinfo.html#supportedCodecs">supportedCodecs</a>(),
<a href="qaudiodeviceinfo.html#supportedSampleRates">supportedSampleRates</a>(),
<a href="qaudiodeviceinfo.html#supportedSampleSizes">supportedSampleSizes</a>(),
and <a href="qaudiodeviceinfo.html#supportedSampleTypes">supportedSampleTypes</a>().
The combinations supported are dependent on the platform, audio
plugins installed and the audio device capabilities. If you need a
specific format, you can check if the device supports it with
<a href="qaudiodeviceinfo.html#isFormatSupported">isFormatSupported</a>(),
or fetch a supported format that is as close as possible to the
format with <a href="qaudiodeviceinfo.html#nearestFormat">nearestFormat</a>(). For
instance:</p>
<pre class="cpp">
<span class="type"><a href="qaudioformat.html">QAudioFormat</a></span> format;
format<span class="operator">.</span>setFrequency(<span class="number">44100</span>);
...
format<span class="operator">.</span>setSampleType(<span class="type"><a href="qaudioformat.html">QAudioFormat</a></span><span class="operator">.</span>SignedInt);
<span class="type">QAudioDeviceInfo</span> info(<span class="type">QAudioDeviceInfo</span><span class="operator">.</span>defaultOutputDevice());
<span class="keyword">if</span> (<span class="operator">!</span>info<span class="operator">.</span>isFormatSupported(format))
format <span class="operator">=</span> info<span class="operator">.</span>nearestFormat(format);
</pre>
<p>A QAudioDeviceInfo is used by Qt to construct classes that
communicate with the device--such as <a href="qaudioinput.html">QAudioInput</a>, and <a href="qaudiooutput.html">QAudioOutput</a>. The static functions <a href="qaudiodeviceinfo.html#defaultInputDevice">defaultInputDevice</a>(),
<a href="qaudiodeviceinfo.html#defaultOutputDevice">defaultOutputDevice</a>(),
and <a href="qaudiodeviceinfo.html#availableDevices">availableDevices</a>() let
you get a list of all available devices. Devices are fetch
according to the value of mode this is specified by the <a href="qaudio.html#Mode-enum">QAudio.Mode</a> enum. The QAudioDeviceInfo
returned are only valid for the <a href="qaudio.html#Mode-enum">QAudio.Mode</a>.</p>
<p>For instance:</p>
<pre class="cpp">
<a href="qtcore.html#foreach">foreach</a>(<span class="keyword">const</span> <span class="type">QAudioDeviceInfo</span> <span class="operator">&</span>deviceInfo<span class="operator">,</span> <span class="type">QAudioDeviceInfo</span><span class="operator">.</span>availableDevices(<span class="type"><a href="qaudio.html">QAudio</a></span><span class="operator">.</span>AudioOutput))
<a href="qtcore.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> <span class="string">"Device name: "</span> <span class="operator"><</span><span class="operator"><</span> deviceInfo<span class="operator">.</span><a href="qaudiodeviceinfo.html#deviceName">deviceName</a>();
</pre>
<p>In this code sample, we loop through all devices that are able
to output sound, i.e., play an audio stream in a supported format.
For each device we find, we simply print the <a href="qaudiodeviceinfo.html#deviceName">deviceName</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAudioDeviceInfo" />QAudioDeviceInfo.__init__ (<i>self</i>)</h3><p>Constructs an empty <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> object.</p>
<h3 class="fn"><a name="QAudioDeviceInfo-2" />QAudioDeviceInfo.__init__ (<i>self</i>, <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> <i>other</i>)</h3><p>Constructs a copy of <i>other</i>.</p>
<h3 class="fn"><a name="availableDevices" />unknown-type QAudioDeviceInfo.availableDevices (<a href="qaudio.html#Mode-enum">QAudio.Mode</a> <i>mode</i>)</h3><p>Returns a list of audio devices that support <i>mode</i>.</p>
<h3 class="fn"><a name="defaultInputDevice" /><a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> QAudioDeviceInfo.defaultInputDevice ()</h3><p>Returns the name of the default input audio device. All platform
and audio plugin implementations provide a default audio device to
use.</p>
<h3 class="fn"><a name="defaultOutputDevice" /><a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> QAudioDeviceInfo.defaultOutputDevice ()</h3><p>Returns the name of the default output audio device. All
platform and audio plugin implementations provide a default audio
device to use.</p>
<h3 class="fn"><a name="deviceName" />QString QAudioDeviceInfo.deviceName (<i>self</i>)</h3><p>Returns human readable name of audio device.</p>
<p>Device names vary depending on platform/audio plugin being
used.</p>
<p>They are a unique string identifiers for the audio device.</p>
<p>eg. default, Intel, U0x46d0x9a4</p>
<h3 class="fn"><a name="isFormatSupported" />bool QAudioDeviceInfo.isFormatSupported (<i>self</i>, <a href="qaudioformat.html">QAudioFormat</a> <i>format</i>)</h3><p>Returns true if <i>settings</i> are supported by the audio
device of this <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a>.</p>
<h3 class="fn"><a name="isNull" />bool QAudioDeviceInfo.isNull (<i>self</i>)</h3><p>Returns whether this <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> object holds a device
definition.</p>
<h3 class="fn"><a name="nearestFormat" /><a href="qaudioformat.html">QAudioFormat</a> QAudioDeviceInfo.nearestFormat (<i>self</i>, <a href="qaudioformat.html">QAudioFormat</a> <i>format</i>)</h3><p>Returns closest <a href="qaudioformat.html">QAudioFormat</a> to
<i>settings</i> that system audio supports.</p>
<p>These settings are provided by the platform/audio plugin being
used.</p>
<p>They also are dependent on the <a href="qaudio.html#Mode-enum">QAudio.Mode</a> being used.</p>
<h3 class="fn"><a name="preferredFormat" /><a href="qaudioformat.html">QAudioFormat</a> QAudioDeviceInfo.preferredFormat (<i>self</i>)</h3><p>Returns <a href="qaudioformat.html">QAudioFormat</a> of default
settings.</p>
<p>These settings are provided by the platform/audio plugin being
used.</p>
<p>They also are dependent on the <a href="qaudio.html#Mode-enum">QAudio.Mode</a> being used.</p>
<p>A typical audio system would provide something like:</p>
<ul>
<li>Input settings: 8000Hz mono 8 bit.</li>
<li>Output settings: 44100Hz stereo 16 bit little endian.</li>
</ul>
<h3 class="fn"><a name="supportedByteOrders" />unknown-type QAudioDeviceInfo.supportedByteOrders (<i>self</i>)</h3><p>Returns a list of supported byte orders.</p>
<h3 class="fn"><a name="supportedChannelCounts" />unknown-type QAudioDeviceInfo.supportedChannelCounts (<i>self</i>)</h3><p>Returns a list of supported channel counts.</p>
<p>This function was introduced in Qt 4.7.</p>
<h3 class="fn"><a name="supportedChannels" />unknown-type QAudioDeviceInfo.supportedChannels (<i>self</i>)</h3><h3 class="fn"><a name="supportedCodecs" />QStringList QAudioDeviceInfo.supportedCodecs (<i>self</i>)</h3><p>Returns a list of supported codecs.</p>
<p>All platform and plugin implementations should provide support
for:</p>
<p>"audio/pcm" - Linear PCM</p>
<p>For writing plugins to support additional codecs refer to:</p>
<p>http://www.iana.org/assignments/media-types/audio/</p>
<h3 class="fn"><a name="supportedFrequencies" />unknown-type QAudioDeviceInfo.supportedFrequencies (<i>self</i>)</h3><h3 class="fn"><a name="supportedSampleRates" />unknown-type QAudioDeviceInfo.supportedSampleRates (<i>self</i>)</h3><p>Returns a list of supported sample rates.</p>
<p>This function was introduced in Qt 4.7.</p>
<h3 class="fn"><a name="supportedSampleSizes" />unknown-type QAudioDeviceInfo.supportedSampleSizes (<i>self</i>)</h3><p>Returns a list of supported sample sizes.</p>
<h3 class="fn"><a name="supportedSampleTypes" />unknown-type QAudioDeviceInfo.supportedSampleTypes (<i>self</i>)</h3><p>Returns a list of supported sample types.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|