File: qaudiodeviceinfo.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (76 lines) | stat: -rw-r--r-- 12,400 bytes parent folder | download
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
<?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">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <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)</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)</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)</li><li><div class="fn" />QAudioFormat <b><a href="qaudiodeviceinfo.html#preferredFormat">preferredFormat</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QAudioFormat.Endian <b><a href="qaudiodeviceinfo.html#supportedByteOrders">supportedByteOrders</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-int <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" />list-of-int <b><a href="qaudiodeviceinfo.html#supportedFrequencies">supportedFrequencies</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-int <b><a href="qaudiodeviceinfo.html#supportedSampleSizes">supportedSampleSizes</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QAudioFormat.SampleType <b><a href="qaudiodeviceinfo.html#supportedSampleTypes">supportedSampleTypes</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />list-of-QAudioDeviceInfo <b><a href="qaudiodeviceinfo.html#availableDevices">availableDevices</a></b> (QAudio.Mode)</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#supportedChannels">supportedChannels</a>(), <a href="qaudiodeviceinfo.html#supportedCodecs">supportedCodecs</a>(), <a href="qaudiodeviceinfo.html#supportedFrequencies">supportedFrequencies</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>         QAudioFormat format;
         format.setFrequency(44100);
         ...
         format.setSampleType(QAudioFormat.SignedInt);

         QAudioDeviceInfo info(QAudioDeviceInfo.defaultOutputDevice());

         if (!info.isFormatSupported(format))
             format = info.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> foreach(const QAudioDeviceInfo &amp;deviceInfo, QAudioDeviceInfo.availableDevices(QAudio.AudioOutput))
     qDebug() &lt;&lt; "Device name: " &lt;&lt; deviceInfo.deviceName();</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>
<p>See also <a href="qaudiooutput.html">QAudioOutput</a> and <a href="qaudioinput.html">QAudioInput</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>)</h3><p>Constructs a copy of <i>other</i>.</p>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/~QAudioDeviceInfo" />
<h3 class="fn"><a name="availableDevices" />list-of-QAudioDeviceInfo QAudioDeviceInfo.availableDevices (<a href="qaudio.html#Mode-enum">QAudio.Mode</a>)</h3><p>Returns a list of audio devices that support <i>mode</i>.</p>
<a name="//apple_ref/cpp/clm/QAudioDeviceInfo/defaultInputDevice" />
<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>
<a name="//apple_ref/cpp/clm/QAudioDeviceInfo/defaultOutputDevice" />
<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>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/deviceName" />
<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>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/isFormatSupported" />
<h3 class="fn"><a name="isFormatSupported" />bool QAudioDeviceInfo.isFormatSupported (<i>self</i>, <a href="qaudioformat.html">QAudioFormat</a>)</h3><p>Returns true if <i>settings</i> are supported by the audio device of this <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a>.</p>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/isNull" />
<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>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/nearestFormat" />
<h3 class="fn"><a name="nearestFormat" /><a href="qaudioformat.html">QAudioFormat</a> QAudioDeviceInfo.nearestFormat (<i>self</i>, <a href="qaudioformat.html">QAudioFormat</a>)</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>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/preferredFormat" />
<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>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/supportedByteOrders" />
<h3 class="fn"><a name="supportedByteOrders" />list-of-QAudioFormat.Endian QAudioDeviceInfo.supportedByteOrders (<i>self</i>)</h3><p>Returns a list of supported byte orders.</p>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/supportedChannels" />
<h3 class="fn"><a name="supportedChannels" />list-of-int QAudioDeviceInfo.supportedChannels (<i>self</i>)</h3><p>Returns a list of supported channels.</p>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/supportedCodecs" />
<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>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/supportedFrequencies" />
<h3 class="fn"><a name="supportedFrequencies" />list-of-int QAudioDeviceInfo.supportedFrequencies (<i>self</i>)</h3><p>Returns a list of supported frequencies.</p>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/supportedSampleSizes" />
<h3 class="fn"><a name="supportedSampleSizes" />list-of-int QAudioDeviceInfo.supportedSampleSizes (<i>self</i>)</h3><p>Returns a list of supported sample sizes.</p>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/supportedSampleTypes" />
<h3 class="fn"><a name="supportedSampleTypes" />list-of-QAudioFormat.SampleType QAudioDeviceInfo.supportedSampleTypes (<i>self</i>)</h3><p>Returns a list of supported sample types.</p>
<a name="//apple_ref/cpp/instm/QAudioDeviceInfo/operator=" />
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>