examples/multimedia/audioinput/audioinput.h
branchRCL_3
changeset 4 3b1da2848fc7
parent 0 1918ee327afb
child 7 3f74d0d4af4c
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the examples of the Qt Toolkit.
     7 ** This file is part of the examples of the Qt Toolkit.
     8 **
     8 **
    50 
    50 
    51 class AudioInfo : public QIODevice
    51 class AudioInfo : public QIODevice
    52 {
    52 {
    53     Q_OBJECT
    53     Q_OBJECT
    54 public:
    54 public:
    55     AudioInfo(QObject* parent, QAudioInput* device);
    55     AudioInfo(QObject *parent, QAudioInput *device);
    56     ~AudioInfo();
    56     ~AudioInfo();
    57 
    57 
    58     void start();
    58     void start();
    59     void stop();
    59     void stop();
    60 
    60 
    61     int LinearMax();
    61     int LinearMax();
    62 
    62 
    63     qint64 readData(char *data, qint64 maxlen);
    63     qint64 readData(char *data, qint64 maxlen);
    64     qint64 writeData(const char *data, qint64 len);
    64     qint64 writeData(const char *data, qint64 len);
    65 
    65 
    66     QAudioInput*   input;
    66     QAudioInput *input;
    67 
    67 
    68 private:
    68 private:
    69     int m_maxValue;
    69     int m_maxValue;
    70 
    70 
    71 signals:
    71 signals:
    95     Q_OBJECT
    95     Q_OBJECT
    96 public:
    96 public:
    97     InputTest();
    97     InputTest();
    98     ~InputTest();
    98     ~InputTest();
    99 
    99 
   100     QAudioDeviceInfo device;
       
   101     QAudioFormat   format;
       
   102     QAudioInput*   audioInput;
       
   103     AudioInfo*     audioinfo;
       
   104     QIODevice*     input;
       
   105     RenderArea*    canvas;
       
   106 
       
   107     bool           pullMode;
       
   108 
       
   109     QPushButton*   button;
       
   110     QPushButton*   button2;
       
   111     QComboBox*     deviceBox;
       
   112 
       
   113     char*          buffer;
       
   114 
       
   115 private slots:
   100 private slots:
   116     void refreshDisplay();
   101     void refreshDisplay();
   117     void status();
   102     void status();
   118     void readMore();
   103     void readMore();
   119     void toggleMode();
   104     void toggleMode();
   120     void toggleSuspend();
   105     void toggleSuspend();
   121     void state(QAudio::State s);
   106     void state(QAudio::State s);
   122     void deviceChanged(int idx);
   107     void deviceChanged(int idx);
       
   108 
       
   109 private:
       
   110     AudioInfo *audioinfo;
       
   111     QAudioDeviceInfo device;
       
   112     QAudioFormat format;
       
   113     QAudioInput *audioInput;
       
   114     QIODevice *input;
       
   115     RenderArea *canvas;
       
   116 
       
   117     bool pullMode;
       
   118 
       
   119     QPushButton *button;
       
   120     QPushButton *button2;
       
   121     QComboBox *deviceBox;
       
   122 
       
   123     char *buffer;
   123 };
   124 };
   124 
   125