00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _PWAVFILEDEV
00040 #define _PWAVFILEDEV
00041
00042 #ifdef P_USE_PRAGMA
00043 #pragma interface
00044 #endif
00045
00046 #include <ptlib.h>
00047
00048 #include <ptlib/sound.h>
00049 #include <ptclib/pwavfile.h>
00050 #include <ptclib/delaychan.h>
00051
00052 #if defined(P_WAVFILE)
00053
00054
00056
00057
00058
00059
00060 class PSoundChannel_WAVFile : public PSoundChannel
00061 {
00062 PCLASSINFO(PSoundChannel_WAVFile, PSoundChannel);
00063 public:
00064 PSoundChannel_WAVFile();
00065 PSoundChannel_WAVFile(const PString &device,
00066 PSoundChannel::Directions dir,
00067 unsigned numChannels,
00068 unsigned sampleRate,
00069 unsigned bitsPerSample);
00070 ~PSoundChannel_WAVFile();
00071 static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
00072 BOOL Open(const PString & _device,
00073 Directions _dir,
00074 unsigned _numChannels,
00075 unsigned _sampleRate,
00076 unsigned _bitsPerSample);
00077 virtual PString GetName() const;
00078 BOOL Close();
00079 BOOL IsOpen() const;
00080 BOOL Write(const void * buf, PINDEX len);
00081 BOOL Read(void * buf, PINDEX len);
00082 BOOL SetFormat(unsigned numChannels,
00083 unsigned sampleRate,
00084 unsigned bitsPerSample);
00085 unsigned GetChannels() const;
00086 unsigned GetSampleRate() const;
00087 unsigned GetSampleSize() const;
00088 BOOL SetBuffers(PINDEX size, PINDEX count);
00089 BOOL GetBuffers(PINDEX & size, PINDEX & count);
00090 BOOL HasPlayCompleted();
00091 BOOL WaitForPlayCompletion();
00092 BOOL StartRecording();
00093 BOOL IsRecordBufferFull();
00094 BOOL AreAllRecordBuffersFull();
00095 BOOL WaitForRecordBufferFull();
00096 BOOL WaitForAllRecordBuffersFull();
00097
00098 protected:
00099 PWAVFile m_WAVFile;
00100 PAdaptiveDelay m_Pacing;
00101 bool m_autoRepeat;
00102 };
00103
00104
00105 #endif // defined(P_WAVFILE)
00106
00107 #endif // _PWAVFILEDEV
00108