Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
20 
21 #include <list>
22 
23 #include <string>
24 
25 #include "pbd/rcu.h"
26 
27 #include "midi++/port.h"
28 #include "midi++/types.h"
29 
31 #include "ardour/midi_port.h"
32 #include "ardour/types.h"
33 
34 namespace ARDOUR {
35 
36 class AsyncMIDIPort;
37 class MidiPort;
38 class Port;
39 
41 {
42 public:
44  virtual ~MidiPortManager ();
45 
46  /* Ports used for control. These are read/written to outside of the
47  * process callback (asynchronously with respect to when data
48  * actually arrives).
49  *
50  * More detail: we do actually read/write data for these ports
51  * inside the process callback, but incoming data is only parsed
52  * and outgoing data is only generated *outside* the process
53  * callback.
54  */
55 
56  std::shared_ptr<ARDOUR::Port> mmc_input_port () const
57  {
58  return std::dynamic_pointer_cast<MidiPort> (_mmc_in);
59  }
60  std::shared_ptr<ARDOUR::Port> mmc_output_port () const
61  {
62  return std::dynamic_pointer_cast<MidiPort> (_mmc_out);
63  }
64 
65  std::shared_ptr<ARDOUR::Port> scene_input_port () const
66  {
67  return std::dynamic_pointer_cast<MidiPort> (_scene_in);
68  }
69  std::shared_ptr<ARDOUR::Port> scene_output_port () const
70  {
71  return std::dynamic_pointer_cast<MidiPort> (_scene_out);
72  }
73 
74  /* Ports used to send synchronization. These have their output handled inside the
75  * process callback.
76  */
77 
78  std::shared_ptr<MidiPort> mtc_output_port () const
79  {
80  return _mtc_output_port;
81  }
82  std::shared_ptr<MidiPort> midi_clock_output_port () const
83  {
84  return _midi_clock_output_port;
85  }
86 
87  /* Port for arbitrary incoming MIDI that will control triggers */
88  std::shared_ptr<MidiPort> trigger_input_port () const
89  {
90  return _trigger_input_port;
91  }
92 
93  /* Virtual MIDI keyboard output */
94  std::shared_ptr<AsyncMIDIPort> vkbd_output_port () const;
95 
97  std::list<XMLNode*> get_midi_port_states () const;
98 
99  void set_public_latency (bool playback);
100 
101 protected:
102  /* asynchronously handled ports: ARDOUR::AsyncMIDIPort */
103  std::shared_ptr<Port> _mmc_in;
104  std::shared_ptr<Port> _mmc_out;
105  std::shared_ptr<Port> _scene_in;
106  std::shared_ptr<Port> _scene_out;
107  std::shared_ptr<Port> _vkbd_out;
108 
109  /* synchronously handled ports: ARDOUR::MidiPort */
110  std::shared_ptr<MidiPort> _mtc_output_port;
111  std::shared_ptr<MidiPort> _midi_clock_output_port;
112  std::shared_ptr<MidiPort> _trigger_input_port;
113 
114  void create_ports ();
115 };
116 
117 } // namespace ARDOUR
118 
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