00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef TONE_H_
00010 #define TONE_H_
00011
00012 #include <qsqldatabase.h>
00013 #include <qregexp.h>
00014 #include <qtimer.h>
00015 #include <qptrlist.h>
00016 #include <qthread.h>
00017
00018 #ifndef WIN32
00019 #include <mythtv/mythwidgets.h>
00020 #include <mythtv/dialogbox.h>
00021
00022 #include "directory.h"
00023 #endif
00024
00025 #include "webcam.h"
00026 #include "wavfile.h"
00027 #include "rtp.h"
00028
00029
00030 class Tone : public QObject
00031 {
00032 #ifndef WIN32
00033 Q_OBJECT
00034 #endif
00035
00036 public:
00037 Tone(int freqHz, int volume, int ms, QObject *parent = 0, const char * = 0);
00038 Tone(const Tone &t, QObject *parent = 0, const char * = 0);
00039 Tone(int ms, QObject *parent = 0, const char * = 0);
00040 Tone(wavfile &wav, QObject *parent = 0, const char * = 0);
00041 virtual ~Tone();
00042 Tone& operator+=(const Tone &rhs);
00043 void sum(int freqHz, int volume);
00044 short *getAudio() { return toneBuffer; };
00045 int getSamples() { return Samples; };
00046 bool Playing();
00047
00048 void Play(QString deviceName, bool loop);
00049 void Stop();
00050 void OpenSpeaker(QString devName);
00051 void CloseSpeaker();
00052
00053 public slots:
00054 void audioTimerExpiry();
00055
00056 private:
00057 int Samples;
00058 short *toneBuffer;
00059 bool Loop;
00060 QTimer *audioTimer;
00061 #ifdef WIN32
00062 HWAVEOUT hSpeaker;
00063 WAVEHDR spkBufferDescr;
00064 #else
00065 AudioOutput *mythOutput;
00066 #endif
00067 };
00068
00069
00070 class TelephonyTones
00071 {
00072 public:
00073 enum ToneId { TONE_RINGBACK, TONE_INCOMING_CALL };
00074
00075 TelephonyTones();
00076 ~TelephonyTones();
00077 Tone *TTone(ToneId Id);
00078 Tone *dtmf(int n);
00079
00080 private:
00081 QMap<ToneId, Tone *> tone;
00082 QMap<int, Tone *> toneDtmf;
00083 };
00084
00085
00086 #endif