On Wed, Nov 21, 2012 at 11:54 AM, Shani Hadiyanto Pribadi <
shanipribadi@email-addr-hidden> 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);
> }
>
Extra context from you git repo:
void *midi_buf;
jack_midi_event_t in_event;
jack_nframes_t event_index = 0;
jack_nframes_t event_count;
midi_buf = jack_port_get_buffer(_ports[MIDI], nframes);
event_count = jack_midi_get_event_count(midi_buf);
jack_midi_event_get(&in_event, midi_buf, event_index); // error here?
std::cout << std::hex << static_cast<unsigned int> (*(in_event.buffer))
<< std::endl;
if (event_count)
{
}
What happens when event_index has a value of 0? It will attempt a read &
dereference anyway.
Perhaps put the jack_midi_event_get() call into the if statement.
Also, you should probably use this instead of if(event_count)
int event_num = 0;
while ( event_num < event_count )
{
// do stuff
event_num++;
}
Haven't tried the above code, but I think that might be it :)
HTH, -Harry
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Wed Nov 21 16:15:02 2012
This archive was generated by hypermail 2.1.8 : Wed Nov 21 2012 - 16:15:02 EET