80 QAudioInputPrivate *const m_audioDevice; |
79 QAudioInputPrivate *const m_audioDevice; |
81 }; |
80 }; |
82 |
81 |
83 class QAudioInputPrivate |
82 class QAudioInputPrivate |
84 : public QAbstractAudioInput |
83 : public QAbstractAudioInput |
85 , public MDevSoundObserver |
|
86 { |
84 { |
87 friend class SymbianAudioInputPrivate; |
85 friend class SymbianAudioInputPrivate; |
88 Q_OBJECT |
86 Q_OBJECT |
89 public: |
87 public: |
90 QAudioInputPrivate(const QByteArray &device, |
88 QAudioInputPrivate(const QByteArray &device, |
107 qint64 elapsedUSecs() const; |
105 qint64 elapsedUSecs() const; |
108 QAudio::Error error() const; |
106 QAudio::Error error() const; |
109 QAudio::State state() const; |
107 QAudio::State state() const; |
110 QAudioFormat format() const; |
108 QAudioFormat format() const; |
111 |
109 |
112 // MDevSoundObserver |
|
113 void InitializeComplete(TInt aError); |
|
114 void ToneFinished(TInt aError); |
|
115 void BufferToBeFilled(CMMFBuffer *aBuffer); |
|
116 void PlayError(TInt aError); |
|
117 void BufferToBeEmptied(CMMFBuffer *aBuffer); |
|
118 void RecordError(TInt aError); |
|
119 void ConvertError(TInt aError); |
|
120 void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg); |
|
121 |
|
122 private slots: |
110 private slots: |
123 void pullData(); |
111 void pullData(); |
|
112 void devsoundInitializeComplete(int err); |
|
113 void devsoundBufferToBeEmptied(CMMFBuffer *); |
|
114 void devsoundRecordError(int err); |
124 |
115 |
125 private: |
116 private: |
126 void open(); |
117 void open(); |
127 void startRecording(); |
118 void startRecording(); |
128 void startDevSoundL(); |
|
129 void startDataTransfer(); |
119 void startDataTransfer(); |
130 CMMFDataBuffer* currentBuffer() const; |
120 CMMFDataBuffer* currentBuffer() const; |
131 void pushData(); |
121 void pushData(); |
132 qint64 read(char *data, qint64 len); |
122 qint64 read(char *data, qint64 len); |
133 void bufferEmptied(); |
123 void bufferEmptied(); |
135 |
125 |
136 qint64 getSamplesRecorded() const; |
126 qint64 getSamplesRecorded() const; |
137 |
127 |
138 void setError(QAudio::Error error); |
128 void setError(QAudio::Error error); |
139 void setState(SymbianAudio::State state); |
129 void setState(SymbianAudio::State state); |
140 |
|
141 QAudio::State initializingState() const; |
|
142 |
130 |
143 private: |
131 private: |
144 const QByteArray m_device; |
132 const QByteArray m_device; |
145 const QAudioFormat m_format; |
133 const QAudioFormat m_format; |
146 |
134 |
156 bool m_pullMode; |
144 bool m_pullMode; |
157 QIODevice *m_sink; |
145 QIODevice *m_sink; |
158 |
146 |
159 QScopedPointer<QTimer> m_pullTimer; |
147 QScopedPointer<QTimer> m_pullTimer; |
160 |
148 |
161 QScopedPointer<CMMFDevSound> m_devSound; |
149 SymbianAudio::DevSoundWrapper* m_devSound; |
162 TUint32 m_nativeFourCC; |
|
163 TMMFCapabilities m_nativeFormat; |
|
164 |
150 |
165 // Latest buffer provided by DevSound, to be empied of data. |
151 // Latest buffer provided by DevSound, to be empied of data. |
166 CMMFDataBuffer *m_devSoundBuffer; |
152 CMMFDataBuffer *m_devSoundBuffer; |
167 |
153 |
168 int m_devSoundBufferSize; |
154 int m_devSoundBufferSize; |