diff options
author | axis <qt-info@nokia.com> | 2010-02-23 15:23:05 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2010-02-23 15:23:05 (GMT) |
commit | f67062af3a076468442c29127cb48bb13937ce0e (patch) | |
tree | a12cd4c644fb528dd5f95cb58559732a0b8b6311 /examples/multimedia/audiooutput/audiooutput.h | |
parent | a670009fd378d48ff891602ec31204614e8a476f (diff) | |
parent | c15307e9e916aa613096275919ca91deba64454f (diff) | |
download | Qt-f67062af3a076468442c29127cb48bb13937ce0e.zip Qt-f67062af3a076468442c29127cb48bb13937ce0e.tar.gz Qt-f67062af3a076468442c29127cb48bb13937ce0e.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts:
mkspecs/features/symbian/qt.prf
qmake/Makefile.unix
qmake/Makefile.win32
qmake/Makefile.win32-g++
qmake/Makefile.win32-g++-sh
qmake/generators/symbian/initprojectdeploy_symbian.cpp
src/src.pro
Diffstat (limited to 'examples/multimedia/audiooutput/audiooutput.h')
-rw-r--r-- | examples/multimedia/audiooutput/audiooutput.h | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/examples/multimedia/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h index 372cf78..889482b 100644 --- a/examples/multimedia/audiooutput/audiooutput.h +++ b/examples/multimedia/audiooutput/audiooutput.h @@ -41,14 +41,13 @@ #include <math.h> -#define BUFFER_SIZE 32768 - #include <QObject> #include <QMainWindow> #include <QIODevice> #include <QTimer> #include <QPushButton> #include <QComboBox> +#include <QByteArray> #include <QAudioOutput> @@ -56,26 +55,22 @@ class Generator : public QIODevice { Q_OBJECT public: - Generator(QObject *parent); + Generator(const QAudioFormat &format, qint64 durationUs, int frequency, QObject *parent); ~Generator(); void start(); void stop(); - char *t; - int len; - int pos; - int total; - char *buffer; - bool finished; - int chunk_size; - qint64 readData(char *data, qint64 maxlen); qint64 writeData(const char *data, qint64 len); + qint64 bytesAvailable() const; private: - int putShort(char *t, unsigned int value); - int fillData(char *start, int frequency, int seconds); + void generateData(const QAudioFormat &format, qint64 durationUs, int frequency); + +private: + qint64 m_pos; + QByteArray m_buffer; }; class AudioTest : public QMainWindow @@ -85,26 +80,39 @@ public: AudioTest(); ~AudioTest(); - QAudioDeviceInfo device; - Generator* gen; - QAudioOutput* audioOutput; - QIODevice* output; - QTimer* timer; - QAudioFormat settings; +private: + void initializeWindow(); + void initializeAudio(); + void createAudioOutput(); + +private: + QTimer* m_pullTimer; + + // Owned by layout + QPushButton* m_modeButton; + QPushButton* m_suspendResumeButton; + QComboBox* m_deviceBox; + + QAudioDeviceInfo m_device; + Generator* m_generator; + QAudioOutput* m_audioOutput; + QIODevice* m_output; // not owned + QAudioFormat m_format; - bool pullMode; - char* buffer; + bool m_pullMode; + QByteArray m_buffer; - QPushButton* button; - QPushButton* button2; - QComboBox* deviceBox; + static const QString PushModeLabel; + static const QString PullModeLabel; + static const QString SuspendLabel; + static const QString ResumeLabel; private slots: - void status(); - void writeMore(); - void toggle(); - void togglePlay(); - void state(QAudio::State s); - void deviceChanged(int idx); + void notified(); + void pullTimerExpired(); + void toggleMode(); + void toggleSuspendResume(); + void stateChanged(QAudio::State state); + void deviceChanged(int index); }; |