CSL  6.0
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
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
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Definition: Accessor.h:17
PaStream * mStream
the PortAudio stream we play out/get data from
Definition: PAIO.h:35
std::vector< IODevice * > IODeviceVector
IOs hold onto device vectors.
Definition: CSL_Types.h:249
IODeviceVector mDevices
Definition: PAIO.h:42
PaDeviceIndex mOutDev
IO device numbers.
Definition: PAIO.h:41
#define CSL_mFrameRate
default sample rate (tested up to 96000)
Definition: CSL_Types.h:91
PaStreamParameters * mOutputParameters
Definition: PAIO.h:39
IO – the abstract I/O scheduling class; subclasses interface to specific I/O APIs.
Definition: CSL_Core.h:752
The PortAudio IO class.
Definition: PAIO.h:21
PaStreamParameters * mInputParameters
PA IO stream parameters.
Definition: PAIO.h:38
#define CSL_mBlockSize
normal hosts
Definition: CSL_Types.h:99
Base class of CSL exceptions (written upper-case). Has a string message.