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
qandroidaudiodevice.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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/qaudioformat_p.h>
7#include <private/qaudiodevice_p.h>
8
9#include <QtCore/qjniobject.h>
10
12
13namespace {
14
16createAndroidAudioDeviceFormatFromPreferred(const QAudioFormat &preferredFormat)
17{
18 QAudioDevicePrivate::AudioDeviceFormat format;
19
20 format.preferredFormat = preferredFormat;
21
22 // Report support for everything that Qt supports, as Android should be able to resample and
23 // up/downmix if needed
24 format.minimumChannelCount = 1;
25 format.maximumChannelCount = 32;
26 format.minimumSampleRate = QtMultimediaPrivate::allSupportedSampleRates.front();
27 format.maximumSampleRate = QtMultimediaPrivate::allSupportedSampleRates.back();
28 format.supportedSampleFormats = qAllSupportedSampleFormats();
29 format.channelConfiguration = preferredFormat.channelConfig();
30
31 return format;
32}
33
34} // namespace
35
36QAndroidAudioDevice::QAndroidAudioDevice(QByteArray device, QString desc, QAudioDevice::Mode mode,
37 QAudioFormat format, bool isBluetoothDevice,
38 bool isDefaultDevice)
39 : QAudioDevicePrivate{ std::move(device), mode, std::move(desc), isDefaultDevice,
40 createAndroidAudioDeviceFormatFromPreferred(format) },
41 m_isBluetoothDevice(isBluetoothDevice)
42{
43}
44
45bool QAndroidAudioDevice::isBluetoothDevice() const
46{
47 return m_isBluetoothDevice;
48}
49
50QT_END_NAMESPACE
Combined button and popup list for selecting options.
QAudioDevicePrivate::AudioDeviceFormat createAndroidAudioDeviceFormatFromPreferred(const QAudioFormat &preferredFormat)