Jack2  1.9.9
JackThreadedDriver.h
1 /*
2  Copyright (C) 2001 Paul Davis
3  Copyright (C) 2004-2008 Grame
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19 */
20 
21 #ifndef __JackThreadedDriver__
22 #define __JackThreadedDriver__
23 
24 #include "JackDriver.h"
25 #include "JackPlatformPlug.h"
26 
27 namespace Jack
28 {
29 
35 {
36 
37  protected:
38 
39  JackThread fThread;
40  JackDriver* fDriver;
41 
42  void SetRealTime();
43 
44  public:
45 
47  virtual ~JackThreadedDriver();
48 
49  virtual int Open();
50 
51  virtual int Open (bool capturing,
52  bool playing,
53  int inchannels,
54  int outchannels,
55  bool monitor,
56  const char* capture_driver_name,
57  const char* playback_driver_name,
58  jack_nframes_t capture_latency,
59  jack_nframes_t playback_latency)
60  {
61  return -1;
62  }
63  virtual int Open(jack_nframes_t buffer_size,
64  jack_nframes_t samplerate,
65  bool capturing,
66  bool playing,
67  int inchannels,
68  int outchannels,
69  bool monitor,
70  const char* capture_driver_name,
71  const char* playback_driver_name,
72  jack_nframes_t capture_latency,
73  jack_nframes_t playback_latency);
74  virtual int Close();
75 
76  virtual int Process();
77 
78  virtual int Attach();
79  virtual int Detach();
80 
81  virtual int Read();
82  virtual int Write();
83 
84  virtual int Start();
85  virtual int Stop();
86 
87  virtual bool IsFixedBufferSize();
88  virtual int SetBufferSize(jack_nframes_t buffer_size);
89  virtual int SetSampleRate(jack_nframes_t sample_rate);
90 
91  virtual void SetMaster(bool onoff);
92  virtual bool GetMaster();
93 
94  virtual void AddSlave(JackDriverInterface* slave);
95  virtual void RemoveSlave(JackDriverInterface* slave);
96 
97  virtual std::list<JackDriverInterface*> GetSlaves();
98 
99  virtual int ProcessReadSlaves();
100  virtual int ProcessWriteSlaves();
101 
102  virtual int ProcessRead();
103  virtual int ProcessWrite();
104 
105  virtual int ProcessReadSync();
106  virtual int ProcessWriteSync();
107 
108  virtual int ProcessReadAsync();
109  virtual int ProcessWriteAsync();
110 
111  virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
112  virtual JackClientControl* GetClientControl() const;
113  virtual bool IsRealTime() const;
114  virtual bool IsRunning() const;
115 
116  // JackRunnableInterface interface
117  virtual bool Execute();
118  virtual bool Init();
119 
120 };
121 
122 } // end of namespace
123 
124 
125 #endif
The base interface for drivers.
Definition: JackDriver.h:43
The base class for threaded drivers using a &quot;decorator&quot; pattern. Threaded drivers are used with block...
The base class for runnable objects, that have an Init and Execute method to be called in a threa...
Definition: JackThread.h:34
The base interface for drivers clients.
Definition: JackDriver.h:122
Darwin threads. Real-time threads are actually &quot;time constraint&quot; threads.
Client control possibly in shared memory.