add MIDI bundles to Generic MIDI support so that the ports show up nicely in the grid

This commit is contained in:
Paul Davis 2016-07-08 17:09:44 -04:00
parent 591e59dae4
commit 581fe8a237
2 changed files with 35 additions and 0 deletions

View File

@ -67,6 +67,23 @@ GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
_input_port = boost::dynamic_pointer_cast<AsyncMIDIPort> (s.midi_input_port ());
_output_port = boost::dynamic_pointer_cast<AsyncMIDIPort> (s.midi_output_port ());
_input_bundle.reset (new ARDOUR::Bundle (_("Generic MIDI Control In"), true));
_output_bundle.reset (new ARDOUR::Bundle (_("Generic MIDI Control Out"), false));
_input_bundle->add_channel (
boost::static_pointer_cast<MidiPort>(_input_port)->name(),
ARDOUR::DataType::MIDI,
session->engine().make_port_name_non_relative (boost::static_pointer_cast<MidiPort>(_input_port)->name())
);
_output_bundle->add_channel (
boost::static_pointer_cast<MidiPort>(_output_port)->name(),
ARDOUR::DataType::MIDI,
session->engine().make_port_name_non_relative (boost::static_pointer_cast<MidiPort>(_output_port)->name())
);
session->BundleAddedOrRemoved ();
do_feedback = false;
_feedback_interval = 10000; // microseconds
last_feedback_time = 0;
@ -110,6 +127,20 @@ GenericMidiControlProtocol::~GenericMidiControlProtocol ()
tear_down_gui ();
}
list<boost::shared_ptr<ARDOUR::Bundle> >
GenericMidiControlProtocol::bundles ()
{
list<boost::shared_ptr<ARDOUR::Bundle> > b;
if (_input_bundle) {
b.push_back (_input_bundle);
b.push_back (_output_bundle);
}
return b;
}
static const char * const midimap_env_variable_name = "ARDOUR_MIDIMAPS_PATH";
static const char* const midi_map_dir_name = "midi_maps";
static const char* const midi_map_suffix = ".map";

View File

@ -55,6 +55,8 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
int set_active (bool yn);
static bool probe() { return true; }
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
boost::shared_ptr<ARDOUR::Port> input_port () const;
boost::shared_ptr<ARDOUR::Port> output_port () const;
@ -106,6 +108,8 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
PBD::Signal0<void> ConnectionChange;
private:
boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
boost::shared_ptr<ARDOUR::AsyncMIDIPort> _input_port;
boost::shared_ptr<ARDOUR::AsyncMIDIPort> _output_port;