Merge branch 'master' into develop
[jack2.git] / common / JackMidiDriver.h
blob76f187dbad1ede2966c0d83c0c1810fef716f99a
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.
34 A concrete derived class will have to be defined with a real MIDI driver API,
35 either callback based one (like CoreMIDI..) ones or blocking ones (like ALSA MIDI).
39 class SERVER_EXPORT JackMidiDriver : public JackDriver
42 protected:
44 JackMidiBuffer* GetInputBuffer(int port_index);
45 JackMidiBuffer* GetOutputBuffer(int port_index);
47 virtual int ProcessReadSync();
48 virtual int ProcessWriteSync();
50 virtual int ProcessReadAsync();
51 virtual int ProcessWriteAsync();
53 virtual void UpdateLatencies();
55 public:
57 JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
58 virtual ~JackMidiDriver();
60 virtual int Open(bool capturing,
61 bool playing,
62 int inchannels,
63 int outchannels,
64 bool monitor,
65 const char* capture_driver_name,
66 const char* playback_driver_name,
67 jack_nframes_t capture_latency,
68 jack_nframes_t playback_latency);
70 virtual int SetBufferSize(jack_nframes_t buffer_size);
72 virtual int Attach();
73 virtual int Detach();
77 } // end of namespace
79 #endif