Hi Alessandro!<br><br>You'll need to learn a bit about threading in C++, either Mutexs or Lock Free Ringbuffers.<br>I'll advise Ringbuffers because it scales up, while mutexs is slightly easier to learn, but you'll<br>
want to learn ringbuffers soon thereafter anyway!<br><br>One option is to use the Gtk::timeout functions to update the values regardless of if they've changed: bit of a hack but it works :)<br><a href="http://developer.gnome.org/gtkmm-tutorial/3.0/sec-timeouts.html.en">http://developer.gnome.org/gtkmm-tutorial/3.0/sec-timeouts.html.en</a><br>
<br>Another option is to attach a "idle" function when a MIDI message is recieved in the MIDI IN callback: which tells the UI to update.<br><br>Problem with both of these options: you need to tell the parameters what value to update to: this involves either mutexs or a ringbuffer.<br>
<br>I've not looked at your code, this is all just C++ threading theory RE RtMidi & Gtkmm. Same applies for JACK & Gtkmm, or any "callback" api, and a "blocking" api like Gtkmm.<br><br>Good luck! -Harry<br>
<br>PS: I've written a blog post on Gtkmm & signal handling:<br><a href="http://harryhaaren.blogspot.com/2009/12/tut-5-callbacks-with-gtkmm.html">http://harryhaaren.blogspot.com/2009/12/tut-5-callbacks-with-gtkmm.html</a><br>
Its *not* thread safe, but it explains callbacks a little..<br><br><div class="gmail_quote">On Sat, Feb 4, 2012 at 5:57 PM, alessandro filippo <span dir="ltr"><<a href="mailto:alessandro.filippo@infinito.it">alessandro.filippo@infinito.it</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, I'm learning to write simple audio/midi applications in C++ with<br>
RtMidi and gtkmm libraries (version 2.4).<br>
<br>
This is the application I'm working on:<br>
<a href="http://www.eclepticbox.altervista.org/index.php/download/finish/2-audio-midi/8-sawlidsyngui" target="_blank">http://www.eclepticbox.altervista.org/index.php/download/finish/2-audio-midi/8-sawlidsyngui</a><br>
<br>
<br>
I got some issues with RtMidi IN (Callback). I followed the RtMidi<br>
tutorial and the VMPK example (however this is written with Qt), but the<br>
problem is that the GUI freezes when I send some MIDI data and it<br>
doesn't refresh the widgets values.<br>
<br>
Midi Out works properly.<br>
<br>
I think the problem is in the Midi Callback and in the event/signal<br>
managing.<br>
I tried some function in order to refresh the gui but they didn't work.<br>
<br>
This is the smallest extract of code that has the issue (only a<br>
spinbutton sending / receiving MIDI Program Change):<br>
<br>
<a href="http://www.eclepticbox.altervista.org/index.php/download/finish/2-audio-midi/9-sawlidsyngui-test" target="_blank">http://www.eclepticbox.altervista.org/index.php/download/finish/2-audio-midi/9-sawlidsyngui-test</a><br>

<br>
The sources are in the src folder, see:<br>
<br>
sawlidsyngui.cpp<br>
sawlidsyngui.h<br>
<br>
Any help is appreciated....<br>
<br>
Thanks ...<br>
Alessandro<br>
<br>
<br>
<br>
_______________________________________________<br>
Linux-audio-dev mailing list<br>
<a href="mailto:Linux-audio-dev@lists.linuxaudio.org">Linux-audio-dev@lists.linuxaudio.org</a><br>
<a href="http://lists.linuxaudio.org/listinfo/linux-audio-dev" target="_blank">http://lists.linuxaudio.org/listinfo/linux-audio-dev</a><br>
</blockquote></div><br>