Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qaudioengine_p.h
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
4#ifndef QAUDIOENGINE_P_H
5#define QAUDIOENGINE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <qtspatialaudioglobal_p.h>
19#include <qaudioengine.h>
20#include <qaudiodevice.h>
21#include <qaudiodecoder.h>
22#include <qthread.h>
23#include <qmutex.h>
24#include <qurl.h>
25#include <qaudiobuffer.h>
26#include <qvector3d.h>
27#include <qfile.h>
28
29namespace vraudio {
30class ResonanceAudio;
31}
32
33QT_BEGIN_NAMESPACE
34
35class QSpatialSound;
36class QAmbientSound;
37class QAudioSink;
40class QAudioDecoder;
41class QAudioRoom;
42class QAudioListener;
43
45{
46public:
47 static QAudioEnginePrivate *get(QAudioEngine *engine) { return engine ? engine->d : nullptr; }
48
49 static constexpr int bufferSize = 128;
50
53 vraudio::ResonanceAudio *resonanceAudio = nullptr;
54 int sampleRate = 44100;
55 float masterVolume = 1.;
57 bool roomEffectsEnabled = true;
58
59 // Resonance Audio uses meters internally, while Qt Quick 3D and our API uses cm by default.
60 // To make things independent from the scale setting, we store all distances in meters internally
61 // and convert in the setters and getters.
62 float distanceScale = 0.01f;
63
64 QMutex mutex;
65 QAudioDevice device;
66 QAtomicInteger<bool> paused = false;
67
70
71 QAudioListener *listener = nullptr;
75 mutable bool listenerPositionDirty = true;
76 QAudioRoom *currentRoom = nullptr;
77
78 void addSpatialSound(QSpatialSound *sound);
79 void removeSpatialSound(QSpatialSound *sound);
80 void addStereoSound(QAmbientSound *sound);
81 void removeStereoSound(QAmbientSound *sound);
82
83 void addRoom(QAudioRoom *room);
84 void removeRoom(QAudioRoom *room);
85 void updateRooms();
86
88};
89
90QT_END_NAMESPACE
91
92#endif
std::unique_ptr< QAudioDecoder > decoder
QAtomicInteger< bool > m_playing
QAudioEngine * engine
QAmbientSoundPrivate(QObject *parent, int nchannels=2)
QList< QAudioBuffer > buffers
static QAmbientSoundPrivate * get(T *soundSource)
QAtomicInteger< bool > m_autoPlay
void getBuffer(float *buf, int frames, int channels)
std::unique_ptr< QFile > sourceDeviceFile
\inmodule QtSpatialAudio
std::unique_ptr< QAudioOutputStream > outputStream
vraudio::ResonanceAudio * resonanceAudio
void addRoom(QAudioRoom *room)
void addStereoSound(QAmbientSound *sound)
QAtomicInteger< bool > paused
QAudioRoom * currentRoom
QVector3D listenerPosition() const
void removeRoom(QAudioRoom *room)
void addSpatialSound(QSpatialSound *sound)
QAudioEngine::OutputMode outputMode
static QAudioEnginePrivate * get(QAudioEngine *engine)
QList< QAmbientSound * > stereoSources
QList< QSpatialSound * > sources
void removeStereoSound(QAmbientSound *sound)
void removeSpatialSound(QSpatialSound *sound)
QList< QAudioRoom * > rooms
QAudioListener * listener
static constexpr int bufferSize
\inmodule QtCore
Definition qmutex.h:332
Combined button and popup list for selecting options.