Correct memory locking code on Windows
[jack2.git] / common / JackAudioDriver.h
blob13de9096f786755f9dfceb1dbcc606bf194eaef9
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2006 Grame
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.
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.
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.
21 #ifndef __JackAudioDriver__
22 #define __JackAudioDriver__
24 #include "JackDriver.h"
27 namespace Jack
30 /*!
31 \brief The base class for audio drivers: drivers with audio ports.
34 class EXPORT JackAudioDriver : public JackDriver
37 protected:
39 int fCaptureChannels;
40 int fPlaybackChannels;
42 // static tables since the actual number of ports may be changed by the real driver
43 // thus dynamic allocation is more difficult to handle
44 jack_port_id_t fCapturePortList[PORT_NUM];
45 jack_port_id_t fPlaybackPortList[PORT_NUM];
46 jack_port_id_t fMonitorPortList[PORT_NUM];
48 bool fWithMonitorPorts;
50 jack_default_audio_sample_t* GetInputBuffer(int port_index);
51 jack_default_audio_sample_t* GetOutputBuffer(int port_index);
52 jack_default_audio_sample_t* GetMonitorBuffer(int port_index);
54 private:
56 int ProcessAsync();
57 int ProcessSync();
59 public:
61 JackAudioDriver(const char* name, JackEngine* engine, JackSynchro** table);
62 virtual ~JackAudioDriver();
64 virtual int Process();
66 virtual int Open(jack_nframes_t nframes,
67 jack_nframes_t samplerate,
68 int capturing,
69 int playing,
70 int inchannels,
71 int outchannels,
72 bool monitor,
73 const char* capture_driver_name,
74 const char* playback_driver_name,
75 jack_nframes_t capture_latency,
76 jack_nframes_t playback_latency);
78 virtual int Attach();
79 virtual int Detach();
80 virtual int Write();
82 virtual void NotifyXRun(jack_time_t callback_usecs); // XRun notification sent by the driver
86 } // end of namespace
88 #endif