Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qandroidaudioutil.cpp
Go to the documentation of this file.
1
// Copyright (C) 2025 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
#
include
"qandroidaudioutil_p.h"
5
6
#
include
"qandroidaudiodevice_p.h"
7
8
QT_BEGIN_NAMESPACE
9
10
namespace
QAndroidAudioUtil
{
11
12
bool
supportsLowLatency
()
13
{
14
static
const
bool
lowLatencyIsSupported = []() {
15
// clang-format off
16
QJniObject ctx(QNativeInterface::QAndroidApplication::context());
17
if
(!ctx.isValid())
18
return
false
;
19
20
QJniObject pm = ctx.callObjectMethod(
"getPackageManager"
,
21
"()Landroid/content/pm/PackageManager;"
);
22
if
(!pm.isValid())
23
return
false
;
24
25
QJniObject audioFeatureField =
26
QJniObject::getStaticObjectField(
"android/content/pm/PackageManager"
,
27
"FEATURE_AUDIO_LOW_LATENCY"
,
28
"Ljava/lang/String;"
);
29
if
(!audioFeatureField.isValid())
30
return
false
;
31
32
bool
hasFeature = pm.callMethod<jboolean>(
"hasSystemFeature"
,
33
"(Ljava/lang/String;)Z"
,
34
audioFeatureField.object());
35
return
hasFeature;
36
// clang-format on
37
}();
38
39
return
lowLatencyIsSupported;
40
}
41
42
bool
isBluetoothDevice
(
const
QAudioDevice &device)
43
{
44
return
QAudioDevicePrivate::handle<QAndroidAudioDevice>(device)->isBluetoothDevice();
45
}
46
47
}
// namespace QAndroidAudioUtil
48
49
QT_END_NAMESPACE
QAndroidAudioUtil
Definition
qandroidaudioutil.cpp:10
QAndroidAudioUtil::supportsLowLatency
bool supportsLowLatency()
Definition
qandroidaudioutil.cpp:12
QAndroidAudioUtil::isBluetoothDevice
bool isBluetoothDevice(const QAudioDevice &device)
Definition
qandroidaudioutil.cpp:42
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtmultimedia
src
multimedia
android
qandroidaudioutil.cpp
Generated on
for Qt by
1.18.0