]> git.sesse.net Git - nageru/blobdiff - midi_mapper.cpp
Fix an issue where the mixer lagging too much behind CEF would cause us to display...
[nageru] / midi_mapper.cpp
index d03f38211e524a2fcb85b70c96cddc4c958b46d9..42ad1e5e2a00f3e29d43459e77b41ff1b90fbe33 100644 (file)
@@ -232,6 +232,10 @@ void MIDIMapper::thread_func()
                        if (err < 0) {
                                if (err == -EINTR) continue;
                                if (err == -EAGAIN) break;
+                               if (err == -ENOSPC) {
+                                       fprintf(stderr, "snd_seq_event_input: Some events were lost.\n");
+                                       continue;
+                               }
                                fprintf(stderr, "snd_seq_event_input: %s\n", snd_strerror(err));
                                return;
                        }
@@ -386,8 +390,14 @@ void MIDIMapper::handle_event(snd_seq_t *seq, snd_seq_event_t *event)
 
 void MIDIMapper::subscribe_to_port_lock_held(snd_seq_t *seq, const snd_seq_addr_t &addr)
 {
-       // Client 0 is basically the system; ignore it.
-       if (addr.client == 0) {
+       // Client 0 (SNDRV_SEQ_CLIENT_SYSTEM) is basically the system; ignore it.
+       // MIDI through (SNDRV_SEQ_CLIENT_DUMMY) echoes back what we give it, so ignore that, too.
+       if (addr.client == 0 || addr.client == 14) {
+               return;
+       }
+
+       // Don't listen to ourselves.
+       if (addr.client == snd_seq_client_id(seq)) {
                return;
        }