summaryrefslogtreecommitdiff
path: root/gtk2_ardour/linux_vst_gui_support.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-05-27 23:16:59 +0200
committerRobin Gareus <robin@gareus.org>2015-05-27 23:30:56 +0200
commit2d311979e34df75ad048f0f7d25b1698e21b11bc (patch)
treeae4add84b67198cb7f4b873e4baad83349309992 /gtk2_ardour/linux_vst_gui_support.cc
parentd98af1785a55bc3b1e9efdcfeb47b1575b2490d7 (diff)
relax LinuxVST GUI event loop.
it was spinning at 100Hz.
Diffstat (limited to 'gtk2_ardour/linux_vst_gui_support.cc')
-rw-r--r--gtk2_ardour/linux_vst_gui_support.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk2_ardour/linux_vst_gui_support.cc b/gtk2_ardour/linux_vst_gui_support.cc
index e438ed6f92..c54430c4e6 100644
--- a/gtk2_ardour/linux_vst_gui_support.cc
+++ b/gtk2_ardour/linux_vst_gui_support.cc
@@ -348,11 +348,18 @@ void* gui_event_loop (void* ptr)
/*Look at the XEvent queue - if there are any XEvents we need to handle them,
including passing them to all the plugin (eventProcs) we are currently managing*/
+ bool may_sleep = true;
+
if(LXVST_XDisplay)
{
/*See if there are any events in the queue*/
int num_events = XPending(LXVST_XDisplay);
+
+ if (num_events > 0) {
+ // keep dispatching events as fast as possible
+ may_sleep = false;
+ }
/*process them if there are any*/
@@ -464,6 +471,10 @@ again:
clock1 = g_get_monotonic_time();
}
+
+ if (may_sleep && elapsed_time_ms + 1 < LXVST_sched_timer_interval) {
+ Glib::usleep(1000 * (LXVST_sched_timer_interval - elapsed_time_ms - 1));
+ }
}
/*Drop out to here if we set gui_quit to 1 */