Jack2: JackAudioDriver.h Source File

Jack2 1.9.12

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
42 class SERVER_EXPORT JackAudioDriver : public JackDriver
43 {
44
45 protected:
46
47 jack_default_audio_sample_t* GetInputBuffer(int port_index);
48 jack_default_audio_sample_t* GetOutputBuffer(int port_index);
49 jack_default_audio_sample_t* GetMonitorBuffer(int port_index);
50
51 void HandleLatencyCallback(int status);
52 virtual void UpdateLatencies();
53
54 int ProcessAsync();
55 void ProcessGraphAsync();
56 void ProcessGraphAsyncMaster();
57 void ProcessGraphAsyncSlave();
58
59 int ProcessSync();
60 void ProcessGraphSync();
61 void ProcessGraphSyncMaster();
62 void ProcessGraphSyncSlave();
63
64 public:
65
66 JackAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
67 virtual ~JackAudioDriver();
68
69 virtual int Open(jack_nframes_t buffer_size,
70 jack_nframes_t samplerate,
71 bool capturing,
72 bool playing,
73 int inchannels,
74 int outchannels,
75 bool monitor,
76 const char* capture_driver_name,
77 const char* playback_driver_name,
78 jack_nframes_t capture_latency,
79 jack_nframes_t playback_latency);
80
81 /*
82 To be called by the underlying driver audio callback, or possibly by a RT thread (using JackThreadedDriver decorator)
83 when a blocking read/write underlying API is used (like ALSA)
84 */
85 virtual int Process();
86
87 virtual int Attach();
88 virtual int Detach();
89
90 virtual int Write();
91
92 virtual int SetBufferSize(jack_nframes_t buffer_size);
93 virtual int SetSampleRate(jack_nframes_t sample_rate);
94
95 virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
96
97 };
98
99 } // end of namespace
100
101 #endif
Jack::JackLockedEngine
Locked Engine, access to methods is serialized using a mutex.
Definition: JackLockedEngine.h:78
Jack::JackPosixSemaphore
Inter process synchronization using POSIX semaphore.
Definition: JackPosixSemaphore.h:36
Jack::JackDriver
Definition: JackDriver.h:127
Jack::JackAudioDriver
The base class for audio drivers: drivers with audio ports.
Definition: JackAudioDriver.h:42