summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/audio-visualizer-qml/doc
diff options
context:
space:
mode:
authorTitta Heikkala <titta.heikkala@theqtcompany.com>2015-11-06 10:57:30 +0200
committerSean Harmer <sean.harmer@kdab.com>2016-01-22 09:52:16 +0000
commita203ce0742105557a7e4641f6a37e462f231d0b0 (patch)
treec7db18c9c4017af908f2ed3b1ff4a2402cdfd6e9 /examples/qt3d/audio-visualizer-qml/doc
parent44c743c90cf51eddbf5b0bb3cf957c58fa0ef94f (diff)
Added Audio Visualizer example
Example visualizes the magnitude of music played as animated bars. The music is played using media player. Implementation combines the use of Qt 3D rendering with Qt Quick 2D elements. Change-Id: I945d50d0dbd26151f274269649cca793a5ad4d27 Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> Reviewed-by: Pasi Keränen <pasi.keranen@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/audio-visualizer-qml/doc')
-rw-r--r--examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc97
1 files changed, 97 insertions, 0 deletions
diff --git a/examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc b/examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc
new file mode 100644
index 000000000..ddd89de33
--- /dev/null
+++ b/examples/qt3d/audio-visualizer-qml/doc/src/audio-visualizer-qml.qdoc
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example audio-visualizer-qml
+ \title Qt 3D: Audio Visualizer Example
+ \ingroup qt3d-examples-qml
+ \brief Demonstrates combining Qt 3D rendering and Qt Quick 2 elements.
+
+ \image audio-visualizer-qml-example.jpg
+
+ \e Audio Visualizer demonstrates how to implement an application that combines the use of
+ Qt 3D rendering with Qt Quick 2D elements. The example uses media player to play music and it
+ visualizes the magnitude of the music as animated bars.
+
+ \include examples-run.qdocinc
+
+ \section1 Qt Quick 2D Implementation
+
+ The Qt Quick Implementation \l{audio-visualizer-qml/main.qml}{main.qml} of the example uses
+ \c{MediaPlayer} to play audio content.
+
+ \snippet audio-visualizer-qml/main.qml 0
+
+ The player is controlled with the \c{playButton} and c\{stopButton}. Based on the clicked
+ buttons the \c{state} of the \c{mainview} changes.
+
+ The 3D content is rendered using the \c{Scene3D} type. The state of the Audio Visualizer is
+ maintained in the \c{mainview}. It's passed on to the \c{visualizer} as it's needed for the bar
+ animations.
+
+ \snippet audio-visualizer-qml/main.qml 1
+
+ \section1 Qt 3D Implementation
+
+ The 3D elements of the example are created in the
+ \l{audio-visualizer-qml/Visualizer.qml}{Visualizer.qml}. The camera is set to a fixed position
+ to show the visualized bars from a correct angle.
+
+ \snippet audio-visualizer-qml/Visualizer.qml 0
+
+ A \c{NodeInstatiator} is used to create the bars that visualize the magnitude of the music.
+
+ \snippet audio-visualizer-qml/Visualizer.qml 1
+
+ The \c{visualizer} also contains an \c{Entity} to show the progress. This element has a curve
+ shaped mesh and it's rotated on a level to show the progress based on the duration of the played
+ track.
+
+ \snippet audio-visualizer-qml/Visualizer.qml 2
+
+ In \l{audio-visualizer-qml/BarEntity.qml}{BarEntity.qml} there are animations for rotating the
+ bars and changing the bar color. The bars are rotated on a level following a ring form. At the
+ same time the color of the bars is animated.
+
+ \snippet audio-visualizer-qml/BarEntity.qml 0
+
+ \snippet audio-visualizer-qml/BarEntity.qml 1
+
+ The magnitude of each bar is read from a separate .raw file that is based on the track being
+ played. As the bars rotate around the ring the height is scaled to highlight currently played
+ position. After a full round of rotation, a new value is fetched for the bar.
+
+*/