<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qaudiobuffer.cpp --> <title>StereoFrame Class | Qt Multimedia 5.11</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 ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtmultimedia-index.html">Qt Multimedia</a></td><td ><a href="qtmultimedia-modules.html">C++ Classes</a></td><td >StereoFrame</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.11.2 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="#public-functions">Public Functions</a></li> <li class="level1"><a href="#public-variables">Public Variables</a></li> <li class="level1"><a href="#related-non-members">Related Non-Members</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">StereoFrame Class</h1> <span class="small-subtitle">(<a href="qaudiobuffer-stereoframe.html">QAudioBuffer::StereoFrame</a>)<br/></span> <!-- $$$StereoFrame-brief --> <p>The <a href="qaudiobuffer-stereoframe.html">StereoFrame</a> class provides a simple wrapper for a stereo audio frame. <a href="#details">More...</a></p> <!-- @@@StereoFrame --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <StereoFrame></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += multimedia</td></tr></table></div><ul> <li><a href="qaudiobuffer-stereoframe-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#StereoFrame">StereoFrame</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#StereoFrame-1">StereoFrame</a></b>(T <i>leftSample</i>, T <i>rightSample</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#average">average</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#clear">clear</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> StereoFrame<T> &</td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#operator-eq">operator=</a></b>(const StereoFrame<T> &<i>other</i>)</td></tr> </table></div> <a name="public-variables"></a> <h2 id="public-variables">Public Variables</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#left-var">left</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#right-var">right</a></b></td></tr> </table></div> <a name="related-non-members"></a> <h2 id="related-non-members">Related Non-Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#S16S-typedef">S16S</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#S16U-typedef">S16U</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#S32F-typedef">S32F</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#S8S-typedef">S8S</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qaudiobuffer-stereoframe.html#S8U-typedef">S8U</a></b></td></tr> </table></div> <a name="details"></a> <!-- $$$StereoFrame-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qaudiobuffer-stereoframe.html">StereoFrame</a> class provides a simple wrapper for a stereo audio frame.</p> <p>This templatized structure lets you treat a block of individual samples as an interleaved stereo stream frame. This is most useful when used with the templatized <a href="qaudiobuffer.html#data">data()</a> functions of <a href="qaudiobuffer.html">QAudioBuffer</a>. Generally the data is accessed as a pointer, so no copying should occur.</p> <p>There are some predefined instantiations of this template for working with common stereo sample depths in a convenient way.</p> <p>This frame structure has <i>left</i> and <i>right</i> members for accessing individual channel data.</p> <p>For example:</p> <pre class="cpp"> <span class="comment">// Assuming 'buffer' is an unsigned 16 bit stereo buffer..</span> <span class="type"><a href="qaudiobuffer.html#QAudioBuffer">QAudioBuffer</a></span><span class="operator">::</span>S16U <span class="operator">*</span>frames <span class="operator">=</span> buffer<span class="operator">-</span><span class="operator">></span>data<span class="operator"><</span><span class="type"><a href="qaudiobuffer.html#QAudioBuffer">QAudioBuffer</a></span><span class="operator">::</span>S16U<span class="operator">></span>(); <span class="keyword">for</span> (<span class="type">int</span> i<span class="operator">=</span><span class="number">0</span>; i <span class="operator"><</span> buffer<span class="operator">-</span><span class="operator">></span>frameCount(); i<span class="operator">+</span><span class="operator">+</span>) { <a href="../qtcore/qtalgorithms-obsolete.html#qSwap-1">qSwap</a>(frames<span class="operator">[</span>i<span class="operator">]</span><span class="operator">.</span>left<span class="operator">,</span> frames<span class="operator">[</span>i<span class="operator">]</span><span class="operator">.</span>right); } </pre> </div> <p><b>See also </b><a href="qaudiobuffer-stereoframe.html#S8U-typedef">QAudioBuffer::S8U</a>, <a href="qaudiobuffer-stereoframe.html#S8S-typedef">QAudioBuffer::S8S</a>, <a href="qaudiobuffer-stereoframe.html#S16S-typedef">QAudioBuffer::S16S</a>, <a href="qaudiobuffer-stereoframe.html#S16U-typedef">QAudioBuffer::S16U</a>, and <a href="qaudiobuffer-stereoframe.html#S32F-typedef">QAudioBuffer::S32F</a>.</p> <!-- @@@StereoFrame --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$StereoFrame[overload1]$$$StereoFrame --> <h3 class="fn" id="StereoFrame"><a name="StereoFrame"></a>StereoFrame::<span class="name">StereoFrame</span>()</h3> <p>Constructs a new frame with the "silent" value for this sample format (0 for signed formats and floats, 0x8* for unsigned formats).</p> <!-- @@@StereoFrame --> <!-- $$$StereoFrame$$$StereoFrameTT --> <h3 class="fn" id="StereoFrame-1"><a name="StereoFrame-1"></a>StereoFrame::<span class="name">StereoFrame</span>(<span class="type">T</span> <i>leftSample</i>, <span class="type">T</span> <i>rightSample</i>)</h3> <p>Constructs a new frame with the supplied <i>leftSample</i> and <i>rightSample</i> values.</p> <!-- @@@StereoFrame --> <!-- $$$average[overload1]$$$average --> <h3 class="fn" id="average"><a name="average"></a><span class="type">T</span> StereoFrame::<span class="name">average</span>() const</h3> <p>Returns the arithmetic average of the left and right samples.</p> <!-- @@@average --> <!-- $$$clear[overload1]$$$clear --> <h3 class="fn" id="clear"><a name="clear"></a><span class="type">void</span> StereoFrame::<span class="name">clear</span>()</h3> <p>Sets the values of this frame to the "silent" value.</p> <!-- @@@clear --> <!-- $$$operator=[overload1]$$$operator=constStereoFrame<T>& --> <h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qaudiobuffer-stereoframe.html#StereoFrame">StereoFrame</a></span><<span class="type">T</span>> &StereoFrame::<span class="name">operator=</span>(const <span class="type"><a href="qaudiobuffer-stereoframe.html#StereoFrame">StereoFrame</a></span><<span class="type">T</span>> &<i>other</i>)</h3> <p>Assigns <i>other</i> to this frame.</p> <!-- @@@operator= --> </div> <div class="vars"> <h2>Member Variable Documentation</h2> <!-- $$$left --> <h3 class="fn" id="left-var"><a name="left-var"></a><span class="type">T</span> StereoFrame::<span class="name">left</span></h3> <p>This variable holds the left sample</p> <!-- @@@left --> <!-- $$$right --> <h3 class="fn" id="right-var"><a name="right-var"></a><span class="type">T</span> StereoFrame::<span class="name">right</span></h3> <p>This variable holds the right sample</p> <!-- @@@right --> </div> <div class="relnonmem"> <h2>Related Non-Members</h2> <!-- $$$S16S --> <h3 class="fn" id="S16S-typedef"><a name="S16S-typedef"></a>typedef QAudioBuffer::<span class="name">S16S</span></h3> <p>This is a predefined specialization for a signed stereo 16 bit sample. Each channel is a <i>signed short</i>.</p> <!-- @@@S16S --> <!-- $$$S16U --> <h3 class="fn" id="S16U-typedef"><a name="S16U-typedef"></a>typedef QAudioBuffer::<span class="name">S16U</span></h3> <p>This is a predefined specialization for an unsigned stereo 16 bit sample. Each channel is an <i>unsigned short</i>.</p> <!-- @@@S16U --> <!-- $$$S32F --> <h3 class="fn" id="S32F-typedef"><a name="S32F-typedef"></a>typedef QAudioBuffer::<span class="name">S32F</span></h3> <p>This is a predefined specialization for an 32 bit float sample. Each channel is a <i>float</i>.</p> <!-- @@@S32F --> <!-- $$$S8S --> <h3 class="fn" id="S8S-typedef"><a name="S8S-typedef"></a>typedef QAudioBuffer::<span class="name">S8S</span></h3> <p>This is a predefined specialization for a signed stereo 8 bit sample. Each channel is a <i>signed char</i>.</p> <!-- @@@S8S --> <!-- $$$S8U --> <h3 class="fn" id="S8U-typedef"><a name="S8U-typedef"></a>typedef QAudioBuffer::<span class="name">S8U</span></h3> <p>This is a predefined specialization for an unsigned stereo 8 bit sample. Each channel is an <i>unsigned char</i>.</p> <!-- @@@S8U --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2018 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>