Ardour  8.12
midiport_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1998-2018 Paul Davis <paul@linuxaudiosystems.com>
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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __midiport_manager_h__
20 #define __midiport_manager_h__
21 
22 #include <list>
23 
24 #include <string>
25 
26 #include "pbd/rcu.h"
27 
28 #include "midi++/port.h"
29 #include "midi++/types.h"
30 
32 #include "ardour/midi_port.h"
33 #include "ardour/types.h"
34 
35 namespace ARDOUR {
36 
37 class AsyncMIDIPort;
38 class MidiPort;
39 class Port;
40 
42 {
43 public:
45  virtual ~MidiPortManager ();
46 
47  /* Ports used for control. These are read/written to outside of the
48  * process callback (asynchronously with respect to when data
49  * actually arrives).
50  *
51  * More detail: we do actually read/write data for these ports
52  * inside the process callback, but incoming data is only parsed
53  * and outgoing data is only generated *outside* the process
54  * callback.
55  */
56 
57  std::shared_ptr<ARDOUR::Port> mmc_input_port () const
58  {
59  return std::dynamic_pointer_cast<MidiPort> (_mmc_in);
60  }
61  std::shared_ptr<ARDOUR::Port> mmc_output_port () const
62  {
63  return std::dynamic_pointer_cast<MidiPort> (_mmc_out);
64  }
65 
66  std::shared_ptr<ARDOUR::Port> scene_input_port () const
67  {
68  return std::dynamic_pointer_cast<MidiPort> (_scene_in);
69  }
70  std::shared_ptr<ARDOUR::Port> scene_output_port () const
71  {
72  return std::dynamic_pointer_cast<MidiPort> (_scene_out);
73  }
74 
75  /* Ports used to send synchronization. These have their output handled inside the
76  * process callback.
77  */
78 
79  std::shared_ptr<MidiPort> mtc_output_port () const
80  {
81  return _mtc_output_port;
82  }
83  std::shared_ptr<MidiPort> midi_clock_output_port () const
84  {
85  return _midi_clock_output_port;
86  }
87 
88  /* Port for arbitrary incoming MIDI that will control triggers */
89  std::shared_ptr<MidiPort> trigger_input_port () const
90  {
91  return _trigger_input_port;
92  }
93 
94  /* Virtual MIDI keyboard output */
95  std::shared_ptr<AsyncMIDIPort> vkbd_output_port () const;
96 
98  std::list<XMLNode*> get_midi_port_states () const;
99 
100  void set_public_latency (bool playback);
101 
102 protected:
103  /* asynchronously handled ports: ARDOUR::AsyncMIDIPort */
104  std::shared_ptr<Port> _mmc_in;
105  std::shared_ptr<Port> _mmc_out;
106  std::shared_ptr<Port> _scene_in;
107  std::shared_ptr<Port> _scene_out;
108  std::shared_ptr<Port> _vkbd_out;
109 
110  /* synchronously handled ports: ARDOUR::MidiPort */
111  std::shared_ptr<MidiPort> _mtc_output_port;
112  std::shared_ptr<MidiPort> _midi_clock_output_port;
113  std::shared_ptr<MidiPort> _trigger_input_port;
114 
115  void create_ports ();
116 };
117 
118 } // namespace ARDOUR
119 
120 #endif
std::shared_ptr< ARDOUR::Port > mmc_input_port() const
std::shared_ptr< MidiPort > _mtc_output_port
std::shared_ptr< ARDOUR::Port > scene_input_port() const
std::shared_ptr< ARDOUR::Port > scene_output_port() const
std::shared_ptr< MidiPort > midi_clock_output_port() const
std::shared_ptr< Port > _scene_in
std::shared_ptr< Port > _scene_out
void set_midi_port_states(const XMLNodeList &)
std::shared_ptr< MidiPort > _midi_clock_output_port
std::shared_ptr< Port > _vkbd_out
std::shared_ptr< MidiPort > _trigger_input_port
std::shared_ptr< Port > _mmc_in
std::list< XMLNode * > get_midi_port_states() const
std::shared_ptr< AsyncMIDIPort > vkbd_output_port() const
std::shared_ptr< MidiPort > mtc_output_port() const
void set_public_latency(bool playback)
std::shared_ptr< Port > _mmc_out
std::shared_ptr< MidiPort > trigger_input_port() const
std::shared_ptr< ARDOUR::Port > mmc_output_port() const
#define LIBARDOUR_API
std::vector< XMLNode * > XMLNodeList
Definition: xml++.h:66