QAudioListener Class

Defines the position and orientation of the person listening to a sound field defined by QAudioEngine. More...

Header: #include <QAudioListener>
CMake: find_package(Qt6 REQUIRED COMPONENTS SpatialAudio)
target_link_libraries(mytarget PRIVATE Qt6::SpatialAudio)
qmake: QT += spatialaudio
Inherits: QObject

Public Functions

QAudioListener(QAudioEngine *engine)
virtual ~QAudioListener()
QAudioEngine *engine() const
QVector3D position() const
QQuaternion rotation() const
void setPosition(QVector3D pos)
void setRotation(const QQuaternion &q)

Detailed Description

A QAudioEngine can have exactly one listener that defines the position and orientation of the person listening to the sound field.

Member Function Documentation

QAudioListener::QAudioListener(QAudioEngine *engine)

Creates a listener for the spatial audio engine for engine.

[virtual] QAudioListener::~QAudioListener()

Destroys the listener.

QAudioEngine *QAudioListener::engine() const

Returns the engine associated with this listener.

QVector3D QAudioListener::position() const

Returns the current position of the listener.

See also setPosition().

QQuaternion QAudioListener::rotation() const

Returns the listener's orientation in 3D space.

See also setRotation().

void QAudioListener::setPosition(QVector3D pos)

Sets the listener's position in 3D space to pos. Units are in centimeters by default.

See also position() and QAudioEngine::distanceScale.

void QAudioListener::setRotation(const QQuaternion &q)

Sets the listener's orientation in 3D space to q.

See also rotation().

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.