Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquick3daudiolistener.cpp
Go to the documentation of this file.
1
// Copyright (C) 2022 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-3.0-only
3
#
include
"qquick3daudiolistener_p.h"
4
5
#
include
<
QtQuick3DSpatialAudio
/
private
/
qquick3daudioengine_p
.
h
>
6
#
include
<
QtQuick3DSpatialAudio
/
private
/
qquick3dspatialsound_p
.
h
>
7
8
QT_BEGIN_NAMESPACE
9
10
/*!
11
\qmltype AudioListener
12
\nativetype QQuick3DAudioListener
13
\inqmlmodule QtQuick3D.SpatialAudio
14
\ingroup quick3d_spatialaudio
15
\ingroup multimedia_audio_qml
16
17
\brief Defines the position and orientation of the person listening to a
18
sound field defined by a AudioEngine.
19
20
A AudioEngine can have exactly one listener, that defines the position and orientation
21
of the person listening to the sounds defined by the objects placed within the audio engine.
22
23
In most cases, the AudioListener should simply be a child of the Camera element in
24
\l[QML]{QtQuick3D}.
25
This will ensure that the sound experience is aligned with the visual rendering of the scene.
26
*/
27
28
QQuick3DAudioListener::QQuick3DAudioListener()
29
{
30
m_listener =
new
QAudioListener(QQuick3DAudioEngine::getEngine());
31
connect(
this
, &QQuick3DNode::scenePositionChanged,
this
, &QQuick3DAudioListener::updatePosition);
32
connect(
this
, &QQuick3DNode::sceneRotationChanged,
this
, &QQuick3DAudioListener::updateRotation);
33
updatePosition();
34
updateRotation();
35
}
36
37
QQuick3DAudioListener::~QQuick3DAudioListener()
38
{
39
delete
m_listener;
40
}
41
42
void
QQuick3DAudioListener::updatePosition()
43
{
44
m_listener->setPosition(scenePosition());
45
}
46
47
void
QQuick3DAudioListener::updateRotation()
48
{
49
m_listener->setRotation(sceneRotation());
50
}
51
52
QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
spatialaudioquick3d
qquick3daudiolistener.cpp
Generated on
for Qt by
1.18.0