CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

PAIO.h
Go to the documentation of this file.
1 //
2 // PAIO.h -- DAC IO using PortAudio
3 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
4 //
5
6 #ifndef CSL_PAIO_H
7 #define CSL_PAIO_H
8
9 #include "CSL_Core.h"
10
11 #include "portaudio.h" // the portaudio header file in /usr/local/include
12
13 using namespace std;
14
15 namespace csl {
16
17 ///
18 /// The PortAudio IO class
19 ///
20
21 class PAIO : public IO {
22
23 public:
24 PAIO(unsigned s_rate = CSL_mFrameRate, unsigned b_size = CSL_mBlockSize,
25 int in_device = -1, int out_device = -1,
26 unsigned in_chans = 0, unsigned out_chans = 2);
27 ~PAIO(); ///< Destructor
28
29 void open() throw(CException); ///< open the IO
30 void start() throw(CException); ///< start the callbacks
31 void stop() throw(CException); ///< stop the callbacks
32 void close() throw(CException); ///< close the IO
33 void test() throw(CException); ///< test the IO's graph
34
35 PaStream * mStream; ///< the PortAudio stream we play out/get data from
36
37 protected:
38 PaStreamParameters * mInputParameters; ///< PA IO stream parameters
39 PaStreamParameters * mOutputParameters;
40
41 PaDeviceIndex mInDev, mOutDev; ///< IO device numbers
42 IODeviceVector mDevices;
43 /// print the error message
44 void handleError(PaError result) throw(CException);
45 /// Actually initialize PortAudio driver
46 void initialize(unsigned sr, unsigned bs, int is, int os, unsigned ic, unsigned oc);
47 };
48
49 }
50
51 #endif