Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 50facae208d4a6f280e44a513b104320 > files > 592

qt-mobility-doc-1.2.0-13.mga5.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qaudiodeviceinfo.cpp -->
  <title>Qt Mobility 1.2: QAudioDeviceInfo Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>QtMobility Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtmultimediakit.html">QtMultimediaKit</a></li>
<li>QAudioDeviceInfo</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QAudioDeviceInfo Class Reference</h1>
<!-- $$$QAudioDeviceInfo-brief -->
<p>The QAudioDeviceInfo class provides an interface to query audio devices and their functionality. <a href="#details">More...</a></p>
<!-- @@@QAudioDeviceInfo -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QAudioDeviceInfo&gt;</span></pre><p>This class was introduced in  QtMobility 1.0.</p>
<ul>
<li><a href="qaudiodeviceinfo-members.html">List of all members, including inherited members</a></li>
<li><a href="qaudiodeviceinfo-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#QAudioDeviceInfo">QAudioDeviceInfo</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#QAudioDeviceInfo-2">QAudioDeviceInfo</a></b> ( const QAudioDeviceInfo &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#dtor.QAudioDeviceInfo">~QAudioDeviceInfo</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#deviceName">deviceName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#isFormatSupported">isFormatSupported</a></b> ( const QAudioFormat &amp; <i>settings</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAudioFormat </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#nearestFormat">nearestFormat</a></b> ( const QAudioFormat &amp; <i>settings</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAudioFormat </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#preferredFormat">preferredFormat</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QAudioFormat::Endian&gt; </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#supportedByteOrders">supportedByteOrders</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;int&gt; </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#supportedChannelCounts">supportedChannelCounts</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#supportedCodecs">supportedCodecs</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;int&gt; </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#supportedSampleRates">supportedSampleRates</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;int&gt; </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#supportedSampleSizes">supportedSampleSizes</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QAudioFormat::SampleType&gt; </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#supportedSampleTypes">supportedSampleTypes</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAudioDeviceInfo &amp; </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#operator-eq">operator=</a></b> ( const QAudioDeviceInfo &amp; <i>other</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QAudioDeviceInfo&gt; </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#availableDevices">availableDevices</a></b> ( QAudio::Mode <i>mode</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAudioDeviceInfo </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#defaultInputDevice">defaultInputDevice</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QAudioDeviceInfo </td><td class="memItemRight bottomAlign"><b><a href="qaudiodeviceinfo.html#defaultOutputDevice">defaultOutputDevice</a></b> ()</td></tr>
</table>
<a name="details"></a>
<!-- $$$QAudioDeviceInfo-description -->
<div class="descr">
<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>);
 <span class="comment">// ... other format parameters</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="http://qt.nokia.com/doc/4.7/qaudio.html">QAudio</a>::Mode enum. The QAudioDeviceInfo returned are only valid for the <a href="http://qt.nokia.com/doc/4.7/qaudio.html">QAudio</a>::Mode.</p>
<p>For instance:</p>
<pre class="cpp"> foreach (<span class="keyword">const</span> <span class="type">QAudioDeviceInfo</span> <span class="operator">&amp;</span>deviceInfo<span class="operator">,</span> <span class="type">QAudioDeviceInfo</span><span class="operator">::</span>availableDevices(<span class="type"><a href="http://qt.nokia.com/doc/4.7/qaudio.html">QAudio</a></span><span class="operator">::</span>AudioOutput))
     <a href="http://qt.nokia.com/doc/4.7/qtglobal.html#qDebug">qDebug</a>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;Device name: &quot;</span> <span class="operator">&lt;</span><span class="operator">&lt;</span> deviceInfo<span class="operator">.</span>deviceName();</pre>
