Init engine fields, cleanup.
[jack2.git] / common / JackMidiDriver.h
blob7c5bc5e0ec17e58e0bda9c1dab2d31d06bfd0607
1 /*
2 Copyright (C) 2009 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackMidiDriver__
21 #define __JackMidiDriver__
23 #include "JackDriver.h"
24 #include "JackMidiPort.h"
25 #include "JackLockedEngine.h"
26 #include "ringbuffer.h"
28 namespace Jack
31 /*!
32 \brief The base class for MIDI drivers: drivers with MIDI ports.
35 class SERVER_EXPORT JackMidiDriver : public JackDriver
38 protected:
40 int fCaptureChannels;
41 int fPlaybackChannels;
43 jack_ringbuffer_t* fRingBuffer[DRIVER_PORT_NUM];
45 jack_port_id_t fCapturePortList[DRIVER_PORT_NUM];
46 jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM];
48 JackMidiBuffer* GetInputBuffer(int port_index);
49 JackMidiBuffer* GetOutputBuffer(int port_index);
51 public:
53 JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
54 virtual ~JackMidiDriver();
56 virtual int Open(bool capturing,
57 bool playing,
58 int inchannels,
59 int outchannels,
60 bool monitor,
61 const char* capture_driver_name,
62 const char* playback_driver_name,
63 jack_nframes_t capture_latency,
64 jack_nframes_t playback_latency);
66 virtual int Process();
67 virtual int ProcessNull();
69 virtual int Attach();
70 virtual int Detach();
72 virtual int Read();
73 virtual int Write();
77 } // end of namespace
79 #endif