X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Flinux_vst_gui_support.cc;h=c54430c4e64ede4a06a3d06be674251f2afa8138;hb=7d3ef2318338b4dc6f836dbdba34f56627633a6d;hp=5eaf485c7569587ff45bce90c1d9d70828e33282;hpb=4ece16be8ea0b9862d05886eaecdf4108b345c53;p=ardour.git diff --git a/gtk2_ardour/linux_vst_gui_support.cc b/gtk2_ardour/linux_vst_gui_support.cc index 5eaf485c75..c54430c4e6 100644 --- a/gtk2_ardour/linux_vst_gui_support.cc +++ b/gtk2_ardour/linux_vst_gui_support.cc @@ -22,11 +22,10 @@ /** VSTFX - An engine based on FST for handling linuxVST plugins **/ /******************************************************************/ -/** EDITOR tab stops at 4 **/ - #include #include #include +#include #include #include @@ -349,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*/ @@ -465,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 */ @@ -772,6 +782,10 @@ vstfx_event_loop_remove_plugin (VSTState* vstfx) } } + // if this function is called, there must be + // at least one plugin in the linked list + assert(vstfx_first); + if (vstfx_first == vstfx) { vstfx_first = vstfx_first->next; }