Jack2  1.9.9
JackAudioDriver.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 __JackAudioDriver__
22 #define __JackAudioDriver__
23 
24 #include "JackDriver.h"
25 
26 namespace Jack
27 {
28 
33 class SERVER_EXPORT JackAudioDriver : public JackDriver
34 {
35 
36  protected:
37 
38  jack_default_audio_sample_t* GetInputBuffer(int port_index);
39  jack_default_audio_sample_t* GetOutputBuffer(int port_index);
40  jack_default_audio_sample_t* GetMonitorBuffer(int port_index);
41 
42  void HandleLatencyCallback(int status);
43  virtual void UpdateLatencies();
44 
45  int ProcessAsync();
46  void ProcessGraphAsync();
47  void ProcessGraphAsyncMaster();
48  void ProcessGraphAsyncSlave();
49 
50  int ProcessSync();
51  void ProcessGraphSync();
52  void ProcessGraphSyncMaster();
53  void ProcessGraphSyncSlave();
54 
55  public:
56 
57  JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
58  virtual ~JackAudioDriver();
59 
60  virtual int Open(jack_nframes_t buffer_size,
61  jack_nframes_t samplerate,
62  bool capturing,
63  bool playing,
64  int inchannels,
65  int outchannels,
66  bool monitor,
67  const char* capture_driver_name,
68  const char* playback_driver_name,
69  jack_nframes_t capture_latency,
70  jack_nframes_t playback_latency);
71 
72  virtual int Open(bool capturing,
73  bool playing,
74  int inchannels,
75  int outchannels,
76  bool monitor,
77  const char* capture_driver_name,
78  const char* playback_driver_name,
79  jack_nframes_t capture_latency,
80  jack_nframes_t playback_latency);
81 
82  virtual int Process();
83 
84  virtual int Attach();
85  virtual int Detach();
86 
87  virtual int Write();
88 
89  virtual int SetBufferSize(jack_nframes_t buffer_size);
90  virtual int SetSampleRate(jack_nframes_t sample_rate);
91 
92  virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
93 
94 };
95 
96 } // end of namespace
97 
98 #endif
Inter process synchronization using using Mach semaphore.
Locked Engine, access to methods is serialized using a mutex.
The base class for audio drivers: drivers with audio ports.