Removed printf that was interpreted as a trigraph
[pwlib.git] / plugins / sound_esd / sound_esd.h
blob0a2ccaf5466f8147275a17d112bb634164a75779
2 #include <ptlib.h>
3 #include <ptlib/socket.h>
4 #include <ptlib/plugin.h>
6 //#if !P_USE_INLINES
7 //#include <ptlib/contain.inl>
8 //#endif
10 #ifdef P_LINUX
11 #include <sys/soundcard.h>
12 #endif
14 #ifdef P_FREEBSD
15 #if P_FREEBSD >= 500000
16 #include <sys/soundcard.h>
17 #else
18 #include <machine/soundcard.h>
19 #endif
20 #endif
22 #if defined(P_OPENBSD) || defined(P_NETBSD)
23 #include <soundcard.h>
24 #endif
26 class PSoundChannelESD: public PSoundChannel
28 public:
29 PSoundChannelESD();
30 void Construct();
31 PSoundChannelESD(const PString &device,
32 PSoundChannel::Directions dir,
33 unsigned numChannels,
34 unsigned sampleRate,
35 unsigned bitsPerSample);
36 ~PSoundChannelESD();
37 static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
38 static PString GetDefaultDevice(PSoundChannel::Directions);
39 BOOL Open(const PString & _device,
40 Directions _dir,
41 unsigned _numChannels,
42 unsigned _sampleRate,
43 unsigned _bitsPerSample);
44 BOOL Setup();
45 BOOL Close();
46 BOOL IsOpen() const;
47 BOOL Write(const void * buf, PINDEX len);
48 BOOL Read(void * buf, PINDEX len);
49 BOOL SetFormat(unsigned numChannels,
50 unsigned sampleRate,
51 unsigned bitsPerSample);
52 unsigned GetChannels() const;
53 unsigned GetSampleRate() const;
54 unsigned GetSampleSize() const;
55 BOOL SetBuffers(PINDEX size, PINDEX count);
56 BOOL GetBuffers(PINDEX & size, PINDEX & count);
57 BOOL PlaySound(const PSound & sound, BOOL wait);
58 BOOL PlayFile(const PFilePath & filename, BOOL wait);
59 BOOL HasPlayCompleted();
60 BOOL WaitForPlayCompletion();
61 BOOL RecordSound(PSound & sound);
62 BOOL RecordFile(const PFilePath & filename);
63 BOOL StartRecording();
64 BOOL IsRecordBufferFull();
65 BOOL AreAllRecordBuffersFull();
66 BOOL WaitForRecordBufferFull();
67 BOOL WaitForAllRecordBuffersFull();
68 BOOL Abort();
69 BOOL SetVolume(unsigned newVal);
70 BOOL GetVolume(unsigned &devVol);
72 protected:
73 unsigned mNumChannels;
74 unsigned mSampleRate;
75 unsigned mBitsPerSample;
76 unsigned actualSampleRate;
77 Directions direction;
78 PString device;
79 BOOL isInitialised;