Fixed DevStudio 2003 build with memory check code.
[pwlib.git] / plugins / sound_oss / sound_oss.h
blob2735456453343fe1cfff3493e3c02c918848919e
2 #include <ptlib.h>
3 #include <ptlib/sound.h>
4 #include <ptlib/socket.h>
6 //#if !P_USE_INLINES
7 //#include <ptlib/contain.inl>
8 //#endif
10 #ifdef P_SOLARIS
11 #include <sys/soundcard.h>
12 #endif
14 #ifdef P_LINUX
15 #include <sys/soundcard.h>
16 #endif
18 #ifdef P_FREEBSD
19 #if P_FREEBSD >= 500000
20 #include <sys/soundcard.h>
21 #else
22 #include <machine/soundcard.h>
23 #endif
24 #endif
26 #if defined(P_OPENBSD) || defined(P_NETBSD)
27 #include <soundcard.h>
28 #endif
30 class SoundHandleEntry : public PObject {
32 PCLASSINFO(SoundHandleEntry, PObject)
34 public:
35 SoundHandleEntry();
37 int handle;
38 int direction;
40 unsigned numChannels;
41 unsigned sampleRate;
42 unsigned bitsPerSample;
43 unsigned fragmentValue;
44 BOOL isInitialised;
45 unsigned resampleRate;
48 class PSoundChannelOSS: public PSoundChannel
50 public:
51 PSoundChannelOSS();
52 void Construct();
53 PSoundChannelOSS(const PString &device,
54 PSoundChannel::Directions dir,
55 unsigned numChannels,
56 unsigned sampleRate,
57 unsigned bitsPerSample);
58 ~PSoundChannelOSS();
59 static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
60 static PString GetDefaultDevice(PSoundChannel::Directions);
61 BOOL Open(const PString & _device,
62 Directions _dir,
63 unsigned _numChannels,
64 unsigned _sampleRate,
65 unsigned _bitsPerSample);
66 BOOL Setup();
67 BOOL Close();
68 BOOL IsOpen() const;
69 BOOL Write(const void * buf, PINDEX len);
70 BOOL Read(void * buf, PINDEX len);
71 BOOL SetFormat(unsigned numChannels,
72 unsigned sampleRate,
73 unsigned bitsPerSample);
74 unsigned GetChannels() const;
75 unsigned GetSampleRate() const;
76 unsigned GetSampleSize() const;
77 BOOL SetBuffers(PINDEX size, PINDEX count);
78 BOOL GetBuffers(PINDEX & size, PINDEX & count);
79 BOOL PlaySound(const PSound & sound, BOOL wait);
80 BOOL PlayFile(const PFilePath & filename, BOOL wait);
81 BOOL HasPlayCompleted();
82 BOOL WaitForPlayCompletion();
83 BOOL RecordSound(PSound & sound);
84 BOOL RecordFile(const PFilePath & filename);
85 BOOL StartRecording();
86 BOOL IsRecordBufferFull();
87 BOOL AreAllRecordBuffersFull();
88 BOOL WaitForRecordBufferFull();
89 BOOL WaitForAllRecordBuffersFull();
90 BOOL Abort();
91 BOOL SetVolume(unsigned newVal);
92 BOOL GetVolume(unsigned &devVol);
94 protected:
95 unsigned mNumChannels;
96 unsigned mSampleRate;
97 unsigned mBitsPerSample;
98 unsigned actualSampleRate;
99 Directions direction;
100 PString device;
101 BOOL isInitialised;
102 unsigned resampleRate;