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
qambisonicdecoder_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#ifndef QAMBISONICDECODER_P_H
4#define QAMBISONICDECODER_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <QtSpatialAudio/private/qtspatialaudioglobal_p.h>
18#include <QtMultimedia/qaudioformat.h>
19#include <QtCore/qspan.h>
20
21#include <memory>
22
23QT_BEGIN_NAMESPACE
24
25struct QAmbisonicDecoderData;
27
29{
30public:
39 QAmbisonicDecoder(AmbisonicOrder ambisonicOrder, const QAudioFormat &format);
41
42 bool hasValidConfig() const { return outputChannels > 0; }
43
44 int nInputChannels() const { return inputChannels; }
45 int nOutputChannels() const { return outputChannels; }
46
47 int outputSize(int nSamples) const { return outputChannels * nSamples; }
48
49 // input is planar, output interleaved
50 void processBuffer(QSpan<const float *> input, QSpan<float> output);
51 void processBuffer(QSpan<const float *> input, QSpan<short> output);
52
53 void processBufferWithReverb(QSpan<const float *> input, QSpan<const float *, 2> reverb,
54 QSpan<short> output);
55
56 static constexpr int maxAmbisonicChannels = 16;
57 static constexpr int maxAmbisonicOrder = 3;
58
59private:
60 QAudioFormat::ChannelConfig channelConfig;
62 int inputChannels = 0;
63 int outputChannels = 0;
64 const QAmbisonicDecoderData *decoderData = nullptr;
65 std::unique_ptr<QAmbisonicDecoderFilter[]> filters;
66 std::unique_ptr<float[]> simpleDecoderFactors;
67
68 const float *reverbFactors = nullptr;
69 std::unique_ptr<float[]> m_reverbFactorsOwned;
70};
71
72
73QT_END_NAMESPACE
74
75#endif
QAmbisonicDecoderFilter()=default
void configure(float sampleRate, float cutoffFrequency=380)
static constexpr int maxAmbisonicOrder
void processBuffer(QSpan< const float * > input, QSpan< float > output)
QAmbisonicDecoder(AmbisonicOrder ambisonicOrder, const QAudioFormat &format)
static constexpr int maxAmbisonicChannels
int outputSize(int nSamples) const
bool hasValidConfig() const
void processBufferWithReverb(QSpan< const float * > input, QSpan< const float *, 2 > reverb, QSpan< short > output)
static constexpr QAmbisonicDecoderData decoderMap[]
constexpr float reverb_x_1[]
constexpr float reverb_x_0[]
#define M_PI
Definition qmath.h:201