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
qtaudio.h
Go to the documentation of this file.
1// Copyright (C) 2024 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
5#ifndef QTAUDIO_H
6#define QTAUDIO_H
7
8#if 0
9#pragma qt_class(QtAudio)
10#endif
11
12#include <QtMultimedia/qaudio.h>
13#include <QtCore/qspan.h>
14
15#include <functional>
16#include <QtCore/q20type_traits.h>
17
18QT_BEGIN_NAMESPACE
19
20namespace QtAudioPrivate {
21
22////////////////////////////////////////////////////////////////////////////////////////////////////
23
24template <typename SampleType>
26
27template <typename SampleType>
29
33
37
38////////////////////////////////////////////////////////////////////////////////////////////////////
39
40template <typename F, typename Enabler = void>
42
43template <typename F>
45 F,
47 std::is_invocable_r<void, F, QSpan<const float>>>>>
48 : q20::type_identity<float>
49{
50};
51
52template <typename F>
60
61template <typename F>
69
70template <typename F>
78
79////////////////////////////////////////////////////////////////////////////////////////////////////
80
81template <typename T>
82constexpr inline bool is_std_function_v = false;
83template <typename T>
84constexpr inline bool is_std_function_v<std::function<T>> = true;
85template <typename T>
86constexpr inline bool is_function_pointer_v =
88
89template <typename F>
90constexpr bool isNonnullFunction(const F &f)
91{
92 if constexpr (is_std_function_v<F> || is_function_pointer_v<F>)
93 return bool(f);
94 else
95 return true; // assume callable is non-null
96}
97
98template <typename F, typename... T>
99constexpr inline bool isInvokableWithSpan =
100 std::disjunction_v<std::is_invocable_r<void, F, QSpan<T>>...>;
101
102////////////////////////////////////////////////////////////////////////////////////////////////////
103
104} // namespace QtAudioPrivate
105
106namespace QtAudio {
107
108template <typename F>
109constexpr inline bool isAudioSourceCallback =
110 QtAudioPrivate::isInvokableWithSpan<F, const float, const uint8_t, const int16_t,
111 const int32_t>;
112
113template <typename F>
114constexpr inline bool isAudioSinkCallback =
116
117template <typename Callback>
119
120template <typename Callback>
122
123} // namespace QtAudio
124
125QT_END_NAMESPACE
126
127#endif // QTAUDIO_H
Combined button and popup list for selecting options.
constexpr bool is_std_function_v< std::function< T > >
Definition qtaudio.h:84
constexpr bool is_std_function_v
Definition qtaudio.h:82
constexpr bool isNonnullFunction(const F &f)
Definition qtaudio.h:90
constexpr bool isInvokableWithSpan
Definition qtaudio.h:99
constexpr bool is_function_pointer_v
Definition qtaudio.h:86
std::enable_if_t< isAudioSourceCallback< Callback >, bool > if_audio_source_callback
Definition qtaudio.h:118
constexpr bool isAudioSourceCallback
Definition qtaudio.h:109
float convertVolume(float volume, VolumeScale from, VolumeScale to)
Converts an audio volume from a volume scale to another, and returns the result.
Definition qtaudio.cpp:98
constexpr bool isAudioSinkCallback
Definition qtaudio.h:114
QDebug operator<<(QDebug debug, QIODevice::OpenMode modes)
#define LOG100
Definition qtaudio.cpp:11