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
qaudiodevice_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-2.0-only OR GPL-3.0-only
3
4
5#ifndef QAUDIODEVICEINFO_P_H
6#define QAUDIODEVICEINFO_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtMultimedia/qaudiodevice.h>
20#include <QtCore/private/qglobal_p.h>
21
23
24// Implementations should not include volatile members, such as values that can change between
25// connection sessions. For example, CoreAudio AudioDeviceId on macOS.
26class Q_MULTIMEDIA_EXPORT QAudioDevicePrivate : public QSharedData
27{
28public:
29 QAudioDevicePrivate(QByteArray i, QAudioDevice::Mode m, QString description)
30 : id(std::move(i)), mode(m), description(std::move(description))
31 {}
32 virtual ~QAudioDevicePrivate();
33 const QByteArray id;
34 const QAudioDevice::Mode mode = QAudioDevice::Output;
35 const QString description;
36 bool isDefault = false;
37
38 QAudioFormat preferredFormat;
39 int minimumSampleRate = 0;
40 int maximumSampleRate = 0;
41 int minimumChannelCount = 0;
42 int maximumChannelCount = 0;
43 QList<QAudioFormat::SampleFormat> supportedSampleFormats;
44 QAudioFormat::ChannelConfig channelConfiguration = QAudioFormat::ChannelConfigUnknown;
45
46 QAudioDevice create() { return QAudioDevice(this); }
47};
48
50{
51 static const auto singleton = QList<QAudioFormat::SampleFormat>{
52 QAudioFormat::UInt8,
53 QAudioFormat::Int16,
54 QAudioFormat::Int32,
55 QAudioFormat::Float,
56 };
57 return singleton;
58}
59
61{
62 bool operator()(const QAudioDevicePrivate &lhs, const QAudioDevicePrivate &rhs)
63 {
64 auto asTuple = [](const QAudioDevicePrivate &x) {
65 return std::tie(x.id, x.mode, x.isDefault, x.preferredFormat, x.description,
66 x.minimumSampleRate, x.maximumSampleRate, x.minimumChannelCount,
67 x.maximumChannelCount, x.supportedSampleFormats,
68 x.channelConfiguration);
69 };
70
71 return asTuple(lhs) == asTuple(rhs);
72 }
73};
74
75QT_END_NAMESPACE
76
77#endif // QAUDIODEVICEINFO_H
Combined button and popup list for selecting options.
const QList< QAudioFormat::SampleFormat > & qAllSupportedSampleFormats()
QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2462
bool operator()(const QAudioDevicePrivate &lhs, const QAudioDevicePrivate &rhs)