Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qaudiodevice.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
4#include "qaudiosystem_p.h"
5#include "qaudiodevice_p.h"
6#include <private/qplatformmediadevices_p.h>
7#include <private/qplatformmediaintegration_p.h>
8
9#include <QtCore/qmap.h>
10
12
14
16
64
92
97
112
117
129{
130 if (d == other.d)
131 return true;
132 if (!d || !other.d)
133 return false;
134 if (d->mode == other.d->mode && d->id == other.d->id && d->isDefault == other.d->isDefault)
135 return true;
136 return false;
137}
138
144{
145 return !operator==(other);
146}
147
152{
153 return d == nullptr;
154}
155
176{
177 return isNull() ? QByteArray() : d->id;
178}
179
196{
197 return isNull() ? QString() : d->description;
198}
199
212{
213 return d ? d->isDefault : false;
214}
215
221{
222 if (isNull())
223 return false;
224 if (settings.sampleRate() < d->minimumSampleRate
225 || settings.sampleRate() > d->maximumSampleRate)
226 return false;
227 if (settings.channelCount() < d->minimumChannelCount
228 || settings.channelCount() > d->maximumChannelCount)
229 return false;
230 if (!d->supportedSampleFormats.contains(settings.sampleFormat()))
231 return false;
232 return true;
233}
234
252
257{
258 return isNull() ? 0 : d->minimumSampleRate;
259}
260
265{
266 return isNull() ? 0 : d->maximumSampleRate;
267}
268
275{
276 return isNull() ? 0 : d->minimumChannelCount;
277}
278
285{
286 return isNull() ? 0 : d->maximumChannelCount;
287}
288
292QList<QAudioFormat::SampleFormat> QAudioDevice::supportedSampleFormats() const
293{
294 return isNull() ? QList<QAudioFormat::SampleFormat>() : d->supportedSampleFormats;
295}
296
304
313
347{
348 return d ? d->mode : Null;
349}
350
351#ifndef QT_NO_DEBUG_STREAM
353{
354 QDebugStateSaver saver(dbg);
355 dbg.nospace();
356 switch (mode) {
358 dbg << "QAudioDevice::Input";
359 break;
361 dbg << "QAudioDevice::Output";
362 break;
364 dbg << "QAudioDevice::Null";
365 break;
366 }
367 return dbg;
368}
369#endif
370
372
373#include "moc_qaudiodevice.cpp"
QAudioDevice::Mode mode
QAudioFormat::ChannelConfig channelConfiguration
QAudioFormat preferredFormat
QList< QAudioFormat::SampleFormat > supportedSampleFormats
virtual ~QAudioDevicePrivate()
The QAudioDevice class provides an information about audio devices and their functionality.
bool isFormatSupported(const QAudioFormat &format) const
Returns true if the supplied settings are supported by the audio device described by this QAudioDevic...
int maximumSampleRate() const
Returns the maximum supported sample rate (in Hertz).
QAudioFormat::ChannelConfig channelConfiguration() const
Returns the channel configuration of the device.
QString description
\qmlproperty string QtMultimedia::audioDevice::description
Mode mode
\qmlproperty enumeration QtMultimedia::audioDevice::mode
Mode
Describes the mode of this device.
~QAudioDevice()
Destroy this audio device info.
bool operator==(const QAudioDevice &other) const
Returns true if this QAudioDevice class represents the same audio device as other.
QByteArray id
\qmlproperty string QtMultimedia::audioDevice::id
int maximumChannelCount() const
Returns the maximum number of supported channel counts.
QAudioDevice & operator=(const QAudioDevice &other)
Sets the QAudioDevice object to be equal to other.
QAudioFormat preferredFormat() const
Returns the default audio format settings for this device.
QList< QAudioFormat::SampleFormat > supportedSampleFormats() const
Returns a list of supported sample types.
int minimumChannelCount() const
Returns the minimum number of supported channel counts.
int minimumSampleRate() const
Returns the minimum supported sample rate (in Hertz).
bool operator!=(const QAudioDevice &other) const
Returns true if this QAudioDevice class represents a different audio device than other.
bool isDefault
\qmlproperty bool QtMultimedia::audioDevice::isDefault
bool isNull() const
Returns whether this QAudioDevice object holds a valid device definition.
QAudioDevice()
Describes an audio device.
The QAudioFormat class stores audio stream parameter information.
ChannelConfig
\variable QAudioFormat::NChannelPositions
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
QDebug operator<<(QDebug dbg, QAudioDevice::Mode mode)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
GLenum mode
GLfloat GLfloat p
[1]
#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class)
QSettings settings("MySoft", "Star Runner")
[0]
QSharedPointer< T > other(t)
[5]
bool contains(const AT &t) const noexcept
Definition qlist.h:45