OPAL  Version 3.12.9
pcss.h
Go to the documentation of this file.
1 /*
2  * pcss.h
3  *
4  * PC Sound System support.
5  *
6  * Open Phone Abstraction Library (OPAL)
7  * Formally known as the Open H323 project.
8  *
9  * Copyright (c) 2001 Equivalence Pty. Ltd.
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Open Phone Abstraction Library.
22  *
23  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24  *
25  * Contributor(s): ______________________________________.
26  *
27  * $Revision: 31065 $
28  * $Author: rjongbloed $
29  * $Date: 2013-12-11 17:08:05 +1100 (Wed, 11 Dec 2013) $
30  */
31 
32 #ifndef OPAL_OPAL_PCSS_H
33 #define OPAL_OPAL_PCSS_H
34 
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38 
39 
40 #include <opal/buildopts.h>
41 
42 #if OPAL_HAS_PCSS
43 
44 #include <ptlib/sound.h>
45 #include <ep/localep.h>
46 
47 
48 class OpalPCSSConnection;
49 
50 #define OPAL_PCSS_PREFIX "pc"
51 
52 
56 {
58  public:
65  const char * prefix = OPAL_PCSS_PREFIX
66  );
67 
72 
104  virtual PSafePtr<OpalConnection> MakeConnection(
105  OpalCall & call,
106  const PString & party,
107  void * userData = NULL,
108  unsigned options = 0,
109  OpalConnection::StringOptions * stringOptions = NULL
110  );
112 
120  virtual bool OnOutgoingCall(
121  const OpalLocalConnection & connection
122  );
123 
133  virtual bool OnIncomingCall(
134  OpalLocalConnection & connection
135  );
136 
142  virtual bool OnUserInput(
143  const OpalLocalConnection & connection,
144  const PString & indication
145  );
147 
154  OpalCall & call,
155  const PString & playDevice,
156  const PString & recordDevice,
157  void * userData,
158  unsigned options,
159  OpalConnection::StringOptions * stringOptions
160  );
161 
164  virtual PSoundChannel * CreateSoundChannel(
165  const OpalPCSSConnection & connection,
166  const OpalMediaFormat & mediaFormat,
167  PBoolean isSource
168  );
170 
179  PSafePtr<OpalPCSSConnection> GetPCSSConnectionWithLock(
180  const PString & token,
181  PSafetyMode mode = PSafeReadWrite
182  ) { return GetConnectionWithLockAs<OpalPCSSConnection>(token, mode); }
183 
192  virtual PBoolean OnShowIncoming(
193  const OpalPCSSConnection & connection
194  ) = 0;
195 
200  virtual PBoolean AcceptIncomingConnection(
201  const PString & connectionToken
202  );
203 
208  virtual PBoolean RejectIncomingConnection(
209  const PString & connectionToken,
210  const OpalConnection::CallEndReason & reason = OpalConnection::EndedByAnswerDenied
211  );
212 
218  virtual PBoolean OnShowOutgoing(
219  const OpalPCSSConnection & connection
220  ) = 0;
221 
227  virtual PBoolean OnShowUserInput(
228  const OpalPCSSConnection & connection,
229  const PString & indication
230  );
232 
242  virtual PBoolean SetSoundChannelPlayDevice(const PString & name);
243 
248  const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
249 
257  virtual PBoolean SetSoundChannelRecordDevice(const PString & name);
258 
263  const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
264 
269  unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
270 
276  unsigned depth
277  );
278 
284 
290  unsigned depth
291  );
293 
294  protected:
299 
300  private:
301  P_REMOVE_VIRTUAL(OpalPCSSConnection *, CreateConnection(OpalCall &, const PString &, const PString &, void *), 0)
302 };
303 
304 
308 {
310  public:
316  OpalCall & call,
318  const PString & playDevice,
319  const PString & recordDevice,
320  unsigned options = 0,
321  OpalConnection::StringOptions * stringOptions = NULL
322  );
323 
328 
337  virtual bool TransferConnection(
338  const PString & remoteParty
339  );
340 
356  const OpalMediaFormat & mediaFormat,
357  unsigned sessionID,
358  PBoolean isSource
359  );
360 
364  virtual PBoolean SetAudioVolume(
365  PBoolean source,
366  unsigned percentage
367  );
368 
372  virtual PBoolean GetAudioVolume(
373  PBoolean source,
374  unsigned & percentage
375  );
376 
379  virtual bool SetAudioMute(
380  bool source,
381  bool mute
382  );
383 
386  virtual bool GetAudioMute(
387  bool source,
388  bool & mute
389  );
390 
394  virtual unsigned GetAudioSignalLevel(
395  PBoolean source
396  );
398 
403  virtual PSoundChannel * CreateSoundChannel(
404  const OpalMediaFormat & mediaFormat,
405  PBoolean isSource
406  );
408 
415  const PString & GetSoundChannelPlayDevice() const { return soundChannelPlayDevice; }
416 
421  const PString & GetSoundChannelRecordDevice() const { return soundChannelRecordDevice; }
422 
427  unsigned GetSoundChannelBufferDepth() const { return soundChannelBuffers; }
428 
435 
436 
437  protected:
443 };
444 
445 #else
446 
447 #ifdef _MSC_VER
448 #pragma message("PTLib soundcard support not available")
449 #else
450 #warning "PTLib soundcard support not available"
451 #endif
452 
453 
454 #endif // OPAL_HAS_PCSS
455 
456 #endif // OPAL_OPAL_PCSS_H
457 
458 
459 // End of File ///////////////////////////////////////////////////////////////