53 #include <QtCore/qstringlist.h> 54 #include <QtCore/qlist.h> 55 #include <QtCore/qbytearray.h> 56 #include <QtCore/qdatastream.h> 57 #include <QtCore/qdebug.h> 58 #include <private/qcore_mac_p.h> 60 #include <QtMultimedia/qaudiodeviceinfo.h> 74 ds >> did >> tm >>
name;
96 if (AudioDeviceGetPropertyInfo(
deviceId,
99 kAudioDevicePropertyStreams,
103 const int sc = propSize /
sizeof(AudioStreamID);
106 AudioStreamID* streams =
new AudioStreamID[sc];
108 if (AudioDeviceGetProperty(
deviceId,
111 kAudioDevicePropertyStreams,
115 for (
int i = 0; i < sc; ++i) {
116 if (AudioStreamGetPropertyInfo(streams[i],
118 kAudioStreamPropertyPhysicalFormat,
122 AudioStreamBasicDescription sf;
124 if (AudioStreamGetProperty(streams[i],
126 kAudioStreamPropertyPhysicalFormat,
182 rc << 8000 << 11025 << 22050 << 44100;
187 if (AudioDeviceGetPropertyInfo(
deviceId,
190 kAudioDevicePropertyAvailableNominalSampleRates,
194 const int pc = propSize /
sizeof(AudioValueRange);
197 AudioValueRange* vr =
new AudioValueRange[pc];
199 if (AudioDeviceGetProperty(
deviceId,
202 kAudioDevicePropertyAvailableNominalSampleRates,
206 for (
int i = 0; i < pc; ++i)
207 rc << vr[i].mMaximum;
227 if (AudioDeviceGetPropertyInfo(
deviceId,
230 kAudioDevicePropertyStreamConfiguration,
234 AudioBufferList* audioBufferList =
static_cast<AudioBufferList*
>(
qMalloc(propSize));
236 if (audioBufferList != 0) {
237 if (AudioDeviceGetProperty(
deviceId,
240 kAudioDevicePropertyStreamConfiguration,
242 audioBufferList) == noErr) {
244 for (
int i = 0; i < int(audioBufferList->mNumberBuffers); ++i) {
245 channels += audioBufferList->mBuffers[i].mNumberChannels;
250 qFree(audioBufferList);
259 return QList<int>() << 8 << 16 << 24 << 32 << 64;
277 AudioStreamBasicDescription sf;
285 size =
sizeof(AudioStreamBasicDescription);
286 if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioDevicePropertyStreamFormat,
287 &size, &sf) != noErr) {
294 if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioObjectPropertyName,
295 &size, &name) != noErr) {
296 qWarning() <<
"QAudioDeviceInfo: Unable to find device name";
307 AudioDeviceID audioDevice;
308 UInt32 size =
sizeof(audioDevice);
310 if (AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size,
311 &audioDevice) != noErr) {
312 qWarning() <<
"QAudioDeviceInfo: Unable to find default input device";
321 AudioDeviceID audioDevice;
322 UInt32 size =
sizeof(audioDevice);
324 if (AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size,
325 &audioDevice) != noErr) {
326 qWarning() <<
"QAudioDeviceInfo: Unable to find default output device";
339 if (AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propSize, 0) == noErr) {
341 const int dc = propSize /
sizeof(AudioDeviceID);
344 AudioDeviceID* audioDevices =
new AudioDeviceID[dc];
346 if (AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propSize, audioDevices) == noErr) {
347 for (
int i = 0; i < dc; ++i) {
354 delete[] audioDevices;
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static QByteArray defaultOutputDevice()
const struct __CFString * CFStringRef
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
Q_CORE_EXPORT void qFree(void *ptr)
The QByteArray class provides an array of bytes.
QString deviceName() const
Returns the audio device name.
static QString toQString(CFStringRef cfstr)
Q_CORE_EXPORT void * qMalloc(size_t size)
The QString class provides a Unicode character string.
static QByteArray defaultInputDevice()
QAudioFormat toQAudioFormat(AudioStreamBasicDescription const &sf)
QAudioFormat preferredFormat() const
Returns the nearest settings.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static QByteArray get_device_info(AudioDeviceID audioDevice, QAudio::Mode mode)
QList< T > toList() const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
The QStringList class provides a list of strings.
QList< int > channelsList()
Returns the list of currently available channels.
bool isFormatSupported(const QAudioFormat &format) const
Returns true if format is available from audio device.
Q_CORE_EXPORT void qWarning(const char *,...)
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode)
QStringList codecList()
Returns the list of currently available codecs.
QList< QAudioFormat::SampleType > sampleTypeList()
Returns the list of currently available sample types.
QAudioFormat nearestFormat(const QAudioFormat &format) const
Returns the nearest settings format.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
QList< QAudioFormat::Endian > byteOrderList()
Returns the list of currently available byte orders.
QList< int > sampleSizeList()
Returns the list of currently available sample sizes.
QList< int > frequencyList()
Returns the list of currently available frequencies.
The QDataStream class provides serialization of binary data to a QIODevice.
static QList< QByteArray > availableDevices(QAudio::Mode)