PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pwavfiledev.h
Go to the documentation of this file.
1 /*
2  * pwavfiledev.cxx
3  *
4  * Sound file device declaration
5  *
6  * Portable Windows Library
7  *
8  * Copyright (C) 2007 Post Increment
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is
23  * Robert Jongbloed <robertj@postincrement.com>
24  *
25  * All Rights Reserved.
26  *
27  * Contributor(s): ______________________________________.
28  */
29 
30 #ifndef PTLIB_PWAVFILEDEV_H
31 #define PTLIB_PWAVFILEDEV_H
32 
33 #ifdef P_USE_PRAGMA
34 #pragma interface
35 #endif
36 
37 #include <ptlib.h>
38 
39 #include <ptlib/sound.h>
40 #include <ptclib/pwavfile.h>
41 
42 #if defined(P_WAVFILE)
43 
44 
46 //
47 // This class defines a sound channel device that reads audio from a raw WAV file
48 //
49 
50 class PSoundChannel_WAVFile : public PSoundChannelEmulation
51 {
52  PCLASSINFO(PSoundChannel_WAVFile, PSoundChannelEmulation);
53  public:
54  PSoundChannel_WAVFile();
55  ~PSoundChannel_WAVFile();
56 
57  static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
58 
59  virtual bool Open(const Params & params);
60  virtual PString GetName() const;
61  virtual PBoolean Close();
62  virtual PBoolean IsOpen() const;
63 
64  protected:
65  virtual bool RawWrite(const void * data, PINDEX size);
66  virtual bool RawRead(void * data, PINDEX size);
67  virtual bool Rewind();
68 
69  PWAVFile m_WAVFile;
70 };
71 
72 
73 #endif // defined(P_WAVFILE)
74 
75 #endif // PTLIB_PWAVFILEDEV_H
76 
77 
78 // End Of File ///////////////////////////////////////////////////////////////
virtual bool RawWrite(const void *data, PINDEX size)
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
virtual PString GetName() const
Get the name of the channel.
virtual bool Open(const Params &params)
Open the specified device for playing or recording.
virtual bool RawRead(void *data, PINDEX size)
virtual PBoolean IsOpen() const
Determine if the channel is currently open and read and write operations can be executed on it...
Definition: sound.h:762
This is an array collection class of PString objects.
Definition: pstring.h:2365
virtual PBoolean Close()
Close the channel.
bool PBoolean
Definition: object.h:174
The character string class.
Definition: pstring.h:108
static PStringArray GetDeviceNames(const PString &driverName, Directions direction, PPluginManager *pluginMgr=NULL)
Definition: sound.h:354
virtual bool Rewind()