<p>In this code sample, we loop through all devices that are able to output sound, i.e&#x2e;, 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>
</div>
<p><b>See also </b><a href="qaudiooutput.html">QAudioOutput</a> and <a href="qaudioinput.html">QAudioInput</a>.</p>
<!-- @@@QAudioDeviceInfo -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QAudioDeviceInfo[overload1]$$$QAudioDeviceInfo -->
<h3 class="fn"><a name="QAudioDeviceInfo"></a>QAudioDeviceInfo::<span class="name">QAudioDeviceInfo</span> ()</h3>
<p>Constructs an empty <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> object.</p>
<!-- @@@QAudioDeviceInfo -->
<!-- $$$QAudioDeviceInfo$$$QAudioDeviceInfoconstQAudioDeviceInfo& -->
<h3 class="fn"><a name="QAudioDeviceInfo-2"></a>QAudioDeviceInfo::<span class="name">QAudioDeviceInfo</span> ( const <span class="type">QAudioDeviceInfo</span> &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@QAudioDeviceInfo -->
<!-- $$$~QAudioDeviceInfo[overload1]$$$~QAudioDeviceInfo -->
<h3 class="fn"><a name="dtor.QAudioDeviceInfo"></a>QAudioDeviceInfo::<span class="name">~QAudioDeviceInfo</span> ()</h3>
<p>Destroy this audio device info.</p>
<!-- @@@~QAudioDeviceInfo -->
<!-- $$$availableDevices[overload1]$$$availableDevicesQAudio::Mode -->
<h3 class="fn"><a name="availableDevices"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qlist.html">QList</a></span>&lt;<span class="type">QAudioDeviceInfo</span>&gt; QAudioDeviceInfo::<span class="name">availableDevices</span> ( <span class="type"><a href="qaudio.html#Mode-enum">QAudio::Mode</a></span> <i>mode</i> )<tt> [static]</tt></h3>
<p>Returns a list of audio devices that support <i>mode</i>.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@availableDevices -->
<!-- $$$defaultInputDevice[overload1]$$$defaultInputDevice -->
<h3 class="fn"><a name="defaultInputDevice"></a><span class="type">QAudioDeviceInfo</span> QAudioDeviceInfo::<span class="name">defaultInputDevice</span> ()<tt> [static]</tt></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>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@defaultInputDevice -->
<!-- $$$defaultOutputDevice[overload1]$$$defaultOutputDevice -->
<h3 class="fn"><a name="defaultOutputDevice"></a><span class="type">QAudioDeviceInfo</span> QAudioDeviceInfo::<span class="name">defaultOutputDevice</span> ()<tt> [static]</tt></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>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@defaultOutputDevice -->
<!-- $$$deviceName[overload1]$$$deviceName -->
<h3 class="fn"><a name="deviceName"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qstring.html">QString</a></span> QAudioDeviceInfo::<span class="name">deviceName</span> () const</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>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@deviceName -->
<!-- $$$isFormatSupported[overload1]$$$isFormatSupportedconstQAudioFormat& -->
<h3 class="fn"><a name="isFormatSupported"></a><span class="type">bool</span> QAudioDeviceInfo::<span class="name">isFormatSupported</span> ( const <span class="type"><a href="qaudioformat.html">QAudioFormat</a></span> &amp; <i>settings</i> ) const</h3>
<p>Returns true if <i>settings</i> are supported by the audio device of this <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a>.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@isFormatSupported -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> QAudioDeviceInfo::<span class="name">isNull</span> () const</h3>
<p>Returns whether this <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> object holds a device definition.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@isNull -->
<!-- $$$nearestFormat[overload1]$$$nearestFormatconstQAudioFormat& -->
<h3 class="fn"><a name="nearestFormat"></a><span class="type"><a href="qaudioformat.html">QAudioFormat</a></span> QAudioDeviceInfo::<span class="name">nearestFormat</span> ( const <span class="type"><a href="qaudioformat.html">QAudioFormat</a></span> &amp; <i>settings</i> ) const</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="http://qt.nokia.com/doc/4.7/qaudio.html">QAudio</a>::Mode being used.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@nearestFormat -->
<!-- $$$preferredFormat[overload1]$$$preferredFormat -->
<h3 class="fn"><a name="preferredFormat"></a><span class="type"><a href="qaudioformat.html">QAudioFormat</a></span> QAudioDeviceInfo::<span class="name">preferredFormat</span> () const</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="http://qt.nokia.com/doc/4.7/qaudio.html">QAudio</a>::Mode 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>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@preferredFormat -->
<!-- $$$supportedByteOrders[overload1]$$$supportedByteOrders -->
<h3 class="fn"><a name="supportedByteOrders"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qlist.html">QList</a></span>&lt;<span class="type"><a href="qaudioformat.html#Endian-enum">QAudioFormat::Endian</a></span>&gt; QAudioDeviceInfo::<span class="name">supportedByteOrders</span> () const</h3>
<p>Returns a list of supported byte orders.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@supportedByteOrders -->
<!-- $$$supportedChannelCounts[overload1]$$$supportedChannelCounts -->
<h3 class="fn"><a name="supportedChannelCounts"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qlist.html">QList</a></span>&lt;<span class="type">int</span>&gt; QAudioDeviceInfo::<span class="name">supportedChannelCounts</span> () const</h3>
<p>Returns a list of supported channel counts.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@supportedChannelCounts -->
<!-- $$$supportedCodecs[overload1]$$$supportedCodecs -->
<h3 class="fn"><a name="supportedCodecs"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qstringlist.html">QStringList</a></span> QAudioDeviceInfo::<span class="name">supportedCodecs</span> () const</h3>
<p>Returns a list of supported codecs.</p>
<p>All platform and plugin implementations should provide support for:</p>
<p>&quot;audio/pcm&quot; - Linear PCM</p>
<p>For writing plugins to support additional codecs refer to:</p>
<p>http://www.iana.org/assignments/media-types/audio/</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@supportedCodecs -->
<!-- $$$supportedSampleRates[overload1]$$$supportedSampleRates -->
<h3 class="fn"><a name="supportedSampleRates"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qlist.html">QList</a></span>&lt;<span class="type">int</span>&gt; QAudioDeviceInfo::<span class="name">supportedSampleRates</span> () const</h3>
<p>Returns a list of supported sample rates.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@supportedSampleRates -->
<!-- $$$supportedSampleSizes[overload1]$$$supportedSampleSizes -->
<h3 class="fn"><a name="supportedSampleSizes"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qlist.html">QList</a></span>&lt;<span class="type">int</span>&gt; QAudioDeviceInfo::<span class="name">supportedSampleSizes</span> () const</h3>
<p>Returns a list of supported sample sizes.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@supportedSampleSizes -->
<!-- $$$supportedSampleTypes[overload1]$$$supportedSampleTypes -->
<h3 class="fn"><a name="supportedSampleTypes"></a><span class="type"><a href="http://qt.nokia.com/doc/4.7/qlist.html">QList</a></span>&lt;<span class="type"><a href="qaudioformat.html#SampleType-enum">QAudioFormat::SampleType</a></span>&gt; QAudioDeviceInfo::<span class="name">supportedSampleTypes</span> () const</h3>
<p>Returns a list of supported sample types.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@supportedSampleTypes -->
<!-- $$$operator=[overload1]$$$operator=constQAudioDeviceInfo& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QAudioDeviceInfo</span> &amp; QAudioDeviceInfo::<span class="name">operator=</span> ( const <span class="type">QAudioDeviceInfo</span> &amp; <i>other</i> )</h3>
<p>Sets the <a href="qaudiodeviceinfo.html">QAudioDeviceInfo</a> object to be equal to <i>other</i>.</p>
<p>This function was introduced in Qt Mobility 1.0.</p>
<!-- @@@operator= -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
  <p>
     <acronym title="Copyright">&copy;</acronym> 2008-2011 Nokia Corporation and/or its
     subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
     in Finland and/or other countries worldwide.</p>
  <p>
     All other trademarks are property of their respective owners. <a title="Privacy Policy"
     href="http://qt.nokia.com/about/privacy-policy">Privacy Policy</a></p>
  <br />
  <p>
    Licensees holding valid Qt Commercial licenses may use this document in accordance with the    Qt Commercial License Agreement provided with the Software or, alternatively, in accordance    with the terms contained in a written agreement between you and Nokia.</p>
  <p>
    Alternatively, this document may be used under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU
    Free Documentation License version 1.3</a>
    as published by the Free Software Foundation.</p>
</div>
</body>
</html>