/usr/share/qt5/doc/qtmultimedia/qml-qtmultimedia-soundeffect.html is in qtmultimedia5-doc-html 5.9.5-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsoundeffect.cpp -->
<title>SoundEffect QML Type | Qt Multimedia 5.9</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.9</td><td ><a href="qtmultimedia-index.html">Qt Multimedia</a></td><td ><a href="qtmultimedia-qmlmodule.html">QML Types</a></td><td >SoundEffect QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.5 Reference Documentation</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="#properties">Properties</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#methods">Methods</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">SoundEffect QML Type</h1>
<span class="subtitle"></span>
<!-- $$$SoundEffect-brief -->
<p>The <a href="qml-multimedia.html#soundeffect">SoundEffect</a> type provides a way to play sound effects in QML. <a href="#details">More...</a></p>
<!-- @@@SoundEffect -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtMultimedia 5.8</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Instantiates:</td><td class="memItemRight bottomAlign"> <a href="qml-qtmultimedia-soundeffect.html"><a href="qsoundeffect.html">QSoundEffect</a></td></tr></table></div><ul>
<li><a href="qml-qtmultimedia-soundeffect-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#category-prop">category</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#loops-prop">loops</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#loopsRemaining-prop">loopsRemaining</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#muted-prop">muted</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#playing-prop">playing</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#source-prop">source</a></b></b> : url</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#status-prop">status</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#volume-prop">volume</a></b></b> : qreal</li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#categoryChanged-signal">categoryChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#loadedChanged-signal">loadedChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#loopCountChanged-signal">loopCountChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#loopsRemainingChanged-signal">loopsRemainingChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#mutedChanged-signal">mutedChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#playingChanged-signal">playingChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#sourceChanged-signal">sourceChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#statusChanged-signal">statusChanged</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#volumeChanged-signal">volumeChanged</a></b></b>()</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">bool <b><b><a href="qml-qtmultimedia-soundeffect.html#isLoaded-method">isLoaded</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#play-method">play</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtmultimedia-soundeffect.html#stop-method">stop</a></b></b>()</li>
</ul>
<!-- $$$SoundEffect-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p>This type allows you to play uncompressed audio files (typically WAV files) in a generally lower latency way, and is suitable for "feedback" type sounds in response to user actions (e.g. virtual keyboard sounds, positive or negative feedback for popup dialogs, or game sounds). If low latency is not important, consider using the <a href="qml-qtmultimedia-mediaplayer.html">MediaPlayer</a> or Audio types instead, since they support a wider variety of media formats and are less resource intensive.</p>
<p>Typically the sound effect should be reused, which allows all the parsing and preparation to be done ahead of time, and only triggered when necessary. This is easy to achieve with QML, since you can declare your <a href="qml-multimedia.html#soundeffect">SoundEffect</a> instance and refer to it elsewhere.</p>
<p>The following example plays a WAV file on mouse click.</p>
<pre class="qml">
<span class="type">Text</span> {
<span class="name">text</span>: <span class="string">"Click Me!"</span>;
<span class="name">font</span>.pointSize: <span class="number">24</span>;
<span class="name">width</span>: <span class="number">150</span>; <span class="name">height</span>: <span class="number">50</span>;
<span class="type"><a href="qml-qtmultimedia-soundeffect.html">SoundEffect</a></span> {
<span class="name">id</span>: <span class="name">playSound</span>
<span class="name">source</span>: <span class="string">"soundeffect.wav"</span>
}
<span class="type">MouseArea</span> {
<span class="name">id</span>: <span class="name">playArea</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onPressed</span>: { <span class="name">playSound</span>.<span class="name">play</span>() }
}
}
</pre>
<p>Since <a href="qml-multimedia.html#soundeffect">SoundEffect</a> requires slightly more resources to achieve lower latency playback, the platform may limit the number of simultaneously playing sound effects.</p>
<!-- @@@SoundEffect -->
<h2>Property Documentation</h2>
<!-- $$$category -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="category-prop">
<td class="tblQmlPropNode"><p>
<a name="category-prop"></a><span class="name">category</span> : <span class="type">string</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property contains the <i>category</i> of this sound effect.</p>
<p>Some platforms can perform different audio routing for different categories, or may allow the user to set different volume levels for different categories.</p>
<p>This setting will be ignored on platforms that do not support audio categories.</p>
</div></div><!-- @@@category -->
<br/>
<!-- $$$loops -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="loops-prop">
<td class="tblQmlPropNode"><p>
<a name="loops-prop"></a><span class="name">loops</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the number of times the sound is played. A value of 0 or 1 means the sound will be played only once; set to <a href="qml-multimedia.html#soundeffect">SoundEffect</a>.Infinite to enable infinite looping.</p>
<p>The value can be changed while the sound effect is playing, in which case it will update the remaining loops to the new value.</p>
</div></div><!-- @@@loops -->
<br/>
<!-- $$$loopsRemaining -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="loopsRemaining-prop">
<td class="tblQmlPropNode"><p>
<a name="loopsRemaining-prop"></a><span class="name">loopsRemaining</span> : <span class="type">int</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property contains the number of loops remaining before the sound effect stops by itself, or <a href="qml-multimedia.html#soundeffect">SoundEffect</a>.Infinite if that's what has been set in <a href="qml-qtmultimedia-soundeffect.html#loops-prop">loops</a>.</p>
</div></div><!-- @@@loopsRemaining -->
<br/>
<!-- $$$muted -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="muted-prop">
<td class="tblQmlPropNode"><p>
<a name="muted-prop"></a><span class="name">muted</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property provides a way to control muting. A value of <code>true</code> will mute this effect. Otherwise, playback will occur with the currently specified <a href="qml-qtmultimedia-soundeffect.html#volume-prop">volume</a>.</p>
</div></div><!-- @@@muted -->
<br/>
<!-- $$$playing -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="playing-prop">
<td class="tblQmlPropNode"><p>
<a name="playing-prop"></a><span class="name">playing</span> : <span class="type">bool</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property indicates whether the sound effect is playing or not.</p>
</div></div><!-- @@@playing -->
<br/>
<!-- $$$source -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="source-prop">
<td class="tblQmlPropNode"><p>
<a name="source-prop"></a><span class="name">source</span> : <span class="type">url</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the url for the sound to play. For the <a href="qml-multimedia.html#soundeffect">SoundEffect</a> to attempt to load the source, the URL must exist and the application must have read permission in the specified directory. If the desired source is a local file the URL may be specified using either absolute or relative (to the file that declared the <a href="qml-multimedia.html#soundeffect">SoundEffect</a>) pathing.</p>
</div></div><!-- @@@source -->
<br/>
<!-- $$$status -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="status-prop">
<td class="tblQmlPropNode"><p>
<a name="status-prop"></a><span class="name">status</span> : <span class="type">enumeration</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property indicates the current status of the <a href="qml-multimedia.html#soundeffect">SoundEffect</a> as enumerated within <a href="qml-multimedia.html#soundeffect">SoundEffect</a>. Possible statuses are listed below.</p>
<div class="table"><table class="generic">
<thead><tr class="qt-style"><th >Value</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td ><a href="qml-multimedia.html#soundeffect">SoundEffect</a>.Null</td><td >No source has been set or the source is null.</td></tr>
<tr valign="top" class="even"><td ><a href="qml-multimedia.html#soundeffect">SoundEffect</a>.Loading</td><td >The <a href="qml-multimedia.html#soundeffect">SoundEffect</a> is trying to load the source.</td></tr>
<tr valign="top" class="odd"><td ><a href="qml-multimedia.html#soundeffect">SoundEffect</a>.Ready</td><td >The source is loaded and ready for play.</td></tr>
<tr valign="top" class="even"><td ><a href="qml-multimedia.html#soundeffect">SoundEffect</a>.Error</td><td >An error occurred during operation, such as failure of loading the source.</td></tr>
</table></div>
</div></div><!-- @@@status -->
<br/>
<!-- $$$volume -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="volume-prop">
<td class="tblQmlPropNode"><p>
<a name="volume-prop"></a><span class="name">volume</span> : <span class="type">qreal</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds the volume of the sound effect playback.</p>
<p>The volume is scaled linearly from <code>0.0</code> (silence) to <code>1.0</code> (full volume). Values outside this range will be clamped.</p>
<p>The default volume is <code>1.0</code>.</p>
<p>UI volume controls should usually be scaled nonlinearly. For example, using a logarithmic scale will produce linear changes in perceived loudness, which is what a user would normally expect from a volume control. See <a href="qml-qtmultimedia-qtmultimedia.html#convertVolume-method">QtMultimedia.convertVolume()</a> for more details.</p>
</div></div><!-- @@@volume -->
<br/>
<h2>Signal Documentation</h2>
<!-- $$$categoryChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="categoryChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="categoryChanged-signal"></a><span class="name">categoryChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>categoryChanged</code> signal is emitted when the category property has changed.</p>
<p>The corresponding handler is <code>onCategoryChanged</code>.</p>
</div></div><!-- @@@categoryChanged -->
<br/>
<!-- $$$loadedChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="loadedChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="loadedChanged-signal"></a><span class="name">loadedChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>loadedChanged</code> signal is emitted when the loading state has changed.</p>
<p>The corresponding handler is <code>onLoadedChanged</code>.</p>
</div></div><!-- @@@loadedChanged -->
<br/>
<!-- $$$loopCountChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="loopCountChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="loopCountChanged-signal"></a><span class="name">loopCountChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>loopCountChanged</code> signal is emitted when the initial number of loops has changed.</p>
<p>The corresponding handler is <code>onLoopCountChanged</code>.</p>
</div></div><!-- @@@loopCountChanged -->
<br/>
<!-- $$$loopsRemainingChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="loopsRemainingChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="loopsRemainingChanged-signal"></a><span class="name">loopsRemainingChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>loopsRemainingChanged</code> signal is emitted when the remaining number of loops has changed.</p>
<p>The corresponding handler is <code>onLoopsRemainingChanged</code>.</p>
</div></div><!-- @@@loopsRemainingChanged -->
<br/>
<!-- $$$mutedChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="mutedChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="mutedChanged-signal"></a><span class="name">mutedChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>mutedChanged</code> signal is emitted when the mute state has changed.</p>
<p>The corresponding handler is <code>onMutedChanged</code>.</p>
</div></div><!-- @@@mutedChanged -->
<br/>
<!-- $$$playingChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="playingChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="playingChanged-signal"></a><span class="name">playingChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>playingChanged</code> signal is emitted when the playing property has changed.</p>
<p>The corresponding handler is <code>onPlayingChanged</code>.</p>
</div></div><!-- @@@playingChanged -->
<br/>
<!-- $$$sourceChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="sourceChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="sourceChanged-signal"></a><span class="name">sourceChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>sourceChanged</code> signal is emitted when the source has been changed.</p>
<p>The corresponding handler is <code>onSourceChanged</code>.</p>
</div></div><!-- @@@sourceChanged -->
<br/>
<!-- $$$statusChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="statusChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="statusChanged-signal"></a><span class="name">statusChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>statusChanged</code> signal is emitted when the status property has changed.</p>
<p>The corresponding handler is <code>onStatusChanged</code>.</p>
</div></div><!-- @@@statusChanged -->
<br/>
<!-- $$$volumeChanged -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="volumeChanged-signal">
<td class="tblQmlFuncNode"><p>
<a name="volumeChanged-signal"></a><span class="name">volumeChanged</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The <code>volumeChanged</code> signal is emitted when the volume has changed.</p>
<p>The corresponding handler is <code>onVolumeChanged</code>.</p>
</div></div><!-- @@@volumeChanged -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$isLoaded -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="isLoaded-method">
<td class="tblQmlFuncNode"><p>
<a name="isLoaded-method"></a><span class="type">bool</span> <span class="name">isLoaded</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns whether the sound effect has finished loading the <a href="qml-qtmultimedia-soundeffect.html#source-prop">source</a>.</p>
</div></div><!-- @@@isLoaded -->
<br/>
<!-- $$$play -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="play-method">
<td class="tblQmlFuncNode"><p>
<a name="play-method"></a><span class="name">play</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Start playback of the sound effect, looping the effect for the number of times as specified in the loops property.</p>
<p>This is the default method for <a href="qml-multimedia.html#soundeffect">SoundEffect</a>.</p>
<pre class="qml">
<span class="type"><a href="qml-qtmultimedia-soundeffect.html">SoundEffect</a></span> {
<span class="name">id</span>: <span class="name">playSound</span>
<span class="name">source</span>: <span class="string">"soundeffect.wav"</span>
}
<span class="type">MouseArea</span> {
<span class="name">id</span>: <span class="name">playArea</span>
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onPressed</span>: { <span class="name">playSound</span>.<span class="name">play</span>() }
}
</pre>
</div></div><!-- @@@play -->
<br/>
<!-- $$$stop -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="stop-method">
<td class="tblQmlFuncNode"><p>
<a name="stop-method"></a><span class="name">stop</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Stop current playback.</p>
</div></div><!-- @@@stop -->
<br/>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2017 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>
|