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
qcoreaudiodevices_p.h
Go to the documentation of this file.
1
// Copyright (C) 2021 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
#
ifndef
QCOREAUDIODEVICES_H
5
#
define
QCOREAUDIODEVICES_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
private
/
qplatformaudiodevices_p
.
h
>
19
20
#
ifdef
Q_OS_MACOS
21
#
include
<
QtCore
/
qfuture
.
h
>
22
#
include
<
CoreAudio
/
AudioHardware
.
h
>
23
#
include
<
dispatch
/
dispatch
.
h
>
24
#
include
<
memory
>
25
#
include
<
optional
>
26
#
endif
27
28
QT_BEGIN_NAMESPACE
29
30
class
QCoreAudioDevices :
public
QPlatformAudioDevices
31
{
32
public
:
33
QCoreAudioDevices();
34
~QCoreAudioDevices() override;
35
36
QPlatformAudioSource *createAudioSource(
const
QAudioDevice &,
const
QAudioFormat &,
37
QObject *parent) override;
38
QPlatformAudioSink *createAudioSink(
const
QAudioDevice &,
const
QAudioFormat &,
39
QObject *parent) override;
40
41
using
QPlatformAudioDevices::updateAudioInputsCache;
42
using
QPlatformAudioDevices::updateAudioOutputsCache;
43
44
QLatin1String backendName()
const
override {
return
QLatin1String{
"CoreAudio"
}; }
45
bool
hasCallbackApi()
const
override {
return
true
; }
46
47
private
:
48
QList<QAudioDevice> findAudioInputs()
const
override;
49
QList<QAudioDevice> findAudioOutputs()
const
override;
50
#
ifdef
Q_OS_MACOS
51
struct
DispatchQueueDeleter
52
{
53
void
operator()(dispatch_queue_t queue)
const
54
{
55
if
(queue)
56
dispatch_release(queue);
57
}
58
};
59
using
UniqueDispatchQueue =
60
std::unique_ptr<std::remove_pointer_t<dispatch_queue_t>, DispatchQueueDeleter>;
61
62
std::shared_ptr<AudioObjectPropertyListenerBlock> m_deviceListenerBlock;
63
UniqueDispatchQueue m_listenerQueue;
64
std::shared_ptr<
bool
> m_destroyed = std::make_shared<
bool
>(
false
);
65
#
endif
66
};
67
68
namespace
QCoreAudioUtils
{
69
70
#
ifdef
Q_OS_MACOS
71
class
DeviceDisconnectMonitor
final
:
public
QObject
72
{
73
public
:
74
~
DeviceDisconnectMonitor
();
75
std
::
optional
<
QFuture
<
void
>>
setDisconnectListener
(
AudioObjectID
);
76
77
private
:
78
struct
State
79
{
80
AudioObjectID
id
;
81
std
::
shared_ptr
<
AudioObjectPropertyListenerBlock
>
block
;
82
};
83
84
std
::
optional
<
State
>
m_state
;
85
};
86
#
endif
87
88
}
// namespace QCoreAudioUtils
89
90
QT_END_NAMESPACE
91
92
#
endif
// QCOREAUDIODEVICES_H
QCoreAudioUtils
Definition
qcoreaudiodevices.mm:277
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
__has_feature
#define __has_feature(x)
Definition
qcompilerdetection.h:447
qtmultimedia
src
multimedia
coreaudio
qcoreaudiodevices_p.h
Generated on
for Qt by
1.18.0