X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=shared%2Fmidi_device.cpp;h=0383ec20d921bd8166595a24f4fe6fe3201124a3;hp=ab84fda6db51099e3ecf03013bc08a7b0a60947a;hb=f61426b86c37f873a52f0440537df8f9a35562a4;hpb=1bf2b3e600dc5485f4957a419459b997d721e5fa diff --git a/shared/midi_device.cpp b/shared/midi_device.cpp index ab84fda..0383ec2 100644 --- a/shared/midi_device.cpp +++ b/shared/midi_device.cpp @@ -154,7 +154,6 @@ void MIDIDevice::handle_event(snd_seq_t *seq, snd_seq_event_t *event) return; } - lock_guard lock(mu); switch (event->type) { case SND_SEQ_EVENT_CONTROLLER: { receiver->controller_received(event->data.control.param, event->data.control.value); @@ -169,9 +168,11 @@ void MIDIDevice::handle_event(snd_seq_t *seq, snd_seq_event_t *event) receiver->note_on_received(event->data.note.note); break; } - case SND_SEQ_EVENT_PORT_START: + case SND_SEQ_EVENT_PORT_START: { + lock_guard lock(mu); subscribe_to_port_lock_held(seq, event->data.addr); break; + } case SND_SEQ_EVENT_PORT_EXIT: printf("MIDI port %d:%d went away.\n", event->data.addr.client, event->data.addr.port); break;