CSL  6.0
NullIO.h
Go to the documentation of this file.
1 //
2 // NullIO.h -- Raw driver IO object and StandardIO
3 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
4 //
5 
6 #ifndef CSL_NULLIO_H
7 #define CSL_NULLIO_H
8 
9 #include "CSL_Core.h"
10 
11 #include "ThreadUtilities.h" // Thread util classes (used only by NullIO)
12 
13 //#include "ThreadedFrameStream.h"
14 
15 namespace csl {
16 
17 ///
18 /// NullIO is an IO that uses a thread and a timer to call its graph's nextBuffer(); it doesn't do
19 /// anything with the resulting buffer, but assumes that other objects (observers of the graph)
20 /// will handle some actual IO.
21 ///
22 
23 class NullIO : public IO, public ThreadPthread {
24 public:
25  NullIO(); ///< Constructor
26  NullIO(unsigned s_rate, unsigned b_size,
27  int in_device = 0, int out_device = 0,
28  unsigned in_chans = 0, unsigned out_chans = 2);
29  virtual ~NullIO();
30 
31  virtual void start() throw(CException); ///< start my timer thread
32  virtual void stop() throw(CException); ///< stop the timer thread
33  virtual Buffer & getInput() throw(CException) { return mInputBuffer; };
34  virtual Buffer & getInput(unsigned numFrames, unsigned numChannels) throw(CException) { return mInputBuffer; };
35 
36 protected:
37  bool mRunning; /// whether or not I'm running
38  juce::Thread * mThread; ///< my timer thread
39  Synch * mSynch; ///< the sync I wait on
40  static void * FeederFunction(void * arg); ///< shared init function
41 // Buffer mEmptyBuffer;
42 };
43 
44 
45 ///
46 /// StdIO reads/write the UNIX Standard IO pipes
47 ///
48 
49 class StdIO : public NullIO {
50 public:
51  StdIO(); ///< Constructor
52  StdIO(unsigned s_rate, unsigned b_size,
53  int in_device = 0, int out_device = 0,
54  unsigned in_chans = 0, unsigned out_chans = 2);
55  virtual ~StdIO();
56 
57  void start() throw(CException); ///< start my timer thread
58  void stop() throw(CException); ///< stop the timer thread
59 protected:
60  static void * FeederFunction(void * arg); ///< shared init function
61 
62 };
63 
64 } // end of namespace
65 
66 #endif CSL_NULLIO_H
67 
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Definition: Accessor.h:17
Sync is a cross-thread synchronization object.
StdIO()
Constructor.
Definition: NullIO.cpp:52
Synch * mSynch
the sync I wait on
Definition: NullIO.h:39
virtual void start()
start my timer thread
Definition: NullIO.cpp:40
NullIO()
Constructor.
Definition: NullIO.cpp:12
IO – the abstract I/O scheduling class; subclasses interface to specific I/O APIs.
Definition: CSL_Core.h:752
PThread version of Thread.
NullIO is an IO that uses a thread and a timer to call its graph's nextBuffer(); it doesn't do anythi...
Definition: NullIO.h:23
virtual Buffer & getInput()
Get the current input from the sound card.
Definition: NullIO.h:33
juce::Thread * mThread
whether or not I'm running
Definition: NullIO.h:38
bool mRunning
Definition: NullIO.h:34
static void * FeederFunction(void *arg)
shared init function
Definition: NullIO.cpp:27
virtual void stop()
stop the timer thread
Definition: NullIO.cpp:45
static void * FeederFunction(void *arg)
shared init function
Definition: NullIO.cpp:59
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Definition: CSL_Core.h:106
Buffer mInputBuffer
the most recent input buffer (if it's turned on)
Definition: CSL_Core.h:778
void stop()
stop the timer thread
Definition: NullIO.cpp:74
void start()
start my timer thread
Definition: NullIO.cpp:71
virtual ~NullIO()
Definition: NullIO.cpp:23
virtual ~StdIO()
Definition: NullIO.cpp:57
Base class of CSL exceptions (written upper-case). Has a string message.
StdIO reads/write the UNIX Standard IO pipes.
Definition: NullIO.h:49