Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 1680fb88efc4e76ac8cb0ebf3578014f > files > 95

qtmultimedia5-doc-5.12.6-1.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qaudio.cpp -->
  <title>QAudio Namespace | Qt Multimedia 5.12.6</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtmultimedia-index.html">Qt Multimedia</a></td><td >QAudio Namespace</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtmultimedia-index.html">Qt 5.12.6 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#types">Types</a></li>
<li class="level1"><a href="#functions">Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QAudio Namespace</h1>
<!-- $$$QAudio-brief -->
<p>The <a href="qaudio.html">QAudio</a> namespace contains enums used by the audio classes. <a href="#details">More...</a></p>
<!-- @@@QAudio -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QAudio&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += multimedia</td></tr></table></div><ul>
</ul>
<a name="types"></a>
<h2 id="types">Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qaudio.html#Error-enum">Error</a></b> { NoError, OpenError, IOError, UnderrunError, FatalError }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qaudio.html#Mode-enum">Mode</a></b> { AudioOutput, AudioInput }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qaudio.html#Role-enum">Role</a></b> { UnknownRole, MusicRole, VideoRole, VoiceCommunicationRole, ..., CustomRole }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qaudio.html#State-enum">State</a></b> { ActiveState, SuspendedState, StoppedState, IdleState, InterruptedState }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qaudio.html#VolumeScale-enum">VolumeScale</a></b> { LinearVolumeScale, CubicVolumeScale, LogarithmicVolumeScale, DecibelVolumeScale }</td></tr>
</table></div>
<a name="functions"></a>
<h2 id="functions">Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qaudio.html#convertVolume">convertVolume</a></b>(qreal <i>volume</i>, QAudio::VolumeScale <i>from</i>, QAudio::VolumeScale <i>to</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QAudio-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qaudio.html">QAudio</a> namespace contains enums used by the audio classes.</p>
</div>
<!-- @@@QAudio -->
<div class="types">
<h2>Type Documentation</h2>
<!-- $$$Error$$$NoError$$$OpenError$$$IOError$$$UnderrunError$$$FatalError -->
<h3 class="fn" id="Error-enum"><a name="Error-enum"></a>enum QAudio::<span class="name">Error</span></h3>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAudio::NoError</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No errors have occurred</td></tr>
<tr><td class="topAlign"><code>QAudio::OpenError</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">An error occurred opening the audio device</td></tr>
<tr><td class="topAlign"><code>QAudio::IOError</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">An error occurred during read/write of audio device</td></tr>
<tr><td class="topAlign"><code>QAudio::UnderrunError</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Audio data is not being fed to the audio device at a fast enough rate</td></tr>
<tr><td class="topAlign"><code>QAudio::FatalError</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">A non-recoverable error has occurred, the audio device is not usable at this time.</td></tr>
</table></div>
<!-- @@@Error -->
<!-- $$$Mode$$$AudioInput$$$AudioOutput -->
<h3 class="fn" id="Mode-enum"><a name="Mode-enum"></a>enum QAudio::<span class="name">Mode</span></h3>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAudio::AudioOutput</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">audio output device</td></tr>
<tr><td class="topAlign"><code>QAudio::AudioInput</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">audio input device</td></tr>
</table></div>
<!-- @@@Mode -->
<!-- $$$Role$$$UnknownRole$$$MusicRole$$$VideoRole$$$VoiceCommunicationRole$$$AlarmRole$$$NotificationRole$$$RingtoneRole$$$AccessibilityRole$$$SonificationRole$$$GameRole$$$CustomRole -->
<h3 class="fn" id="Role-enum"><a name="Role-enum"></a>enum QAudio::<span class="name">Role</span></h3>
<p>This enum describes the role of an audio stream.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAudio::UnknownRole</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The role is unknown or undefined</td></tr>
<tr><td class="topAlign"><code>QAudio::MusicRole</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Music</td></tr>
<tr><td class="topAlign"><code>QAudio::VideoRole</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">Soundtrack from a movie or a video</td></tr>
<tr><td class="topAlign"><code>QAudio::VoiceCommunicationRole</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Voice communications, such as telephony</td></tr>
<tr><td class="topAlign"><code>QAudio::AlarmRole</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">Alarm</td></tr>
<tr><td class="topAlign"><code>QAudio::NotificationRole</code></td><td class="topAlign tblval"><code>5</code></td><td class="topAlign">Notification, such as an incoming e-mail or a chat request</td></tr>
<tr><td class="topAlign"><code>QAudio::RingtoneRole</code></td><td class="topAlign tblval"><code>6</code></td><td class="topAlign">Ringtone</td></tr>
<tr><td class="topAlign"><code>QAudio::AccessibilityRole</code></td><td class="topAlign tblval"><code>7</code></td><td class="topAlign">For accessibility, such as with a screen reader</td></tr>
<tr><td class="topAlign"><code>QAudio::SonificationRole</code></td><td class="topAlign tblval"><code>8</code></td><td class="topAlign">Sonification, such as with user interface sounds</td></tr>
<tr><td class="topAlign"><code>QAudio::GameRole</code></td><td class="topAlign tblval"><code>9</code></td><td class="topAlign">Game audio</td></tr>
<tr><td class="topAlign"><code>QAudio::CustomRole</code></td><td class="topAlign tblval"><code>10</code></td><td class="topAlign">The role is specified by <a href="qmediaplayer.html#customAudioRole-prop">QMediaPlayer::customAudioRole</a>()</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 5.6.</p>
<p><b>See also </b><a href="qmediaplayer.html#audioRole-prop">QMediaPlayer::setAudioRole</a>().</p>
<!-- @@@Role -->
<!-- $$$State$$$ActiveState$$$SuspendedState$$$StoppedState$$$IdleState$$$InterruptedState -->
<h3 class="fn" id="State-enum"><a name="State-enum"></a>enum QAudio::<span class="name">State</span></h3>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAudio::ActiveState</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Audio data is being processed, this state is set after start() is called and while audio data is available to be processed.</td></tr>
<tr><td class="topAlign"><code>QAudio::SuspendedState</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The audio stream is in a suspended state. Entered after suspend() is called or when another stream takes control of the audio device. In the later case, a call to resume will return control of the audio device to this stream. This should usually only be done upon user request.</td></tr>
<tr><td class="topAlign"><code>QAudio::StoppedState</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The audio device is closed, and is not processing any audio data</td></tr>
<tr><td class="topAlign"><code>QAudio::IdleState</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">The QIODevice passed in has no data and audio system's buffer is empty, this state is set after start() is called and while no audio data is available to be processed.</td></tr>
<tr><td class="topAlign"><code>QAudio::InterruptedState</code></td><td class="topAlign tblval"><code>4</code></td><td class="topAlign">This stream is in a suspended state because another higher priority stream currently has control of the audio device. Playback cannot resume until the higher priority stream relinquishes control of the audio device.</td></tr>
</table></div>
<!-- @@@State -->
<!-- $$$VolumeScale$$$LinearVolumeScale$$$CubicVolumeScale$$$LogarithmicVolumeScale$$$DecibelVolumeScale -->
<h3 class="fn" id="VolumeScale-enum"><a name="VolumeScale-enum"></a>enum QAudio::<span class="name">VolumeScale</span></h3>
<p>This enum defines the different audio volume scales.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QAudio::LinearVolumeScale</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Linear scale. <code>0.0</code> (0%) is silence and <code>1.0</code> (100%) is full volume. All Qt Multimedia classes that have an audio volume use a linear scale.</td></tr>
<tr><td class="topAlign"><code>QAudio::CubicVolumeScale</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Cubic scale. <code>0.0</code> (0%) is silence and <code>1.0</code> (100%) is full volume.</td></tr>
<tr><td class="topAlign"><code>QAudio::LogarithmicVolumeScale</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">Logarithmic Scale. <code>0.0</code> (0%) is silence and <code>1.0</code> (100%) is full volume. UI volume controls should usually use a logarithmic scale.</td></tr>
<tr><td class="topAlign"><code>QAudio::DecibelVolumeScale</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Decibel (dB, amplitude) logarithmic scale. <code>-200</code> is silence and <code>0</code> is full volume.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 5.8.</p>
<p><b>See also </b><a href="qaudio.html#convertVolume">QAudio::convertVolume</a>().</p>
<!-- @@@VolumeScale -->
</div>
<div class="func">
<h2>Function Documentation</h2>
<!-- $$$convertVolume[overload1]$$$convertVolumeqrealQAudio::VolumeScaleQAudio::VolumeScale -->
<h3 class="fn" id="convertVolume"><a name="convertVolume"></a><span class="type">qreal</span> QAudio::<span class="name">convertVolume</span>(<span class="type">qreal</span> <i>volume</i>, <span class="type"><a href="qaudio.html#VolumeScale-enum">QAudio::VolumeScale</a></span> <i>from</i>, <span class="type"><a href="qaudio.html#VolumeScale-enum">QAudio::VolumeScale</a></span> <i>to</i>)</h3>
<p>Converts an audio <i>volume</i> <i>from</i> a volume scale <i>to</i> another, and returns the result.</p>
<p>Depending on the context, different scales are used to represent audio volume. All Qt Multimedia classes that have an audio volume use a linear scale, the reason is that the loudness of a speaker is controlled by modulating its voltage on a linear scale. The human ear on the other hand, perceives loudness in a logarithmic way. Using a logarithmic scale for volume controls is therefore appropriate in most applications. The decibel scale is logarithmic by nature and is commonly used to define sound levels, it is usually used for UI volume controls in professional audio applications. The cubic scale is a computationally cheap approximation of a logarithmic scale, it provides more control over lower volume levels.</p>
<p>The following example shows how to convert the volume value from a slider control before passing it to a <a href="qmediaplayer.html">QMediaPlayer</a>. As a result, the perceived increase in volume is the same when increasing the volume slider from 20 to 30 as it is from 50 to 60:</p>
<pre class="cpp">

  <span class="type">void</span> applyVolume(<span class="type">int</span> volumeSliderValue)
  {
      <span class="comment">// volumeSliderValue is in the range [0..100]</span>

      <span class="type">qreal</span> linearVolume <span class="operator">=</span> <span class="type">QAudio</span><span class="operator">::</span>convertVolume(volumeSliderValue <span class="operator">/</span> <span class="type">qreal</span>(<span class="number">100.0</span>)<span class="operator">,</span>
                                                 <span class="type">QAudio</span><span class="operator">::</span>LogarithmicVolumeScale<span class="operator">,</span>
                                                 <span class="type">QAudio</span><span class="operator">::</span>LinearVolumeScale);

      player<span class="operator">.</span>setVolume(qRound(linearVolume <span class="operator">*</span> <span class="number">100</span>));
  }

</pre>
<p>This function was introduced in  Qt 5.8.</p>
<p><b>See also </b><a href="qaudio.html#VolumeScale-enum">VolumeScale</a>, <a href="qmediaplayer.html#volume-prop">QMediaPlayer::setVolume</a>(), <a href="qaudiooutput.html#setVolume">QAudioOutput::setVolume</a>(), <a href="qaudioinput.html#setVolume">QAudioInput::setVolume</a>(), <a href="qsoundeffect.html#setVolume">QSoundEffect::setVolume</a>(), and <a href="qmediarecorder.html#volume-prop">QMediaRecorder::setVolume</a>().</p>
<!-- @@@convertVolume -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed 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.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>