Removed printf that was interpreted as a trigraph
[pwlib.git] / plugins / sound_oss / sound_oss.h
blobf067ba4670cbe1dd37523e3fd01751adc406736e
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 SoundHandleEntry : public PObject {
28 PCLASSINFO(SoundHandleEntry, PObject)
30 public:
31 SoundHandleEntry();
33 int handle;
34 int direction;
36 unsigned numChannels;
37 unsigned sampleRate;
38 unsigned bitsPerSample;
39 unsigned fragmentValue;
40 BOOL isInitialised;
43 class PSoundChannelOSS: public PSoundChannel
45 public:
46 PSoundChannelOSS();
47 void Construct();
48 PSoundChannelOSS(const PString &device,
49 PSoundChannel::Directions dir,
50 unsigned numChannels,
51 unsigned sampleRate,
52 unsigned bitsPerSample);
53 ~PSoundChannelOSS();
54 static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
55 static PString GetDefaultDevice(PSoundChannel::Directions);
56 BOOL Open(const PString & _device,
57 Directions _dir,
58 unsigned _numChannels,
59 unsigned _sampleRate,
60 unsigned _bitsPerSample);
61 BOOL Setup();
62 BOOL Close();
63 BOOL IsOpen() const;
64 BOOL Write(const void * buf, PINDEX len);
65 BOOL Read(void * buf, PINDEX len);
66 BOOL SetFormat(unsigned numChannels,
67 unsigned sampleRate,
68 unsigned bitsPerSample);
69 unsigned GetChannels() const;
70 unsigned GetSampleRate() const;
71 unsigned GetSampleSize() const;
72 BOOL SetBuffers(PINDEX size, PINDEX count);
73 BOOL GetBuffers(PINDEX & size, PINDEX & count);
74 BOOL PlaySound(const PSound & sound, BOOL wait);
75 BOOL PlayFile(const PFilePath & filename, BOOL wait);
76 BOOL HasPlayCompleted();
77 BOOL WaitForPlayCompletion();
78 BOOL RecordSound(PSound & sound);
79 BOOL RecordFile(const PFilePath & filename);
80 BOOL StartRecording();
81 BOOL IsRecordBufferFull();
82 BOOL AreAllRecordBuffersFull();
83 BOOL WaitForRecordBufferFull();
84 BOOL WaitForAllRecordBuffersFull();
85 BOOL Abort();
86 BOOL SetVolume(unsigned newVal);
87 BOOL GetVolume(unsigned &devVol);
89 protected:
90 unsigned mNumChannels;
91 unsigned mSampleRate;
92 unsigned mBitsPerSample;
93 unsigned actualSampleRate;
94 Directions direction;
95 PString device;
96 BOOL isInitialised;