2 Copyright (C) 2002 Paul Davis
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.
18 $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
21 #ifndef __ardour_midi_port_h__
22 #define __ardour_midi_port_h__
24 #include "midi++/parser.h"
26 #include "ardour/port.h"
33 class LIBARDOUR_API MidiPort : public Port {
37 DataType type () const {
38 return DataType::MIDI;
41 void cycle_start (pframes_t nframes);
42 void cycle_end (pframes_t nframes);
45 void flush_buffers (pframes_t nframes);
46 void transport_stopped ();
47 void realtime_locate ();
49 void require_resolve ();
51 bool input_active() const { return _input_active; }
52 void set_input_active (bool yn);
54 Buffer& get_buffer (pframes_t nframes);
56 MidiBuffer& get_midi_buffer (pframes_t nframes);
58 void set_always_parse (bool yn);
59 void set_trace_on (bool yn);
61 typedef boost::function<bool(MidiBuffer&,MidiBuffer&)> MidiFilter;
62 void set_inbound_filter (MidiFilter);
63 int add_shadow_port (std::string const &, MidiFilter);
64 boost::shared_ptr<MidiPort> shadow_port() const { return _shadow_port; }
66 MIDI::Parser& self_parser() { return _self_parser; }
69 friend class PortManager;
71 MidiPort (const std::string& name, PortFlags);
75 bool _has_been_mixed_down;
76 bool _resolve_required;
80 MidiFilter inbound_midi_filter;
81 boost::shared_ptr<MidiPort> _shadow_port;
82 MidiFilter shadow_midi_filter;
84 /* Naming this is tricky. AsyncMIDIPort inherits (for now, aug 2013) from
85 * both MIDI::Port, which has _parser, and this (ARDOUR::MidiPort). We
86 * need parsing support in this object, independently of what the
87 * MIDI::Port/AsyncMIDIPort stuff does. Rather than risk errors coming
88 * from not explicitly naming which _parser we want, we will call this
89 * _self_parser for now.
91 * Ultimately, MIDI::Port should probably go away or be fully integrated
92 * into this object, somehow.
95 MIDI::Parser _self_parser;
97 void resolve_notes (void* buffer, framepos_t when);
100 } // namespace ARDOUR
102 #endif /* __ardour_midi_port_h__ */