18#include <QtCore/qt_windows.h>
19#include <QtCore/QDataStream>
20#include <QtCore/QIODevice>
22#include <audioclient.h>
27#include <propkeydef.h>
28#include <mmdeviceapi.h>
35 m_immDev(
std::move(immDev))
42 HRESULT hr = m_immDev->Activate(__uuidof(IAudioClient), CLSCTX_INPROC_SERVER,
nullptr,
43 (
void **)audioClient.GetAddressOf());
45 WAVEFORMATEX *pwfx =
nullptr;
46 hr = audioClient->GetMixFormat(&pwfx);
61 if (waveOutGetDevCaps(m_devId, &woc,
sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR)
65 if (waveInGetDevCaps(m_devId, &woc,
sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR)
73 if ((
fmt & WAVE_FORMAT_1M08)
74 || (
fmt & WAVE_FORMAT_1S08)
75 || (
fmt & WAVE_FORMAT_2M08)
76 || (
fmt & WAVE_FORMAT_2S08)
77 || (
fmt & WAVE_FORMAT_4M08)
78 || (
fmt & WAVE_FORMAT_4S08)
79 || (
fmt & WAVE_FORMAT_48M08)
80 || (
fmt & WAVE_FORMAT_48S08)
81 || (
fmt & WAVE_FORMAT_96M08)
82 || (
fmt & WAVE_FORMAT_96S08)) {
85 if ((
fmt & WAVE_FORMAT_1M16)
86 || (
fmt & WAVE_FORMAT_1S16)
87 || (
fmt & WAVE_FORMAT_2M16)
88 || (
fmt & WAVE_FORMAT_2S16)
89 || (
fmt & WAVE_FORMAT_4M16)
90 || (
fmt & WAVE_FORMAT_4S16)
91 || (
fmt & WAVE_FORMAT_48M16)
92 || (
fmt & WAVE_FORMAT_48S16)
93 || (
fmt & WAVE_FORMAT_96M16)
94 || (
fmt & WAVE_FORMAT_96S16)) {
101 if ((
fmt & WAVE_FORMAT_1M08)
102 || (
fmt & WAVE_FORMAT_1S08)
103 || (
fmt & WAVE_FORMAT_1M16)
104 || (
fmt & WAVE_FORMAT_1S16)) {
108 if ((
fmt & WAVE_FORMAT_2M08)
109 || (
fmt & WAVE_FORMAT_2S08)
110 || (
fmt & WAVE_FORMAT_2M16)
111 || (
fmt & WAVE_FORMAT_2S16)) {
115 if ((
fmt & WAVE_FORMAT_4M08)
116 || (
fmt & WAVE_FORMAT_4S08)
117 || (
fmt & WAVE_FORMAT_4M16)
118 || (
fmt & WAVE_FORMAT_4S16)) {
122 if ((
fmt & WAVE_FORMAT_48M08)
123 || (
fmt & WAVE_FORMAT_48S08)
124 || (
fmt & WAVE_FORMAT_48M16)
125 || (
fmt & WAVE_FORMAT_48S16)) {
129 if ((
fmt & WAVE_FORMAT_96M08)
130 || (
fmt & WAVE_FORMAT_96S08)
131 || (
fmt & WAVE_FORMAT_96M16)
132 || (
fmt & WAVE_FORMAT_96S16)) {
142 if (
fmt & WAVE_FORMAT_1M08
143 ||
fmt & WAVE_FORMAT_1M16
144 ||
fmt & WAVE_FORMAT_2M08
145 ||
fmt & WAVE_FORMAT_2M16
146 ||
fmt & WAVE_FORMAT_4M08
147 ||
fmt & WAVE_FORMAT_4M16
148 ||
fmt & WAVE_FORMAT_48M08
149 ||
fmt & WAVE_FORMAT_48M16
150 ||
fmt & WAVE_FORMAT_96M08
151 ||
fmt & WAVE_FORMAT_96M16) {
155 if (
fmt & WAVE_FORMAT_1S08
156 ||
fmt & WAVE_FORMAT_1S16
157 ||
fmt & WAVE_FORMAT_2S08
158 ||
fmt & WAVE_FORMAT_2S16
159 ||
fmt & WAVE_FORMAT_4S08
160 ||
fmt & WAVE_FORMAT_4S16
161 ||
fmt & WAVE_FORMAT_48S08
162 ||
fmt & WAVE_FORMAT_48S16
163 ||
fmt & WAVE_FORMAT_96S08
164 ||
fmt & WAVE_FORMAT_96S16) {
186 testFormat = defaultTestFormat;
187 for (
int i = 18;
i > 2; --
i) {
198 hr = m_immDev->OpenPropertyStore(STGM_READ,
props.GetAddressOf());
201 PropVariantInit(&
var);
202 hr =
props->GetValue(PKEY_AudioEndpoint_PhysicalSpeakers, &
var);
203 if (SUCCEEDED(hr) &&
var.uintVal != 0)
214 WAVEFORMATEXTENSIBLE wfx;
218 return (waveOutOpen(NULL, UINT_PTR(m_devId), &wfx.Format, 0, 0,
219 WAVE_FORMAT_QUERY) == MMSYSERR_NOERROR);
221 return (waveInOpen(NULL, UINT_PTR(m_devId), &wfx.Format, 0, 0,
222 WAVE_FORMAT_QUERY) == MMSYSERR_NOERROR);
QAudioFormat::ChannelConfig channelConfiguration
QAudioFormat preferredFormat
QList< QAudioFormat::SampleFormat > supportedSampleFormats
Mode
Describes the mode of this device.
void append(parameter_type t)
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool testSettings(const QAudioFormat &format) const
~QWindowsAudioDeviceInfo()
QWindowsAudioDeviceInfo(QByteArray dev, ComPtr< IMMDevice > immdev, int waveID, const QString &description, QAudioDevice::Mode mode)
Combined button and popup list for selecting options.
QAudioFormat waveFormatExToFormat(const WAVEFORMATEX &in)
bool formatToWaveFormatExtensible(const QAudioFormat &format, WAVEFORMATEXTENSIBLE &wfx)
QAudioFormat::ChannelConfig maskToChannelConfig(UINT32 mask, int count)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLenum GLuint GLsizei const GLenum * props
GLint GLsizei GLsizei GLenum format
QVideoFrameFormat::PixelFormat fmt