summaryrefslogtreecommitdiff
path: root/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/generic_midi/generic_midi_control_protocol.cc')
-rw-r--r--libs/surfaces/generic_midi/generic_midi_control_protocol.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
index ae962feddc..62d7b8158b 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
@@ -68,20 +68,26 @@ GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
_current_bank = 0;
_bank_size = 0;
- /* XXX is it right to do all these in the same thread as whatever emits the signal? */
+ /* these signals are emitted by the MidiControlUI's event loop thread
+ * and we may as well handle them right there in the same the same
+ * thread
+ */
Controllable::StartLearning.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::start_learning, this, _1));
Controllable::StopLearning.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::stop_learning, this, _1));
Controllable::CreateBinding.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::create_binding, this, _1, _2, _3));
Controllable::DeleteBinding.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::delete_binding, this, _1));
+ Session::SendFeedback.connect (*this, MISSING_INVALIDATOR, ui_bind (&GenericMidiControlProtocol::send_feedback, this), midi_ui_context());;
+#if 0
+ /* XXXX SOMETHING GOES WRONG HERE (april 2012) - STILL DEBUGGING */
/* this signal is emitted by the process() callback, and if
* send_feedback() is going to do anything, it should do it in the
* context of the process() callback itself.
*/
Session::SendFeedback.connect_same_thread (*this, boost::bind (&GenericMidiControlProtocol::send_feedback, this));
-
+#endif
/* this one is cross-thread */
Route::RemoteControlIDChange.connect (*this, MISSING_INVALIDATOR, ui_bind (&GenericMidiControlProtocol::reset_controllables, this), midi_ui_context());
@@ -244,6 +250,9 @@ GenericMidiControlProtocol::set_feedback_interval (microseconds_t ms)
void
GenericMidiControlProtocol::send_feedback ()
{
+ /* This is executed in RT "process" context", so no blocking calls
+ */
+
if (!do_feedback) {
return;
}
@@ -264,6 +273,9 @@ GenericMidiControlProtocol::send_feedback ()
void
GenericMidiControlProtocol::_send_feedback ()
{
+ /* This is executed in RT "process" context", so no blocking calls
+ */
+
const int32_t bufsize = 16 * 1024; /* XXX too big */
MIDI::byte buf[bufsize];
int32_t bsize = bufsize;