author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 12:15:23 +0300 | |
branch | RCL_3 |
changeset 12 | cc75c76972ee |
parent 7 | 3f74d0d4af4c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtMultimedia module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
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 |
||
54 |
#ifndef QAUDIOINPUT_MAC_P_H |
|
55 |
#define QAUDIOINPUT_MAC_P_H |
|
56 |
||
57 |
#include <CoreServices/CoreServices.h> |
|
58 |
#include <CoreAudio/CoreAudio.h> |
|
59 |
#include <AudioUnit/AudioUnit.h> |
|
60 |
#include <AudioToolbox/AudioToolbox.h> |
|
61 |
||
62 |
#include <QtCore/qobject.h> |
|
63 |
#include <QtCore/qmutex.h> |
|
64 |
#include <QtCore/qwaitcondition.h> |
|
65 |
#include <QtCore/qatomic.h> |
|
66 |
||
67 |
#include <QtMultimedia/qaudio.h> |
|
68 |
#include <QtMultimedia/qaudioformat.h> |
|
69 |
#include <QtMultimedia/qaudioengine.h> |
|
70 |
||
71 |
QT_BEGIN_HEADER |
|
72 |
||
73 |
QT_BEGIN_NAMESPACE |
|
74 |
||
75 |
class QTimer; |
|
76 |
class QIODevice; |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
77 |
class QAbstractAudioDeviceInfo; |
0 | 78 |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
79 |
namespace QtMultimediaInternal |
0 | 80 |
{ |
81 |
class QAudioInputBuffer; |
|
82 |
} |
|
83 |
||
84 |
class QAudioInputPrivate : public QAbstractAudioInput |
|
85 |
{ |
|
86 |
Q_OBJECT |
|
87 |
||
88 |
public: |
|
89 |
bool isOpen; |
|
90 |
int periodSizeBytes; |
|
91 |
int internalBufferSize; |
|
92 |
qint64 totalFrames; |
|
93 |
QAudioFormat audioFormat; |
|
94 |
QIODevice* audioIO; |
|
95 |
AudioUnit audioUnit; |
|
96 |
AudioDeviceID audioDeviceId; |
|
97 |
Float64 clockFrequency; |
|
98 |
UInt64 startTime; |
|
99 |
QAudio::Error errorCode; |
|
100 |
QAudio::State stateCode; |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
101 |
QtMultimediaInternal::QAudioInputBuffer* audioBuffer; |
0 | 102 |
QMutex mutex; |
103 |
QWaitCondition threadFinished; |
|
104 |
QAtomicInt audioThreadState; |
|
105 |
QTimer* intervalTimer; |
|
106 |
AudioStreamBasicDescription streamFormat; |
|
107 |
AudioStreamBasicDescription deviceFormat; |
|
7
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
108 |
QAbstractAudioDeviceInfo *audioDeviceInfo; |
0 | 109 |
|
110 |
QAudioInputPrivate(const QByteArray& device, QAudioFormat const& format); |
|
111 |
~QAudioInputPrivate(); |
|
112 |
||
113 |
bool open(); |
|
114 |
void close(); |
|
115 |
||
116 |
QAudioFormat format() const; |
|
117 |
||
118 |
QIODevice* start(QIODevice* device); |
|
119 |
void stop(); |
|
120 |
void reset(); |
|
121 |
void suspend(); |
|
122 |
void resume(); |
|
123 |
void idle(); |
|
124 |
||
125 |
int bytesReady() const; |
|
126 |
int periodSize() const; |
|
127 |
||
128 |
void setBufferSize(int value); |
|
129 |
int bufferSize() const; |
|
130 |
||
131 |
void setNotifyInterval(int milliSeconds); |
|
132 |
int notifyInterval() const; |
|
133 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
134 |
qint64 processedUSecs() const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
135 |
qint64 elapsedUSecs() const; |
0 | 136 |
|
137 |
QAudio::Error error() const; |
|
138 |
QAudio::State state() const; |
|
139 |
||
140 |
void audioThreadStart(); |
|
141 |
void audioThreadStop(); |
|
142 |
||
143 |
void audioDeviceStop(); |
|
144 |
void audioDeviceFull(); |
|
145 |
void audioDeviceError(); |
|
146 |
||
147 |
void startTimers(); |
|
148 |
void stopTimers(); |
|
149 |
||
150 |
private slots: |
|
151 |
void deviceStopped(); |
|
152 |
||
153 |
private: |
|
154 |
enum { Running, Stopped }; |
|
155 |
||
156 |
// Input callback |
|
157 |
static OSStatus inputCallback(void* inRefCon, |
|
158 |
AudioUnitRenderActionFlags* ioActionFlags, |
|
159 |
const AudioTimeStamp* inTimeStamp, |
|
160 |
UInt32 inBusNumber, |
|
161 |
UInt32 inNumberFrames, |
|
162 |
AudioBufferList* ioData); |
|
163 |
}; |
|
164 |
||
165 |
QT_END_NAMESPACE |
|
166 |
||
167 |
QT_END_HEADER |
|
168 |
||
169 |
#endif // QAUDIOINPUT_MAC_P_H |