CSL  6.0
iphoneIO.h
Go to the documentation of this file.
1 //
2 // iphoneIO.h -- DAC IO using CoreAudio for the iphone
3 // Abstract AUIO class and concrete iPhoneIO class
4 //
5 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
6 //
7 
8 #ifndef CSL_CAIO_H
9 #define CSL_CAIO_H
10 
11 #include "CSL_Core.h"
12 
13 #import <AudioToolbox/AudioToolbox.h>
14 
15 using namespace std;
16 
17 namespace csl {
18 
19 ///
20 /// General-purpose AudioUnit IO class
21 ///
22 
23 class AUIO : public IO {
24 public:
25  AUIO();
26  AUIO(unsigned s_rate, unsigned b_size, int in_device, int out_device,
27  unsigned in_chans, unsigned out_chans);
28  ~AUIO();
29 
30  virtual void open() throw(CException); ///< open/close start/stop methods
31  virtual void close() throw(CException);
32  virtual void start() throw(CException);
33  virtual void stop() throw(CException);
34 
35  void setAudioUnit(AudioUnit au) { mAudioUnit = au; };
36  virtual Buffer & getInput() throw(CException); ///< get the current input buffer
37  /// get the current input buffer
38  virtual Buffer & getInput(unsigned numFrames, unsigned numChannels) throw(CException);
39 
40 protected:
41  AudioComponentInstance mAudioUnit; ///< The AudioUnit we play out
42  void handleError(OSStatus result) throw(CException);
43 };
44 
45 ///
46 /// CoreAudio IO class for the iPhone
47 ///
48 
49 class iPhoneIO : public AUIO {
50 public:
51  iPhoneIO(); /// Most verbose constructor -- specify everything
52  iPhoneIO(unsigned s_rate, unsigned b_size, int in_device, int out_device,
53  unsigned in_chans, unsigned out_chans);
54  ~iPhoneIO();
55 
56  void open() throw(CException); ///< open/close start/stop methods
57  void close() throw(CException);
58  void start() throw(CException);
59  void stop() throw(CException);
60 
61 protected:
62  void handleError(OSStatus result) throw(CException);
63 
64 };
65 
66 }
67 
68 #endif
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Definition: Accessor.h:17
CoreAudio IO class for the iPhone.
Definition: iphoneIO.h:49
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Definition: CSL_Core.h:106
General-purpose AudioUnit IO class.
Definition: CAIO.h:21
Base class of CSL exceptions (written upper-case). Has a string message.