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
qohosaudiodevice.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 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
5
6#include <private/qaudiodevice_p.h>
7#include <private/qaudioformat_p.h>
8
10
11namespace {
12
14createOhosAudioDeviceFormatFromPreferred(const QAudioFormat &preferredFormat)
15{
16 QAudioDevicePrivate::AudioDeviceFormat format;
17
18 format.preferredFormat = preferredFormat;
19
20 format.minimumChannelCount = 1;
21 format.maximumChannelCount = 32;
22 format.minimumSampleRate = QtMultimediaPrivate::allSupportedSampleRates.front();
23 format.maximumSampleRate = QtMultimediaPrivate::allSupportedSampleRates.back();
24 format.supportedSampleFormats = qAllSupportedSampleFormats();
25 format.channelConfiguration = preferredFormat.channelConfig();
26
27 return format;
28}
29
30} // namespace
31
32QOhosAudioDevice::QOhosAudioDevice(QByteArray id, QString description, QAudioDevice::Mode mode,
33 QAudioFormat preferredFormat, bool isDefaultDevice)
34 : QAudioDevicePrivate{ std::move(id), mode, std::move(description), isDefaultDevice,
35 createOhosAudioDeviceFormatFromPreferred(preferredFormat) }
36{
37}
38
39QT_END_NAMESPACE
Combined button and popup list for selecting options.
QAudioDevicePrivate::AudioDeviceFormat createOhosAudioDeviceFormatFromPreferred(const QAudioFormat &preferredFormat)