[LAD] Segfault when trying to dereference __midi_event.buffer (c++ newbie question)
Fons Adriaensen
fons at linuxaudio.org
Wed Nov 21 12:49:21 UTC 2012
On Wed, Nov 21, 2012 at 06:54:03PM +0700, Shani Hadiyanto Pribadi wrote:
> jack_midi_event_get(&in_event, midi_buf, event_index);
> if ((*(in_event.buffer) & 0xf0) == 0x90) // Segfault happens here, on
> boolean mask operation
> {
> _note = *(in_event.buffer + 1);
> }
You should test the return value of jack_midi_event_get().
The contents of in_event are valid only if that is zero,
which means there actually was an event to be read.
Ciao,
--
FA
A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)
More information about the Linux-audio-dev
mailing list