summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/audioinput/audioinput.h
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-02-23 15:23:05 (GMT)
committeraxis <qt-info@nokia.com>2010-02-23 15:23:05 (GMT)
commitf67062af3a076468442c29127cb48bb13937ce0e (patch)
treea12cd4c644fb528dd5f95cb58559732a0b8b6311 /examples/multimedia/audioinput/audioinput.h
parenta670009fd378d48ff891602ec31204614e8a476f (diff)
parentc15307e9e916aa613096275919ca91deba64454f (diff)
downloadQt-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/audioinput/audioinput.h')
-rw-r--r--examples/multimedia/audioinput/audioinput.h60
1 files changed, 35 insertions, 25 deletions
diff --git a/examples/multimedia/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h
index abe2be1..f87c682 100644
--- a/examples/multimedia/audioinput/audioinput.h
+++ b/examples/multimedia/audioinput/audioinput.h
@@ -45,6 +45,7 @@
#include <QMainWindow>
#include <QPushButton>
#include <QComboBox>
+#include <QByteArray>
#include <qaudioinput.h>
@@ -52,21 +53,21 @@ class AudioInfo : public QIODevice
{
Q_OBJECT
public:
- AudioInfo(QObject *parent, QAudioInput *device);
+ AudioInfo(const QAudioFormat &format, QObject *parent);
~AudioInfo();
void start();
void stop();
- int LinearMax();
+ qreal level() const { return m_level; }
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
- QAudioInput *input;
-
private:
- int m_maxValue;
+ const QAudioFormat m_format;
+ quint16 m_maxAmplitude;
+ qreal m_level; // 0.0 <= m_level <= 1.0
signals:
void update();
@@ -80,14 +81,14 @@ class RenderArea : public QWidget
public:
RenderArea(QWidget *parent = 0);
- void setLevel(int value);
+ void setLevel(qreal value);
protected:
void paintEvent(QPaintEvent *event);
private:
- int level;
- QPixmap pixmap;
+ qreal m_level;
+ QPixmap m_pixmap;
};
class InputTest : public QMainWindow
@@ -97,29 +98,38 @@ public:
InputTest();
~InputTest();
+private:
+ void initializeWindow();
+ void initializeAudio();
+ void createAudioInput();
+
private slots:
void refreshDisplay();
- void status();
+ void notified();
void readMore();
void toggleMode();
void toggleSuspend();
- void state(QAudio::State s);
- void deviceChanged(int idx);
+ void stateChanged(QAudio::State state);
+ void deviceChanged(int index);
private:
- AudioInfo *audioinfo;
- QAudioDeviceInfo device;
- QAudioFormat format;
- QAudioInput *audioInput;
- QIODevice *input;
- RenderArea *canvas;
-
- bool pullMode;
-
- QPushButton *button;
- QPushButton *button2;
- QComboBox *deviceBox;
-
- char *buffer;
+ // Owned by layout
+ RenderArea *m_canvas;
+ QPushButton *m_modeButton;
+ QPushButton *m_suspendResumeButton;
+ QComboBox *m_deviceBox;
+
+ AudioInfo *m_audioInfo;
+ QAudioDeviceInfo m_device;
+ QAudioFormat m_format;
+ QAudioInput *m_audioInput;
+ QIODevice *m_input;
+ bool m_pullMode;
+ QByteArray m_buffer;
+
+ static const QString PushModeLabel;
+ static const QString PullModeLabel;
+ static const QString SuspendLabel;
+ static const QString ResumeLabel;
};