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
12
13namespace {
14
16createOhosAudioDeviceFormatFromPreferred(const QAudioFormat &preferredFormat,
17 int maximumChannelCount)
18{
19 QAudioDevicePrivate::AudioDeviceFormat format;
20
21 format.preferredFormat = preferredFormat;
22
23 // A mono stream is upmixed and the stream resamples, so only the maximum
24 // channel count is taken from the device.
25 format.minimumChannelCount = 1;
26 format.maximumChannelCount = maximumChannelCount > 0 ? maximumChannelCount : 32;
27 format.minimumSampleRate = QtMultimediaPrivate::allSupportedSampleRates.front();
28 format.maximumSampleRate = QtMultimediaPrivate::allSupportedSampleRates.back();
29 format.supportedSampleFormats = qAllSupportedSampleFormats();
30 format.channelConfiguration = preferredFormat.channelConfig();
31
32 return format;
33}
34
35} // namespace
36
37QOhosAudioDevice::QOhosAudioDevice(QByteArray id, QString description, QAudioDevice::Mode mode,
38 QAudioFormat preferredFormat, int maximumChannelCount,
39 bool isDefaultDevice)
40 : QAudioDevicePrivate{ std::move(id), mode, std::move(description), isDefaultDevice,
41 createOhosAudioDeviceFormatFromPreferred(preferredFormat, maximumChannelCount) }
42{
43}
44
45QT_END_NAMESPACE
Combined button and popup list for selecting options.
QAudioDevicePrivate::AudioDeviceFormat createOhosAudioDeviceFormatFromPreferred(const QAudioFormat &preferredFormat, int maximumChannelCount)