summaryrefslogtreecommitdiffstats
path: root/examples/datavisualization/audiolevels/doc
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2021-06-03 13:13:31 +0300
committerTomi Korpipaa <tomi.korpipaa@qt.io>2021-06-03 13:41:10 +0300
commitd54b10e4b9f5b9252993cd7b1c4a124751014db4 (patch)
treef3e7c2c936defd6fd15a3133d5fe0cb5bccd3c0f /examples/datavisualization/audiolevels/doc
parent9d72a4172abde18a8eb0e6db89e1d6ec95fc62ad (diff)
Remove audiolevels example
QtMultimedia module has changed significantly between Qt 5 and Qt 6.2, so it is best to just remove this example and create a new one later on, if necessary. Fixes: QTBUG-94182 Change-Id: I21c6a342d294bec70b15fc702dd6d3749f3c0884 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'examples/datavisualization/audiolevels/doc')
-rw-r--r--examples/datavisualization/audiolevels/doc/images/audiolevels-example.pngbin120978 -> 0 bytes
-rw-r--r--examples/datavisualization/audiolevels/doc/src/audiolevels.qdoc98
2 files changed, 0 insertions, 98 deletions
diff --git a/examples/datavisualization/audiolevels/doc/images/audiolevels-example.png b/examples/datavisualization/audiolevels/doc/images/audiolevels-example.png
deleted file mode 100644
index ec79eb5a..00000000
--- a/examples/datavisualization/audiolevels/doc/images/audiolevels-example.png
+++ /dev/null
Binary files differ
diff --git a/examples/datavisualization/audiolevels/doc/src/audiolevels.qdoc b/examples/datavisualization/audiolevels/doc/src/audiolevels.qdoc
deleted file mode 100644
index 460715b3..00000000
--- a/examples/datavisualization/audiolevels/doc/src/audiolevels.qdoc
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example audiolevels
- \title Audiolevels Example
- \ingroup qtdatavisualization_examples
- \brief Simple application showing real time audio data.
-
- The audiolevels example shows how feed real-time dynamic data to a graph using Q3DBars.
-
- This example reads the audio levels from a microphone and displays those levels
- in a bar graph. To increase the load for demonstration purposes, and to make the
- graph little fancier, slightly modified data is used to fill multiple rows.
-
- \image audiolevels-example.png
-
- The interesting stuff happens in \c AudioLevels and \c AudioLevelsIODevice classes, so we
- concentrate on those and skip explaining the basic Q3DBars functionality - for that see
- \l{Bars Example}.
-
- \include examples-run.qdocinc
-
- \section1 Visualizing Audio Levels
-
- \c AudioLevelsIODevice subclasses QIODevice and is given as input device for QAudioInput
- class, so it receives microphone data.
-
- In the header file for \c AudioLevels class we declare necessary members:
-
- \snippet audiolevels/audiolevels.h 0
-
- And initialize the microphone listening in the source:
-
- \snippet audiolevels/audiolevels.cpp 0
-
- In the header file for \c AudioLevelsIODevice class we store pointers to the data proxy and
- also the data array we give to the proxy, because we reuse the same array to keep memory
- reallocations to the minimum:
-
- \snippet audiolevels/audiolevelsiodevice.h 0
-
- In the source file we define some static constants to define size of the data array and
- the middle row index, as well as the resolution of the visualization. You may need to adjust
- these values to get decent performance in low-end devices:
-
- \snippet audiolevels/audiolevelsiodevice.cpp 1
-
- The \c resolution constant indicates the sample rate, for example, value 8 means every eighth
- byte from audio input is visualized. This is necessary to make the data readable, as it would
- otherwise make the graph scroll too fast.
-
- In the \c AudioLevelsIODevice class constructor we initialize the data array:
-
- \snippet audiolevels/audiolevelsiodevice.cpp 0
-
- The \c AudioLevelsIODevice::writeData function is called whenever there is new audio data
- available to be visualized. There we move the old data along the rows and insert new
- data in the beginning of the rows:
-
- \snippet audiolevels/audiolevelsiodevice.cpp 2
-
- We use a couple of techniques here to improve performance. First, we reuse
- the existing data array, as this allows us to avoid any extra memory allocations in our
- application code. This also means the data array dimensions do not change, which further
- improves efficiency in the bar graph renderer.
- Secondly, since each row is a QList of bar data items, which do not allocate any data that needs
- deletion, we can utilize \c memmove and \c memcpy functions to quickly move and copy data around.
-
- \note In the future versions of Qt Data Visualization, QBarDataItem might get extended so that
- it does allocate some memory to store other optional bar properties besides the value.
- In use cases where those optional properties are used, using \c memmove and \c memcpy could lead to
- memory leaks, so use them with care.
-*/