Am 21.11.2012 13:24, schrieb SxDx:
----- Original Message -----
From: "Shani Hadiyanto
Pribadi"<shanipribadi(a)gmx.net>
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);
}
jack_midi_event_get may return ENODATA
as explained in {wherever}/include/jack/midiport.h
don't access in_event in that case, there is no data
_______________________________________________
here is how we access jack_midi in
data.
// ----- jack process callback for the midi input
void MidiControllerList::compute_midi_in(void* midi_input_port_buf) {
jack_midi_event_t in_event;
jack_nframes_t event_count =
jack_midi_get_event_count(midi_input_port_buf);
unsigned int i;
for (i = 0; i < event_count; i++) {
jack_midi_event_get(&in_event, midi_input_port_buf, i);
if ((in_event.buffer[0] & 0xf0) == 0xc0) { // program change
on any midi channel
gx_system::atomic_set(&program_change, in_event.buffer[1]);
pgm_chg();
} else if ((in_event.buffer[0] & 0xf0) == 0xb0) { // controller
set_ctr_val(in_event.buffer[1], in_event.buffer[2]);
}
}
}