Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/demos/spectrum/app/engine.h

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6666
    6767class FrequencySpectrum;
    68 
    6968QT_FORWARD_DECLARE_CLASS(QAudioInput)
    7069QT_FORWARD_DECLARE_CLASS(QAudioOutput)
     
    9392
    9493    /**
    95      * \return Reference to internal audio buffer
    96      * \note This reference is valid for the lifetime of the Engine
    97      */
    98     const QByteArray& buffer() const    { return m_buffer; }
    99 
    100     /**
    10194     * \return Current audio format
    10295     * \note May be QAudioFormat() if engine is not initialized
     
    131124    /**
    132125     * Position of the audio input device.
    133      * \return Position in microseconds.
     126     * \return Position in bytes.
    134127     */
    135128    qint64 recordPosition() const   { return m_recordPosition; }
     
    149142    /**
    150143     * Position of the audio output device.
    151      * \return Position in microseconds.
     144     * \return Position in bytes.
    152145     */
    153146    qint64 playPosition() const     { return m_playPosition; }
     
    155148    /**
    156149     * Length of the internal engine buffer.
    157      * \return Buffer length in microseconds.
    158      */
    159     qint64 bufferDuration() const;
     150     * \return Buffer length in bytes.
     151     */
     152    qint64 bufferLength() const;
    160153
    161154    /**
    162155     * 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; }
    172159
    173160    /**
     
    205192     * \param duration Duration in microseconds
    206193     */
    207     void bufferDurationChanged(qint64 duration);
     194    void bufferLengthChanged(qint64 duration);
    208195
    209196    /**
    210197     * Amount of data in buffer has changed.
    211      * \param duration Duration of data in microseconds
    212      */
    213     void dataDurationChanged(qint64 duration);
     198     * \param Length of data in bytes
     199     */
     200    void dataLengthChanged(qint64 duration);
    214201
    215202    /**
    216203     * Position of the audio input device has changed.
    217      * \param position Position in microseconds
     204     * \param position Position in bytes
    218205     */
    219206    void recordPositionChanged(qint64 position);
     
    221208    /**
    222209     * Position of the audio output device has changed.
    223      * \param position Position in microseconds
     210     * \param position Position in bytes
    224211     */
    225212    void playPositionChanged(qint64 position);
     
    229216     * \param rmsLevel RMS level in range 0.0 - 1.0
    230217     * \param peakLevel Peak level in range 0.0 - 1.0
    231      * \param numSamples Number of audio samples analysed
     218     * \param numSamples Number of audio samples analyzed
    232219     */
    233220    void levelChanged(qreal rmsLevel, qreal peakLevel, int numSamples);
     
    235222    /**
    236223     * Spectrum has changed.
    237      * \param position Position of start of window in microseconds
    238      * \param length   Length of window in microseconds
     224     * \param position Position of start of window in bytes
     225     * \param length   Length of window in bytes
    239226     * \param spectrum Resulting frequency spectrum
    240227     */
    241228    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);
    242236
    243237private slots:
     
    248242
    249243private:
     244    void resetAudioDevices();
    250245    bool initialize();
    251246    bool selectFormat();
     
    277272    SweptTone           m_tone;
    278273
    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;
    281278
    282279    QAudioFormat        m_format;
     
    295292
    296293    QByteArray          m_buffer;
     294    qint64              m_bufferPosition;
     295    qint64              m_bufferLength;
    297296    qint64              m_dataLength;
    298297
     298    int                 m_levelBufferLength;
    299299    qreal               m_rmsLevel;
    300300    qreal               m_peakLevel;
    301301
    302     int                 m_spectrumLengthBytes;
     302    int                 m_spectrumBufferLength;
    303303    QByteArray          m_spectrumBuffer;
    304304    SpectrumAnalyser    m_spectrumAnalyser;
Note: See TracChangeset for help on using the changeset viewer.