summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-12-19 17:43:06 +0100
committerRobin Gareus <robin@gareus.org>2017-12-19 17:45:03 +0100
commit3cb952d7fb0c6f6857418fcb3d0b10ead6823c8f (patch)
treee0c87717837ffb0d5a99c05e6b16a1d40d6fded1
parent851add389d1fa2d701ad4e48e7f36ae123eef2d8 (diff)
Revert "Prototype to allow embedding sysex in midi-map"
This reverts commit 561c8eea0cfa45f0b54461b149b4c330e0bbaa3b. It is rare that a device needs sysex-initialization every time it is connected, besides a single simple "Sysex" entry without options is not very flexible.
-rw-r--r--libs/surfaces/generic_midi/generic_midi_control_protocol.cc44
-rw-r--r--libs/surfaces/generic_midi/generic_midi_control_protocol.h2
2 files changed, 1 insertions, 45 deletions
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
index d973ba77b6..4d394e5082 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
@@ -42,7 +42,6 @@
#include "ardour/session.h"
#include "ardour/midi_ui.h"
#include "ardour/rc_configuration.h"
-#include "ardour/raw_midi_parser.h"
#include "ardour/midiport_manager.h"
#include "ardour/debug.h"
@@ -242,8 +241,6 @@ GenericMidiControlProtocol::drop_all ()
delete *i;
}
actions.clear ();
-
- _sysex_init = "";
}
void
@@ -269,7 +266,6 @@ GenericMidiControlProtocol::drop_bindings ()
_current_binding = "";
_bank_size = 0;
_current_bank = 0;
- _sysex_init = "";
}
int
@@ -724,7 +720,7 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
DEBUG_TRACE (DEBUG::GenericMidi, "Load bindings: Reading midi map\n");
XMLTree state_tree;
- if (!state_tree.read (xmlpath)) {
+ if (!state_tree.read (xmlpath.c_str())) {
error << string_compose(_("Could not understand MIDI bindings file %1"), xmlpath) << endmsg;
return -1;
}
@@ -796,25 +792,12 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
}
}
}
-
- if ((*citer)->name() == "Sysex") {
- for (XMLNodeList::const_iterator n = (*citer)->children ().begin (); n != (*citer)->children ().end (); ++n) {
- if (!(*n)->is_content ()) { continue; }
- _sysex_init = (*n)->content ();
- break;
- }
- }
-
}
if ((prop = root->property ("name")) != 0) {
_current_binding = prop->value ();
}
- if ((connection_state & (InputConnected|OutputConnected)) == (InputConnected|OutputConnected)) {
-
- send_sysex_init ();
- }
reset_controllables ();
return 0;
@@ -1238,31 +1221,6 @@ void
GenericMidiControlProtocol::connected ()
{
cerr << "Now connected\n";
- send_sysex_init ();
-}
-
-void
-GenericMidiControlProtocol::send_sysex_init ()
-{
- if (_sysex_init.empty ()) {
- return;
- }
-
- boost::shared_ptr<AsyncMIDIPort> p = boost::dynamic_pointer_cast<AsyncMIDIPort> (_output_port);
- assert (p);
-
- gsize size = 0;
- guchar* buf = g_base64_decode (_sysex_init.c_str(), &size);
-
- RawMidiParser mp;
- for (size_t i = 0; i < size; ++i) {
- if (mp.process_byte (buf[i])) {
- p->write (mp.midi_buffer (), mp.buffer_size (), 0);
- /* delay for physical MIDI rate; 320usec / byte */
- g_usleep (400 * mp.buffer_size ());
- }
- }
- g_free (buf);
}
boost::shared_ptr<Port>
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
index 8a2670bfd7..6585c7ea24 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
@@ -162,7 +162,6 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
void reset_controllables ();
void drop_all ();
- void send_sysex_init ();
enum ConnectionState {
InputConnected = 0x1,
@@ -175,7 +174,6 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
void connected();
std::string _current_binding;
- std::string _sysex_init;
uint32_t _bank_size;
uint32_t _current_bank;
/** true if this surface is motorised. If it is, we assume