Changeset 846 for trunk/demos/spectrum/app/engine.h
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/demos/spectrum/app/engine.h
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 66 66 67 67 class FrequencySpectrum; 68 69 68 QT_FORWARD_DECLARE_CLASS(QAudioInput) 70 69 QT_FORWARD_DECLARE_CLASS(QAudioOutput) … … 93 92 94 93 /** 95 * \return Reference to internal audio buffer96 * \note This reference is valid for the lifetime of the Engine97 */98 const QByteArray& buffer() const { return m_buffer; }99 100 /**101 94 * \return Current audio format 102 95 * \note May be QAudioFormat() if engine is not initialized … … 131 124 /** 132 125 * Position of the audio input device. 133 * \return Position in microseconds.126 * \return Position in bytes. 134 127 */ 135 128 qint64 recordPosition() const { return m_recordPosition; } … … 149 142 /** 150 143 * Position of the audio output device. 151 * \return Position in microseconds.144 * \return Position in bytes. 152 145 */ 153 146 qint64 playPosition() const { return m_playPosition; } … … 155 148 /** 156 149 * Length of the internal engine buffer. 157 * \return Buffer length in microseconds.158 */ 159 qint64 buffer Duration() const;150 * \return Buffer length in bytes. 151 */ 152 qint64 bufferLength() const; 160 153 161 154 /** 162 155 * Amount of data held in the buffer. 163 * \return Data duration in microseconds. 164 */ 165 qint64 dataDuration() const; 166 167 /** 168 * Returns the size of the underlying audio buffer in bytes. 169 * This should be an approximation of the capture latency. 170 */ 171 qint64 audioBufferLength() const; 156 * \return Data length in bytes. 157 */ 158 qint64 dataLength() const { return m_dataLength; } 172 159 173 160 /** … … 205 192 * \param duration Duration in microseconds 206 193 */ 207 void buffer DurationChanged(qint64 duration);194 void bufferLengthChanged(qint64 duration); 208 195 209 196 /** 210 197 * Amount of data in buffer has changed. 211 * \param duration Duration of data in microseconds212 */ 213 void data DurationChanged(qint64 duration);198 * \param Length of data in bytes 199 */ 200 void dataLengthChanged(qint64 duration); 214 201 215 202 /** 216 203 * Position of the audio input device has changed. 217 * \param position Position in microseconds204 * \param position Position in bytes 218 205 */ 219 206 void recordPositionChanged(qint64 position); … … 221 208 /** 222 209 * Position of the audio output device has changed. 223 * \param position Position in microseconds210 * \param position Position in bytes 224 211 */ 225 212 void playPositionChanged(qint64 position); … … 229 216 * \param rmsLevel RMS level in range 0.0 - 1.0 230 217 * \param peakLevel Peak level in range 0.0 - 1.0 231 * \param numSamples Number of audio samples analy sed218 * \param numSamples Number of audio samples analyzed 232 219 */ 233 220 void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples); … … 235 222 /** 236 223 * Spectrum has changed. 237 * \param position Position of start of window in microseconds238 * \param length Length of window in microseconds224 * \param position Position of start of window in bytes 225 * \param length Length of window in bytes 239 226 * \param spectrum Resulting frequency spectrum 240 227 */ 241 228 void spectrumChanged(qint64 position, qint64 length, const FrequencySpectrum &spectrum); 229 230 /** 231 * Buffer containing audio data has changed. 232 * \param position Position of start of buffer in bytes 233 * \param buffer Buffer 234 */ 235 void bufferChanged(qint64 position, qint64 length, const QByteArray &buffer); 242 236 243 237 private slots: … … 248 242 249 243 private: 244 void resetAudioDevices(); 250 245 bool initialize(); 251 246 bool selectFormat(); … … 277 272 SweptTone m_tone; 278 273 279 QFile* m_file; 280 WavFile m_wavFile; 274 WavFile* m_file; 275 // We need a second file handle via which to read data into m_buffer 276 // for analysis 277 WavFile* m_analysisFile; 281 278 282 279 QAudioFormat m_format; … … 295 292 296 293 QByteArray m_buffer; 294 qint64 m_bufferPosition; 295 qint64 m_bufferLength; 297 296 qint64 m_dataLength; 298 297 298 int m_levelBufferLength; 299 299 qreal m_rmsLevel; 300 300 qreal m_peakLevel; 301 301 302 int m_spectrum LengthBytes;302 int m_spectrumBufferLength; 303 303 QByteArray m_spectrumBuffer; 304 304 SpectrumAnalyser m_spectrumAnalyser;
Note:
See TracChangeset
for help on using the changeset viewer.