6#include <private/qcore_mac_p.h>
14#include <QtCore/QDataStream>
15#include <QtCore/QDebug>
21#if defined(Q_OS_MACOS)
30 description = getDescription();
32 preferredFormat = determinePreferredFormat();
33 minimumSampleRate = 1;
34 maximumSampleRate = 96000;
35 minimumChannelCount = 1;
36 maximumChannelCount = 16;
41QAudioFormat QCoreAudioDeviceInfo::determinePreferredFormat()
const
45#if defined(Q_OS_MACOS)
46 const auto audioDevicePropertyStreamsAddress =
49 if (
auto streamIDs = getAudioData<AudioStreamID>(m_deviceId, audioDevicePropertyStreamsAddress,
51 const auto audioDevicePhysicalFormatPropertyAddress =
54 for (
auto streamID : *streamIDs) {
55 if (
auto streamDescription = getAudioObject<AudioStreamBasicDescription>(
56 streamID, audioDevicePhysicalFormatPropertyAddress,
57 "prefferedPhysicalFormat")) {
67 format.setSampleRate(44100);
77QString QCoreAudioDeviceInfo::getDescription()
const
82 getAudioObject<CFStringRef>(m_deviceId, propertyAddress,
"Device Description")) {
84 return QString::fromCFString(*
name);
93void QCoreAudioDeviceInfo::getChannelLayout()
96 const auto propertyAddress =
98 if (
auto data = getAudioData<char>(m_deviceId, propertyAddress,
"prefferedChannelLayout",
99 sizeof(AudioChannelLayout))) {
100 const auto *
layout =
reinterpret_cast<const AudioChannelLayout *
>(
data->data());
IOBluetoothDevice * device
static Q_MULTIMEDIA_EXPORT QAudioFormat toQAudioFormat(const AudioStreamBasicDescription &streamFormat)
static QAudioFormat::ChannelConfig fromAudioChannelLayout(const AudioChannelLayout *layout)
QAudioFormat::ChannelConfig channelConfiguration
The QAudioDevice class provides an information about audio devices and their functionality.
Mode
Describes the mode of this device.
QCoreAudioDeviceInfo(const QByteArray &device, QAudioDevice::Mode mode)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Combined button and popup list for selecting options.
static AudioObjectPropertyAddress makePropertyAddress(AudioObjectPropertySelector selector, QAudioDevice::Mode mode, AudioObjectPropertyElement element=kAudioObjectPropertyElementMaster)
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]