Comment remaining unsolved bug.
[ardour.git] / libs / backends / wavesaudio / waves_midi_device.h
1 /*
2     Copyright (C) 2013 Waves Audio Ltd.
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __libardour_waves_midi_device_h__
21 #define __libardour_waves_midi_device_h__
22
23 #include <portmidi/portmidi.h>
24 #include <portmidi/pmutil.h>
25 #include <portmidi/porttime.h>
26
27 #include "ardour/types.h"
28
29 namespace ARDOUR {
30
31 class WavesMidiEvent;
32
33 class WavesMidiDevice {
34 public:
35     WavesMidiDevice (const std::string& name);
36     ~WavesMidiDevice ();
37
38     inline const std::string& name () const { return _name; }
39
40     int open (PmTimeProcPtr time_proc, void* time_info);
41     void close ();
42     void do_io ();
43     void read_midi ();
44     void write_midi ();
45
46     int enqueue_output_waves_midi_event (const WavesMidiEvent* waves_midi_event);
47     WavesMidiEvent* dequeue_input_waves_midi_event ();
48
49     inline bool is_input () const { return _pm_input_id != pmNoDevice; };
50     inline bool is_output () const { return _pm_output_id != pmNoDevice; };
51
52 private:
53
54
55     PmDeviceID _pm_input_id;
56     PmDeviceID _pm_output_id;
57     const std::string _name;
58
59     /* shared queues */
60     PmQueue* _input_queue;
61     PmQueue* _output_queue;
62
63     PmStream* _input_pm_stream;
64     PmStream* _output_pm_stream;
65     WavesMidiEvent *_incomplete_waves_midi_event;
66 };
67
68 } // namespace
69
70 #endif /* __libardour_waves_midi_device_h__ */
71