Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/multimedia/audiooutput/audiooutput.h

    r651 r769  
    4242#include <math.h>
    4343
    44 #define BUFFER_SIZE 32768
    45 
    4644#include <QObject>
    4745#include <QMainWindow>
     
    5048#include <QPushButton>
    5149#include <QComboBox>
     50#include <QByteArray>
    5251
    5352#include <QAudioOutput>
     
    5756    Q_OBJECT
    5857public:
    59     Generator(QObject *parent);
     58    Generator(const QAudioFormat &format, qint64 durationUs, int frequency, QObject *parent);
    6059    ~Generator();
    6160
     
    6362    void stop();
    6463
    65     char *t;
    66     int  len;
    67     int  pos;
    68     int  total;
    69     char *buffer;
    70     bool finished;
    71     int  chunk_size;
    72 
    7364    qint64 readData(char *data, qint64 maxlen);
    7465    qint64 writeData(const char *data, qint64 len);
     66    qint64 bytesAvailable() const;
    7567
    7668private:
    77     int putShort(char *t, unsigned int value);
    78     int fillData(char *start, int frequency, int seconds);
     69    void generateData(const QAudioFormat &format, qint64 durationUs, int frequency);
     70
     71private:
     72    qint64 m_pos;
     73    QByteArray m_buffer;
    7974};
    8075
     
    8681    ~AudioTest();
    8782
    88     QAudioDeviceInfo  device;
    89     Generator*        gen;
    90     QAudioOutput*     audioOutput;
    91     QIODevice*        output;
    92     QTimer*           timer;
    93     QAudioFormat      settings;
     83private:
     84    void initializeWindow();
     85    void initializeAudio();
     86    void createAudioOutput();
    9487
    95     bool              pullMode;
    96     char*             buffer;
     88private:
     89    QTimer*          m_pullTimer;
    9790
    98     QPushButton*      button;
    99     QPushButton*      button2;
    100     QComboBox*     deviceBox;
     91    // Owned by layout
     92    QPushButton*     m_modeButton;
     93    QPushButton*     m_suspendResumeButton;
     94    QComboBox*       m_deviceBox;
     95
     96    QAudioDeviceInfo m_device;
     97    Generator*       m_generator;
     98    QAudioOutput*    m_audioOutput;
     99    QIODevice*       m_output; // not owned
     100    QAudioFormat     m_format;
     101
     102    bool             m_pullMode;
     103    QByteArray       m_buffer;
     104
     105    static const QString PushModeLabel;
     106    static const QString PullModeLabel;
     107    static const QString SuspendLabel;
     108    static const QString ResumeLabel;
    101109
    102110private slots:
    103     void status();
    104     void writeMore();
    105     void toggle();
    106     void togglePlay();
    107     void state(QAudio::State s);
    108     void deviceChanged(int idx);
     111    void notified();
     112    void pullTimerExpired();
     113    void toggleMode();
     114    void toggleSuspendResume();
     115    void stateChanged(QAudio::State state);
     116    void deviceChanged(int index);
    109117};
    110118
Note: See TracChangeset for help on using the changeset viewer.