Qt 4.8
qaudiooutput_mac_p.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtMultimedia module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists for the convenience
47 // of other Qt classes. This header file may change from version to
48 // version without notice, or even be removed.
49 //
50 // We mean it.
51 //
52 
53 #include <CoreServices/CoreServices.h>
54 #include <CoreAudio/CoreAudio.h>
55 #include <AudioUnit/AudioUnit.h>
56 #include <AudioToolbox/AudioToolbox.h>
57 
58 #include <QtCore/qendian.h>
59 #include <QtCore/qbuffer.h>
60 #include <QtCore/qtimer.h>
61 #include <QtCore/qdebug.h>
62 
63 #include <QtMultimedia/qaudiooutput.h>
64 
65 #include "qaudio_mac_p.h"
66 #include "qaudiooutput_mac_p.h"
67 #include "qaudiodeviceinfo_mac_p.h"
68 
69 
71 
72 
73 namespace QtMultimediaInternal
74 {
75 
76 static const int default_buffer_size = 8 * 1024;
77 
78 
80 {
81  Q_OBJECT
82 
83 public:
84  QAudioOutputBuffer(int bufferSize, int maxPeriodSize, QAudioFormat const& audioFormat):
85  m_deviceError(false),
86  m_maxPeriodSize(maxPeriodSize),
87  m_device(0)
88  {
89  m_buffer = new QAudioRingBuffer(bufferSize + (bufferSize % maxPeriodSize == 0 ? 0 : maxPeriodSize - (bufferSize % maxPeriodSize)));
90  m_bytesPerFrame = (audioFormat.sampleSize() / 8) * audioFormat.channels();
91  m_periodTime = m_maxPeriodSize / m_bytesPerFrame * 1000 / audioFormat.frequency();
92 
93  m_fillTimer = new QTimer(this);
94  connect(m_fillTimer, SIGNAL(timeout()), SLOT(fillBuffer()));
95  }
96 
98  {
99  delete m_buffer;
100  }
101 
102  qint64 readFrames(char* data, qint64 maxFrames)
103  {
104  bool wecan = true;
105  qint64 framesRead = 0;
106 
107  while (wecan && framesRead < maxFrames) {
108  QAudioRingBuffer::Region region = m_buffer->acquireReadRegion((maxFrames - framesRead) * m_bytesPerFrame);
109 
110  if (region.second > 0) {
111  region.second -= region.second % m_bytesPerFrame;
112  memcpy(data + (framesRead * m_bytesPerFrame), region.first, region.second);
113  framesRead += region.second / m_bytesPerFrame;
114  }
115  else
116  wecan = false;
117 
118  m_buffer->releaseReadRegion(region);
119  }
120 
121  if (framesRead == 0 && m_deviceError)
122  framesRead = -1;
123 
124  return framesRead;
125  }
126 
127  qint64 writeBytes(const char* data, qint64 maxSize)
128  {
129  bool wecan = true;
130  qint64 bytesWritten = 0;
131 
132  maxSize -= maxSize % m_bytesPerFrame;
133  while (wecan && bytesWritten < maxSize) {
134  QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(maxSize - bytesWritten);
135 
136  if (region.second > 0) {
137  memcpy(region.first, data + bytesWritten, region.second);
138  bytesWritten += region.second;
139  }
140  else
141  wecan = false;
142 
143  m_buffer->releaseWriteRegion(region);
144  }
145 
146  if (bytesWritten > 0)
147  emit readyRead();
148 
149  return bytesWritten;
150  }
151 
152  int available() const
153  {
154  return m_buffer->free();
155  }
156 
157  void reset()
158  {
159  m_buffer->reset();
160  m_deviceError = false;
161  }
162 
164  {
165  if (m_device != device) {
166  m_device = device;
167  if (m_device != 0)
168  fillBuffer();
169  }
170  }
171 
173  {
174  if (m_device != 0)
176  }
177 
179  {
180  m_fillTimer->stop();
181  }
182 
183 signals:
184  void readyRead();
185 
186 private slots:
187  void fillBuffer()
188  {
189  const int free = m_buffer->free();
190  const int writeSize = free - (free % m_maxPeriodSize);
191 
192  if (writeSize > 0) {
193  bool wecan = true;
194  int filled = 0;
195 
196  while (!m_deviceError && wecan && filled < writeSize) {
197  QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(writeSize - filled);
198 
199  if (region.second > 0) {
200  region.second = m_device->read(region.first, region.second);
201  if (region.second > 0)
202  filled += region.second;
203  else if (region.second == 0)
204  wecan = false;
205  else if (region.second < 0) {
206  m_fillTimer->stop();
207  region.second = 0;
208  m_deviceError = true;
209  }
210  }
211  else
212  wecan = false;
213 
214  m_buffer->releaseWriteRegion(region);
215  }
216 
217  if (filled > 0)
218  emit readyRead();
219  }
220  }
221 
222 private:
230 };
231 
232 
233 }
234 
236 {
237  Q_OBJECT
238 
239 public:
241  QIODevice(parent),
242  m_audioBuffer(audioBuffer)
243  {
245  }
246 
248  {
249  Q_UNUSED(data);
250  Q_UNUSED(len);
251 
252  return 0;
253  }
254 
255  qint64 writeData(const char* data, qint64 len)
256  {
257  return m_audioBuffer->writeBytes(data, len);
258  }
259 
260  bool isSequential() const
261  {
262  return true;
263  }
264 
265 private:
267 };
268 
269 
271  audioFormat(format)
272 {
273  QDataStream ds(device);
274  quint32 did, mode;
275 
276  ds >> did >> mode;
277 
278  if (QAudio::Mode(mode) == QAudio::AudioInput)
279  errorCode = QAudio::OpenError;
280  else {
281  audioDeviceInfo = new QAudioDeviceInfoInternal(device, QAudio::AudioOutput);
282  isOpen = false;
283  audioDeviceId = AudioDeviceID(did);
284  audioUnit = 0;
285  audioIO = 0;
286  startTime = 0;
287  totalFrames = 0;
288  audioBuffer = 0;
289  internalBufferSize = QtMultimediaInternal::default_buffer_size;
290  clockFrequency = AudioGetHostClockFrequency() / 1000;
291  errorCode = QAudio::NoError;
292  stateCode = QAudio::StoppedState;
293  audioThreadState = Stopped;
294 
295  intervalTimer = new QTimer(this);
296  intervalTimer->setInterval(1000);
297  connect(intervalTimer, SIGNAL(timeout()), SIGNAL(notify()));
298  }
299 }
300 
302 {
303  delete audioDeviceInfo;
304  close();
305 }
306 
308 {
309  if (errorCode != QAudio::NoError)
310  return false;
311 
312  if (isOpen)
313  return true;
314 
315  ComponentDescription cd;
316  cd.componentType = kAudioUnitType_Output;
317  cd.componentSubType = kAudioUnitSubType_HALOutput;
318  cd.componentManufacturer = kAudioUnitManufacturer_Apple;
319  cd.componentFlags = 0;
320  cd.componentFlagsMask = 0;
321 
322  // Open
323  Component cp = FindNextComponent(NULL, &cd);
324  if (cp == 0) {
325  qWarning() << "QAudioOutput: Failed to find HAL Output component";
326  return false;
327  }
328 
329  if (OpenAComponent(cp, &audioUnit) != noErr) {
330  qWarning() << "QAudioOutput: Unable to Open Output Component";
331  return false;
332  }
333 
334  // register callback
335  AURenderCallbackStruct cb;
336  cb.inputProc = renderCallback;
337  cb.inputProcRefCon = this;
338 
339  if (AudioUnitSetProperty(audioUnit,
340  kAudioUnitProperty_SetRenderCallback,
341  kAudioUnitScope_Global,
342  0,
343  &cb,
344  sizeof(cb)) != noErr) {
345  qWarning() << "QAudioOutput: Failed to set AudioUnit callback";
346  return false;
347  }
348 
349  // Set Audio Device
350  if (AudioUnitSetProperty(audioUnit,
351  kAudioOutputUnitProperty_CurrentDevice,
352  kAudioUnitScope_Global,
353  0,
354  &audioDeviceId,
355  sizeof(audioDeviceId)) != noErr) {
356  qWarning() << "QAudioOutput: Unable to use configured device";
357  return false;
358  }
359 
360  // Set stream format
361  streamFormat = toAudioStreamBasicDescription(audioFormat);
362 
363  UInt32 size = sizeof(streamFormat);
364  if (AudioUnitSetProperty(audioUnit,
365  kAudioUnitProperty_StreamFormat,
366  kAudioUnitScope_Input,
367  0,
368  &streamFormat,
369  sizeof(streamFormat)) != noErr) {
370  qWarning() << "QAudioOutput: Unable to Set Stream information";
371  return false;
372  }
373 
374  // Allocate buffer
375  UInt32 numberOfFrames = 0;
376  size = sizeof(UInt32);
377  if (AudioUnitGetProperty(audioUnit,
378  kAudioDevicePropertyBufferFrameSize,
379  kAudioUnitScope_Global,
380  0,
381  &numberOfFrames,
382  &size) != noErr) {
383  qWarning() << "QAudioInput: Failed to get audio period size";
384  return false;
385  }
386 
387  periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame;
388  if (internalBufferSize < periodSizeBytes * 2)
389  internalBufferSize = periodSizeBytes * 2;
390  else
391  internalBufferSize -= internalBufferSize % streamFormat.mBytesPerFrame;
392 
393  audioBuffer = new QtMultimediaInternal::QAudioOutputBuffer(internalBufferSize, periodSizeBytes, audioFormat);
394  connect(audioBuffer, SIGNAL(readyRead()), SLOT(inputReady())); // Pull
395 
396  audioIO = new MacOutputDevice(audioBuffer, this);
397 
398  // Init
399  if (AudioUnitInitialize(audioUnit)) {
400  qWarning() << "QAudioOutput: Failed to initialize AudioUnit";
401  return false;
402  }
403 
404  isOpen = true;
405 
406  return true;
407 }
408 
410 {
411  if (audioUnit != 0) {
412  AudioOutputUnitStop(audioUnit);
413  AudioUnitUninitialize(audioUnit);
414  CloseComponent(audioUnit);
415  }
416 
417  delete audioBuffer;
418 }
419 
421 {
422  return audioFormat;
423 }
424 
426 {
427  QIODevice* op = device;
428 
429  if (!audioDeviceInfo->isFormatSupported(audioFormat) || !open()) {
430  stateCode = QAudio::StoppedState;
431  errorCode = QAudio::OpenError;
432  return audioIO;
433  }
434 
435  reset();
436  audioBuffer->reset();
437  audioBuffer->setPrefetchDevice(op);
438 
439  if (op == 0) {
440  op = audioIO;
441  stateCode = QAudio::IdleState;
442  }
443  else
444  stateCode = QAudio::ActiveState;
445 
446  // Start
447  errorCode = QAudio::NoError;
448  totalFrames = 0;
449  startTime = AudioGetCurrentHostTime();
450 
451  if (stateCode == QAudio::ActiveState)
452  audioThreadStart();
453 
454  emit stateChanged(stateCode);
455 
456  return op;
457 }
458 
460 {
461  QMutexLocker lock(&mutex);
462  if (stateCode != QAudio::StoppedState) {
463  audioThreadDrain();
464 
465  stateCode = QAudio::StoppedState;
466  errorCode = QAudio::NoError;
467  QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
468  }
469 }
470 
472 {
473  QMutexLocker lock(&mutex);
474  if (stateCode != QAudio::StoppedState) {
475  audioThreadStop();
476 
477  stateCode = QAudio::StoppedState;
478  errorCode = QAudio::NoError;
479  QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
480  }
481 }
482 
484 {
485  QMutexLocker lock(&mutex);
486  if (stateCode == QAudio::ActiveState || stateCode == QAudio::IdleState) {
487  audioThreadStop();
488 
489  stateCode = QAudio::SuspendedState;
490  errorCode = QAudio::NoError;
491  QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
492  }
493 }
494 
496 {
497  QMutexLocker lock(&mutex);
498  if (stateCode == QAudio::SuspendedState) {
499  audioThreadStart();
500 
501  stateCode = QAudio::ActiveState;
502  errorCode = QAudio::NoError;
503  QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
504  }
505 }
506 
508 {
509  return audioBuffer->available();
510 }
511 
513 {
514  return periodSizeBytes;
515 }
516 
518 {
519  if (stateCode == QAudio::StoppedState)
520  internalBufferSize = bs;
521 }
522 
524 {
525  return internalBufferSize;
526 }
527 
528 void QAudioOutputPrivate::setNotifyInterval(int milliSeconds)
529 {
530  if (intervalTimer->interval() == milliSeconds)
531  return;
532 
533  if (milliSeconds <= 0)
534  milliSeconds = 0;
535 
536  intervalTimer->setInterval(milliSeconds);
537 }
538 
540 {
541  return intervalTimer->interval();
542 }
543 
545 {
546  return totalFrames * 1000000 / audioFormat.frequency();
547 }
548 
550 {
551  if (stateCode == QAudio::StoppedState)
552  return 0;
553 
554  return (AudioGetCurrentHostTime() - startTime) / (clockFrequency / 1000);
555 }
556 
558 {
559  return errorCode;
560 }
561 
563 {
564  return stateCode;
565 }
566 
568 {
569  startTimers();
570  audioThreadState = Running;
571  AudioOutputUnitStart(audioUnit);
572 }
573 
575 {
576  stopTimers();
577  if (audioThreadState.testAndSetAcquire(Running, Stopped))
578  threadFinished.wait(&mutex);
579 }
580 
582 {
583  stopTimers();
584  if (audioThreadState.testAndSetAcquire(Running, Draining))
585  threadFinished.wait(&mutex);
586 }
587 
589 {
590  AudioOutputUnitStop(audioUnit);
591  audioThreadState = Stopped;
592  threadFinished.wakeOne();
593 }
594 
596 {
597  QMutexLocker lock(&mutex);
598  if (stateCode == QAudio::ActiveState) {
599  audioDeviceStop();
600 
601  errorCode = QAudio::UnderrunError;
602  stateCode = QAudio::IdleState;
603  QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
604  }
605 }
606 
608 {
609  QMutexLocker lock(&mutex);
610  if (stateCode == QAudio::ActiveState) {
611  audioDeviceStop();
612 
613  errorCode = QAudio::IOError;
614  stateCode = QAudio::StoppedState;
615  QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
616  }
617 }
618 
620 {
621  audioBuffer->startFillTimer();
622  if (intervalTimer->interval() > 0)
623  intervalTimer->start();
624 }
625 
627 {
628  audioBuffer->stopFillTimer();
629  intervalTimer->stop();
630 }
631 
632 
634 {
635  intervalTimer->stop();
636  emit stateChanged(stateCode);
637 }
638 
640 {
641  QMutexLocker lock(&mutex);
642  if (stateCode == QAudio::IdleState) {
643  audioThreadStart();
644 
645  stateCode = QAudio::ActiveState;
646  errorCode = QAudio::NoError;
647 
648  QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
649  }
650 }
651 
652 
654  AudioUnitRenderActionFlags* ioActionFlags,
655  const AudioTimeStamp* inTimeStamp,
656  UInt32 inBusNumber,
657  UInt32 inNumberFrames,
658  AudioBufferList* ioData)
659 {
660  Q_UNUSED(ioActionFlags)
661  Q_UNUSED(inTimeStamp)
662  Q_UNUSED(inBusNumber)
663  Q_UNUSED(inNumberFrames)
664 
665  QAudioOutputPrivate* d = static_cast<QAudioOutputPrivate*>(inRefCon);
666 
667  const int threadState = d->audioThreadState.fetchAndAddAcquire(0);
668  if (threadState == Stopped) {
669  ioData->mBuffers[0].mDataByteSize = 0;
670  d->audioDeviceStop();
671  }
672  else {
673  const UInt32 bytesPerFrame = d->streamFormat.mBytesPerFrame;
674  qint64 framesRead;
675 
676  framesRead = d->audioBuffer->readFrames((char*)ioData->mBuffers[0].mData,
677  ioData->mBuffers[0].mDataByteSize / bytesPerFrame);
678 
679  if (framesRead > 0) {
680  ioData->mBuffers[0].mDataByteSize = framesRead * bytesPerFrame;
681  d->totalFrames += framesRead;
682  }
683  else {
684  ioData->mBuffers[0].mDataByteSize = 0;
685  if (framesRead == 0) {
686  if (threadState == Draining)
687  d->audioDeviceStop();
688  else
689  d->audioDeviceIdle();
690  }
691  else
692  d->audioDeviceError();
693  }
694  }
695 
696  return noErr;
697 }
698 
699 
701 
702 #include "qaudiooutput_mac_p.moc"
703 
double d
Definition: qnumeric_p.h:62
Error
Definition: qaudio.h:58
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
Definition: qiodevice.cpp:642
MacOutputDevice(QtMultimediaInternal::QAudioOutputBuffer *audioBuffer, QObject *parent)
Region acquireReadRegion(int size)
Definition: qaudio_mac_p.h:84
int frequency() const
Use sampleRate() instead.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
qint64 readData(char *data, qint64 len)
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
AudioStreamBasicDescription streamFormat
virtual void close()
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
Definition: qiodevice.cpp:590
QAudio::State state() const
Returns the state of audio processing.
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
void resume()
Resumes processing audio data after a suspend()
#define SLOT(a)
Definition: qobjectdefs.h:226
static OSStatus renderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData)
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
qint64 readFrames(char *data, qint64 maxFrames)
#define Q_ARG(type, data)
Definition: qobjectdefs.h:246
void releaseWriteRegion(Region const &region)
Definition: qaudio_mac_p.h:117
int sampleSize() const
Returns the current sample size value.
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QAudio::Error error() const
Returns the error state.
void reset()
Drops all audio data in the buffers, resets buffers to zero.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
Definition: qiodevice.cpp:791
void setBufferSize(int value)
Sets the audio buffer size to value in bytes.
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QAudioOutputBuffer(int bufferSize, int maxPeriodSize, QAudioFormat const &audioFormat)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QAudioOutputPrivate(const QByteArray &device, const QAudioFormat &audioFormat)
static const int default_buffer_size
bool isOpen() const
Returns true if the device is open; otherwise returns false.
Definition: qiodevice.cpp:530
int notifyInterval() const
Returns the notify interval in milliseconds.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
#define emit
Definition: qobjectdefs.h:76
Q_CORE_EXPORT void qWarning(const char *,...)
AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const &audioFormat)
Definition: qaudio_mac.cpp:82
static const char * data(const QByteArray &arr)
qint64 elapsedUSecs() const
Returns the milliseconds since start() was called, including time in Idle and suspend states...
qint64 processedUSecs() const
Returns the amount of audio data processed since start() was called in milliseconds.
__int64 qint64
Definition: qglobal.h:942
signed long OSStatus
void suspend()
Stops processing audio data, preserving buffered audio data.
#define Q_OBJECT
Definition: qobjectdefs.h:157
The Component element encapsulates a QML component definition.
int fetchAndAddAcquire(int valueToAdd)
Atomic fetch-and-add.
Mode
Definition: qaudio.h:60
int periodSize() const
Returns the period size in bytes.
qint64 writeBytes(const char *data, qint64 maxSize)
QAudioFormat format() const
Returns the QAudioFormat being used.
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
State
Definition: qaudio.h:59
int bytesFree() const
Returns the free space available in bytes in the audio buffer.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
void setNotifyInterval(int milliSeconds)
Sets the interval for notify() signal to be emitted.
unsigned int quint32
Definition: qglobal.h:938
static QReadWriteLock lock
Definition: proxyconf.cpp:399
virtual bool reset()
Seeks to the start of input for random-access devices.
Definition: qiodevice.cpp:732
int bufferSize() const
Returns the audio buffer size in bytes.
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
Definition: qiodevice.cpp:570
int free() const
Definition: qaudio_mac.cpp:126
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
Invokes the member (a signal or a slot name) on the object obj.
Region acquireWriteRegion(int size)
Definition: qaudio_mac_p.h:104
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:71
QIODevice * start(QIODevice *device=0)
Uses the device as the QIODevice to transfer data.
void stop()
Stops the audio output.
The QAudioFormat class stores audio parameter information.
Definition: qaudioformat.h:60
void releaseReadRegion(Region const &region)
Definition: qaudio_mac_p.h:97
The QTimer class provides repetitive and single-shot timers.
Definition: qtimer.h:56
qint64 writeData(const char *data, qint64 len)
Writes up to maxSize bytes from data to the device.
#define slots
Definition: qobjectdefs.h:68
void readyRead()
This signal is emitted once every time new data is available for reading from the device...
#define signals
Definition: qobjectdefs.h:69
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
void stop()
Stops the timer.
Definition: qtimer.cpp:284
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition: qtimer.cpp:249
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
int size() const
Definition: qaudio_mac.cpp:131
int open(const char *, int,...)
bool isSequential() const
Returns true if this device is sequential; otherwise returns false.
int channels() const
Use channelCount() instead.
QtMultimediaInternal::QAudioOutputBuffer * m_audioBuffer