- Qt 6.11
- Qt Spatial Audio
- C++ Classes
- QtSpatialAudio
- QAudioListener
- Technology Preview

# 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

- List of all members, including inherited members

## Public Functions

| QAudioListener(QAudioEngine *engine)
virtual | ~QAudioListener() override
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

### `[explicit]` QAudioListener::QAudioListener(QAudioEngine *engine)

Creates a listener for the spatial audio engine for engine.

### `[override virtual noexcept]` 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().