/****************************************************************************
**
** Copyright (C) 2017 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 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.png

    \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 in \c {audio-visualizer-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
    \c {audio-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{NodeInstantiator} 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 \c {audio-visualizer-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.

*/
