ardour
midi_port.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002 Paul Davis
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  $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
19 */
20 
21 #ifndef __ardour_midi_port_h__
22 #define __ardour_midi_port_h__
23 
24 #include "midi++/parser.h"
25 
26 #include "ardour/port.h"
27 
28 namespace ARDOUR {
29 
30 class MidiBuffer;
31 class MidiEngine;
32 
33 class LIBARDOUR_API MidiPort : public Port {
34  public:
35  ~MidiPort();
36 
37  DataType type () const {
38  return DataType::MIDI;
39  }
40 
41  void cycle_start (pframes_t nframes);
42  void cycle_end (pframes_t nframes);
43  void cycle_split ();
44 
45  void flush_buffers (pframes_t nframes);
46  void transport_stopped ();
47  void realtime_locate ();
48  void reset ();
49  void require_resolve ();
50 
51  bool input_active() const { return _input_active; }
52  void set_input_active (bool yn);
53 
54  Buffer& get_buffer (pframes_t nframes);
55 
56  MidiBuffer& get_midi_buffer (pframes_t nframes);
57 
58  void set_always_parse (bool yn);
59  void set_trace_on (bool yn);
60 
61  MIDI::Parser& self_parser() { return _self_parser; }
62 
63  protected:
64  friend class PortManager;
65 
66  MidiPort (const std::string& name, PortFlags);
67 
68  private:
74  bool _trace_on;
75 
76  /* Naming this is tricky. AsyncMIDIPort inherits (for now, aug 2013) from
77  * both MIDI::Port, which has _parser, and this (ARDOUR::MidiPort). We
78  * need parsing support in this object, independently of what the
79  * MIDI::Port/AsyncMIDIPort stuff does. Rather than risk errors coming
80  * from not explicitly naming which _parser we want, we will call this
81  * _self_parser for now.
82  *
83  * Ultimately, MIDI::Port should probably go away or be fully integrated
84  * into this object, somehow.
85  */
86 
87  MIDI::Parser _self_parser;
88 
89  void resolve_notes (void* buffer, framepos_t when);
90 };
91 
92 } // namespace ARDOUR
93 
94 #endif /* __ardour_midi_port_h__ */
bool _always_parse
Definition: midi_port.h:73
MIDI::Parser _self_parser
Definition: midi_port.h:87
bool _has_been_mixed_down
Definition: midi_port.h:70
MIDI::Parser & self_parser()
Definition: midi_port.h:61
uint32_t pframes_t
Definition: types.h:61
MidiBuffer * _buffer
Definition: midi_port.h:69
bool _resolve_required
Definition: midi_port.h:71
Definition: amp.h:29
PortFlags
Definition: types.h:610
int64_t framepos_t
Definition: types.h:66
#define LIBARDOUR_API
DataType type() const
Definition: midi_port.h:37
const char * name
bool _input_active
Definition: midi_port.h:72
bool input_active() const
Definition: midi_port.h:51