Qt 4.8
qaudiooutput_win32_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 "qaudiooutput_win32_p.h"
54 #include <QtEndian>
55 
56 #ifndef SPEAKER_FRONT_LEFT
57  #define SPEAKER_FRONT_LEFT 0x00000001
58  #define SPEAKER_FRONT_RIGHT 0x00000002
59  #define SPEAKER_FRONT_CENTER 0x00000004
60  #define SPEAKER_LOW_FREQUENCY 0x00000008
61  #define SPEAKER_BACK_LEFT 0x00000010
62  #define SPEAKER_BACK_RIGHT 0x00000020
63  #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040
64  #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080
65  #define SPEAKER_BACK_CENTER 0x00000100
66  #define SPEAKER_SIDE_LEFT 0x00000200
67  #define SPEAKER_SIDE_RIGHT 0x00000400
68  #define SPEAKER_TOP_CENTER 0x00000800
69  #define SPEAKER_TOP_FRONT_LEFT 0x00001000
70  #define SPEAKER_TOP_FRONT_CENTER 0x00002000
71  #define SPEAKER_TOP_FRONT_RIGHT 0x00004000
72  #define SPEAKER_TOP_BACK_LEFT 0x00008000
73  #define SPEAKER_TOP_BACK_CENTER 0x00010000
74  #define SPEAKER_TOP_BACK_RIGHT 0x00020000
75  #define SPEAKER_RESERVED 0x7FFC0000
76  #define SPEAKER_ALL 0x80000000
77 #endif
78 
79 #ifndef _WAVEFORMATEXTENSIBLE_
80 
81  #define _WAVEFORMATEXTENSIBLE_
82  typedef struct
83  {
84  WAVEFORMATEX Format; // Base WAVEFORMATEX data
85  union
86  {
87  WORD wValidBitsPerSample; // Valid bits in each sample container
88  WORD wSamplesPerBlock; // Samples per block of audio data; valid
89  // if wBitsPerSample=0 (but rarely used).
90  WORD wReserved; // Zero if neither case above applies.
91  } Samples;
92  DWORD dwChannelMask; // Positions of the audio channels
93  GUID SubFormat; // Format identifier GUID
96 
97 #endif
98 
99 #if !defined(WAVE_FORMAT_EXTENSIBLE)
100 #define WAVE_FORMAT_EXTENSIBLE 0xFFFE
101 #endif
102 
103 //#define DEBUG_AUDIO 1
104 
106 
107 QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
108  settings(audioFormat)
109 {
110  bytesAvailable = 0;
111  buffer_size = 0;
112  period_size = 0;
113  m_device = device;
114  totalTimeValue = 0;
115  intervalTime = 1000;
116  audioBuffer = 0;
117  errorState = QAudio::NoError;
118  deviceState = QAudio::StoppedState;
119  audioSource = 0;
120  pullMode = true;
121  finished = false;
122 }
123 
125 {
126  mutex.lock();
127  finished = true;
128  mutex.unlock();
129 
130  close();
131 }
132 
133 void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
134  DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 )
135 {
136  Q_UNUSED(dwParam1)
137  Q_UNUSED(dwParam2)
138  Q_UNUSED(hWaveOut)
139 
140  QAudioOutputPrivate* qAudio;
141  qAudio = (QAudioOutputPrivate*)(dwInstance);
142  if(!qAudio)
143  return;
144 
145  QMutexLocker(&qAudio->mutex);
146 
147  switch(uMsg) {
148  case WOM_OPEN:
149  qAudio->feedback();
150  break;
151  case WOM_CLOSE:
152  return;
153  case WOM_DONE:
154  if(qAudio->finished || qAudio->buffer_size == 0 || qAudio->period_size == 0) {
155  return;
156  }
157  qAudio->waveFreeBlockCount++;
158  if(qAudio->waveFreeBlockCount >= qAudio->buffer_size/qAudio->period_size)
159  qAudio->waveFreeBlockCount = qAudio->buffer_size/qAudio->period_size;
160  qAudio->feedback();
161  break;
162  default:
163  return;
164  }
165 }
166 
167 WAVEHDR* QAudioOutputPrivate::allocateBlocks(int size, int count)
168 {
169  int i;
170  unsigned char* buffer;
171  WAVEHDR* blocks;
172  DWORD totalBufferSize = (size + sizeof(WAVEHDR))*count;
173 
174  if((buffer=(unsigned char*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
175  totalBufferSize)) == 0) {
176  qWarning("QAudioOutput: Memory allocation error");
177  return 0;
178  }
179  blocks = (WAVEHDR*)buffer;
180  buffer += sizeof(WAVEHDR)*count;
181  for(i = 0; i < count; i++) {
182  blocks[i].dwBufferLength = size;
183  blocks[i].lpData = (LPSTR)buffer;
184  buffer += size;
185  }
186  return blocks;
187 }
188 
189 void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray)
190 {
191  WAVEHDR* blocks = blockArray;
192 
193  int count = buffer_size/period_size;
194 
195  for(int i = 0; i < count; i++) {
196  waveOutUnprepareHeader(hWaveOut,blocks, sizeof(WAVEHDR));
197  blocks++;
198  }
199  HeapFree(GetProcessHeap(), 0, blockArray);
200 }
201 
203 {
204  return settings;
205 }
206 
208 {
210  close();
211 
212  if(!pullMode && audioSource) {
213  delete audioSource;
214  }
215 
216  if(device) {
217  //set to pull mode
218  pullMode = true;
219  audioSource = device;
221  } else {
222  //set to push mode
223  pullMode = false;
224  audioSource = new OutputPrivate(this);
227  }
228 
229  if( !open() )
230  return 0;
231 
233 
234  return audioSource;
235 }
236 
238 {
240  return;
241  close();
242  if(!pullMode && audioSource) {
243  delete audioSource;
244  audioSource = 0;
245  }
247 }
248 
250 {
251 #ifdef DEBUG_AUDIO
252  QTime now(QTime::currentTime());
253  qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
254 #endif
255 
256  period_size = 0;
257 
258  if (!settings.isValid()) {
259  qWarning("QAudioOutput: open error, invalid format.");
260  } else if (settings.channels() <= 0) {
261  qWarning("QAudioOutput: open error, invalid number of channels (%d).",
262  settings.channels());
263  } else if (settings.sampleSize() <= 0) {
264  qWarning("QAudioOutput: open error, invalid sample size (%d).",
265  settings.sampleSize());
266  } else if (settings.frequency() < 8000 || settings.frequency() > 96000) {
267  qWarning("QAudioOutput: open error, frequency out of range (%d).", settings.frequency());
268  } else if (buffer_size == 0) {
269  // Default buffer size, 200ms, default period size is 40ms
271  = (settings.frequency()
272  * settings.channels()
273  * settings.sampleSize()
274  + 39) / 40;
275  period_size = buffer_size / 5;
276  } else {
277  period_size = buffer_size / 5;
278  }
279 
280  if (period_size == 0) {
284  return false;
285  }
286 
288 
289  mutex.lock();
291  mutex.unlock();
292 
293  waveCurrentBlock = 0;
294 
295  if(audioBuffer == 0)
296  audioBuffer = new char[buffer_size];
297 
298  timeStamp.restart();
299  elapsedTimeOffset = 0;
300 
301  wfx.nSamplesPerSec = settings.frequency();
302  wfx.wBitsPerSample = settings.sampleSize();
303  wfx.nChannels = settings.channels();
304  wfx.cbSize = 0;
305 
306  wfx.wFormatTag = WAVE_FORMAT_PCM;
307  wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
308  wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
309 
310  UINT_PTR devId = WAVE_MAPPER;
311 
312  WAVEOUTCAPS woc;
313  unsigned long iNumDevs,ii;
314  iNumDevs = waveOutGetNumDevs();
315  for(ii=0;ii<iNumDevs;ii++) {
316  if(waveOutGetDevCaps(ii, &woc, sizeof(WAVEOUTCAPS))
317  == MMSYSERR_NOERROR) {
318  QString tmp;
319  tmp = QString((const QChar *)woc.szPname);
320  if(tmp.compare(QLatin1String(m_device)) == 0) {
321  devId = ii;
322  break;
323  }
324  }
325  }
326 
327  if ( settings.channels() <= 2) {
328  if(waveOutOpen(&hWaveOut, devId, &wfx,
330  (DWORD_PTR) this,
331  CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
335  qWarning("QAudioOutput: open error");
336  return false;
337  }
338  } else {
340  wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
341  wfex.Format.nChannels = settings.channels();
342  wfex.Format.wBitsPerSample = settings.sampleSize();
343  wfex.Format.nSamplesPerSec = settings.frequency();
344  wfex.Format.nBlockAlign = wfex.Format.nChannels*wfex.Format.wBitsPerSample/8;
345  wfex.Format.nAvgBytesPerSec=wfex.Format.nSamplesPerSec*wfex.Format.nBlockAlign;
346  wfex.Samples.wValidBitsPerSample=wfex.Format.wBitsPerSample;
347  static const GUID _KSDATAFORMAT_SUBTYPE_PCM = {
348  0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
349  wfex.SubFormat=_KSDATAFORMAT_SUBTYPE_PCM;
350  wfex.Format.cbSize=22;
351 
353  if (settings.channels() >= 4)
355  if (settings.channels() >= 6)
357  if (settings.channels() == 8)
359 
360  if(waveOutOpen(&hWaveOut, devId, &wfex.Format,
362  (DWORD_PTR) this,
363  CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
367  qWarning("QAudioOutput: open error");
368  return false;
369  }
370  }
371 
372  totalTimeValue = 0;
374  elapsedTimeOffset = 0;
375 
377  if(pullMode) {
379  QTimer::singleShot(10, this, SLOT(feedback()));
380  } else
382 
383  return true;
384 }
385 
387 {
389  return;
390 
393  int delay = (buffer_size-bytesFree())*1000/(settings.frequency()
395  waveOutReset(hWaveOut);
396  Sleep(delay+10);
397 
399  waveOutClose(hWaveOut);
400  delete [] audioBuffer;
401  audioBuffer = 0;
402  buffer_size = 0;
403 }
404 
406 {
407  int buf;
409 
410  return buf;
411 }
412 
414 {
415  return period_size;
416 }
417 
419 {
421  buffer_size = value;
422 }
423 
425 {
426  return buffer_size;
427 }
428 
430 {
431  intervalTime = qMax(0, ms);
432 }
433 
435 {
436  return intervalTime;
437 }
438 
440 {
442  return 0;
443  qint64 result = qint64(1000000) * totalTimeValue /
446 
447  return result;
448 }
449 
450 qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
451 {
452  // Write out some audio data
454  return 0;
455 
456  char* p = (char*)data;
457  int l = (int)len;
458 
461 
462  switch (settings.sampleSize()) {
463  case 8:
464  // No need to convert
465  break;
466 
467  case 16:
468  reverse.resize(l);
469  for (qint64 i = 0; i < (l >> 1); i++)
470  *((qint16*)reverse.data() + i) = qFromBigEndian(*((qint16*)data + i));
471  p = reverse.data();
472  break;
473 
474  case 32:
475  reverse.resize(l);
476  for (qint64 i = 0; i < (l >> 2); i++)
477  *((qint32*)reverse.data() + i) = qFromBigEndian(*((qint32*)data + i));
478  p = reverse.data();
479  break;
480  }
481  }
482 
483  WAVEHDR* current;
484  int remain;
485  current = &waveBlocks[waveCurrentBlock];
486  while(l > 0) {
487  mutex.lock();
488  if(waveFreeBlockCount==0) {
489  mutex.unlock();
490  break;
491  }
492  mutex.unlock();
493 
494  if(current->dwFlags & WHDR_PREPARED)
495  waveOutUnprepareHeader(hWaveOut, current, sizeof(WAVEHDR));
496 
497  if(l < period_size)
498  remain = l;
499  else
500  remain = period_size;
501  memcpy(current->lpData, p, remain);
502 
503  l -= remain;
504  p += remain;
505  current->dwBufferLength = remain;
506  waveOutPrepareHeader(hWaveOut, current, sizeof(WAVEHDR));
507  waveOutWrite(hWaveOut, current, sizeof(WAVEHDR));
508 
509  mutex.lock();
511 #ifdef DEBUG_AUDIO
512  qDebug("write out l=%d, waveFreeBlockCount=%d",
513  current->dwBufferLength,waveFreeBlockCount);
514 #endif
515  mutex.unlock();
516  totalTimeValue += current->dwBufferLength;
519  current = &waveBlocks[waveCurrentBlock];
520  current->dwUser = 0;
525  }
526  }
527  return (len-l);
528 }
529 
531 {
535  waveOutRestart(hWaveOut);
536  QTimer::singleShot(10, this, SLOT(feedback()));
538  }
539 }
540 
542 {
544  int delay = (buffer_size-bytesFree())*1000/(settings.frequency()
546  waveOutPause(hWaveOut);
547  Sleep(delay+10);
551  }
552 }
553 
555 {
556 #ifdef DEBUG_AUDIO
557  QTime now(QTime::currentTime());
558  qDebug()<<now.second()<<"s "<<now.msec()<<"ms :feedback()";
559 #endif
561 
564  QMetaObject::invokeMethod(this, "deviceReady", Qt::QueuedConnection);
565  }
566 }
567 
569 {
571  return false;
572 
573  if(pullMode) {
574  int chunks = bytesAvailable/period_size;
575 #ifdef DEBUG_AUDIO
576  qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes";
577  qDebug()<<"deviceReady() no. of chunks that can fit ="<<chunks<<", chunks in bytes ="<<chunks*period_size;
578 #endif
579  bool startup = false;
580  if(totalTimeValue == 0)
581  startup = true;
582 
583  bool full=false;
584 
585  mutex.lock();
586  if(waveFreeBlockCount==0) full = true;
587  mutex.unlock();
588 
589  if (full){
590 #ifdef DEBUG_AUDIO
591  qDebug() << "Skipping data as unable to write";
592 #endif
594  emit notify();
596  timeStamp.restart();
597  }
598  return true;
599  }
600 
601  if(startup)
602  waveOutPause(hWaveOut);
603  int input = period_size*chunks;
604  int l = audioSource->read(audioBuffer,input);
605  if(l > 0) {
606  int out= write(audioBuffer,l);
607  if(out > 0) {
611  }
612  }
613  if ( out < l) {
614  // Didn't write all data
615  audioSource->seek(audioSource->pos()-(l-out));
616  }
617  if(startup)
618  waveOutRestart(hWaveOut);
619  } else if(l == 0) {
621 
622  int check = 0;
623 
624  mutex.lock();
625  check = waveFreeBlockCount;
626  mutex.unlock();
627 
628  if(check == buffer_size/period_size) {
633  }
634  }
635 
636  } else if(l < 0) {
639  }
640  } else {
641  int buffered;
642 
643  mutex.lock();
644  buffered = waveFreeBlockCount;
645  mutex.unlock();
646 
647  if (buffered >= buffer_size/period_size && deviceState == QAudio::ActiveState) {
652  }
653  }
654  }
656  return true;
657 
659  emit notify();
661  timeStamp.restart();
662  }
663 
664  return true;
665 }
666 
668 {
670  return 0;
671 
672  return timeStampOpened.elapsed()*1000;
673 }
674 
676 {
677  return errorState;
678 }
679 
681 {
682  return deviceState;
683 }
684 
686 {
687  close();
688 }
689 
691 {
692  audioDevice = qobject_cast<QAudioOutputPrivate*>(audio);
693 }
694 
696 
698 {
699  Q_UNUSED(data)
700  Q_UNUSED(len)
701 
702  return 0;
703 }
704 
705 qint64 OutputPrivate::writeData(const char* data, qint64 len)
706 {
707  int retry = 0;
708  qint64 written = 0;
709 
710  if((audioDevice->deviceState == QAudio::ActiveState)
711  ||(audioDevice->deviceState == QAudio::IdleState)) {
712  qint64 l = len;
713  while(written < l) {
714  int chunk = audioDevice->write(data+written,(l-written));
715  if(chunk <= 0)
716  retry++;
717  else
718  written+=chunk;
719 
720  if(retry > 10)
721  return written;
722  }
723  audioDevice->deviceState = QAudio::ActiveState;
724  }
725  return written;
726 }
727 
static void QT_WIN_CALLBACK waveOutProc(HWAVEOUT hWaveOut, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2)
WAVEHDR * allocateBlocks(int size, int count)
#define SPEAKER_FRONT_RIGHT
qint64 write(const char *data, qint64 len)
Error
Definition: qaudio.h:58
int frequency() const
Use sampleRate() instead.
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void notify()
This signal is emitted when x ms of audio data has been processed the interval set by setNotifyInterv...
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
int qint32
Definition: qglobal.h:937
void stateChanged(QAudio::State)
This signal is emitted when the device state has changed.
#define WAVE_FORMAT_EXTENSIBLE
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
Definition: quuid.h:52
OutputPrivate(QAudioOutputPrivate *audio)
const WAVEFORMATEXTENSIBLE * LPCWAVEFORMATEXTENSIBLE
QAudio::State state() const
Returns the state of audio processing.
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static C reverse(const C &l)
void resume()
Resumes processing audio data after a suspend()
#define SLOT(a)
Definition: qobjectdefs.h:226
virtual qint64 pos() const
For random-access devices, this function returns the position that data is written to or read from...
Definition: qiodevice.cpp:624
#define SPEAKER_BACK_RIGHT
T qFromBigEndian(const uchar *src)
int msec() const
Returns the millisecond part (0 to 999) of the time.
Definition: qdatetime.cpp:1611
#define SPEAKER_SIDE_LEFT
The QString class provides a Unicode character string.
Definition: qstring.h:83
T * qobject_cast(QObject *object)
Definition: qobject.h:375
int sampleSize() const
Returns the current sample size value.
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
QAudio::Error error() const
Returns the error state.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define SPEAKER_LOW_FREQUENCY
QAudioFormat::Endian byteOrder() const
Returns the current byteOrder value.
int restart()
Sets this time to the current time and returns the number of milliseconds that have elapsed since the...
Definition: qdatetime.cpp:2095
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
Q_CORE_EXPORT void qDebug(const char *,...)
void setBufferSize(int value)
Sets the audio buffer size to value in bytes.
#define SPEAKER_FRONT_CENTER
The QTime class provides clock time functions.
Definition: qdatetime.h:148
#define SPEAKER_SIDE_RIGHT
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QAudioOutputPrivate(const QByteArray &device, const QAudioFormat &audioFormat)
qint64 restart()
Restarts the timer and returns the time elapsed since the previous start.
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...
int notifyInterval() const
Returns the notify interval in milliseconds.
struct WAVEFORMATEXTENSIBLE * LPPWAVEFORMATEXTENSIBLE
void freeBlocks(WAVEHDR *blockArray)
#define emit
Definition: qobjectdefs.h:76
short qint16
Definition: qglobal.h:935
Q_CORE_EXPORT void qWarning(const char *,...)
int second() const
Returns the second part (0 to 59) of the time.
Definition: qdatetime.cpp:1600
static const char * data(const QByteArray &arr)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
qint64 elapsedUSecs() const
Returns the milliseconds since start() was called, including time in Idle and suspend states...
#define DWORD_PTR
union WAVEFORMATEXTENSIBLE::@309 Samples
qint64 processedUSecs() const
Returns the amount of audio data processed since start() was called in milliseconds.
__int64 qint64
Definition: qglobal.h:942
bool isValid() const
Returns true if all of the parameters are valid.
void suspend()
Stops processing audio data, preserving buffered audio data.
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
#define SPEAKER_FRONT_LEFT
int periodSize() const
Returns the period size in bytes.
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
Definition: qdatetime.cpp:2123
QAudioFormat format() const
Returns the QAudioFormat being used.
struct WAVEFORMATEXTENSIBLE * PWAVEFORMATEXTENSIBLE
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
int compare(const QString &s) const
Definition: qstring.cpp:5037
State
Definition: qaudio.h:59
static QTime currentTime()
Returns the current time as reported by the system clock.
Definition: qdatetime.cpp:3125
#define WAVE_FORMAT_PCM
int bytesFree() const
Returns the free space available in bytes in the audio buffer.
void setNotifyInterval(int milliSeconds)
Sets the interval for notify() signal to be emitted.
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59
void resize(int size)
Sets the size of the byte array to size bytes.
if(void) toggleToolbarShown
QFactoryLoader * l
static const int buffer_size
Definition: qdrawhelper.cpp:80
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
#define SPEAKER_BACK_LEFT
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.
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
The QIODevice class is the base interface class of all I/O devices in Qt.
Definition: qiodevice.h:66
#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
virtual bool seek(qint64 pos)
For random-access devices, this function sets the current position to pos, returning true on success...
Definition: qiodevice.cpp:659
qint64 writeData(const char *data, qint64 len)
Writes up to maxSize bytes from data to the device.
int channels() const
Use channelCount() instead.