Hello there!<br><br>I am trying to write a real time pitch shifter using C++.<br>The pitch shifter uses resampling and WSOLA for time-scaling.<br>I have written a jack client that already works using C, but I would like<br>
to try using zita-resampler as the resampler library for my program.<br>That is why I am rewriting my program using C++ (it would also be a learning experience for me).<br>I looked to Rui's synthv1 and zita-ajbridge for example of writing jack client using C++.<br>
<br>The problem I am having relates to Jack MIDI.<br>My program keeps having a segfault when it is trying to read from the MIDI buffer,<br>specifically when it tries to dereference the buffer pointer inside the event structure.<br>
<br>jack_midi_event_get(&in_event, midi_buf, event_index);<br>if ((*(in_event.buffer) & 0xf0) == 0x90) // Segfault happens here, on boolean mask operation<br>{<br>    _note = *(in_event.buffer + 1);<br>}<br><br>So I tried to print the buffer's content but it also segfaults.<br>
std::cout << std::hex << static_cast<unsigned int> (*(in_event.buffer)) << std::endl;<br><br>My understanding that in_event.buffer is a pointer-to-char,<br>so that *(in_event.buffer) should be an unsigned char.<br>
<br>I don't understand where I am doing wrong,<br>I would be very grateful if someone could point out my error.<br><br>Oh, my computer is Archlinux 64 bit using jack2-git 20120718.<br>I have put up a git repo of the code on <a href="https://github.com/shanipribadi/pitch-segfault.git">https://github.com/shanipribadi/pitch-segfault.git</a><br>
<br>Thanks.<br><br>Shani Pribadi<br>