X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Flinux_vst_gui_support.cc;h=e438ed6f926f98c83a28d6c96b199b3aa7b38e64;hb=8ada45344e949f3d36a96094ed443cac82ffd3c7;hp=469246f5170f38724c6181e1e1d8237451c6e873;hpb=c4bb32892fb98399d01ab8ea1a8ba3c1302c7442;p=ardour.git diff --git a/gtk2_ardour/linux_vst_gui_support.cc b/gtk2_ardour/linux_vst_gui_support.cc index 469246f517..e438ed6f92 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 @@ -336,9 +335,9 @@ void* gui_event_loop (void* ptr) VSTState* vstfx; int LXVST_sched_timer_interval = 40; //ms, 25fps XEvent event; - struct timeval clock1, clock2; + uint64_t clock1, clock2; - gettimeofday(&clock1, NULL); + clock1 = g_get_monotonic_time(); /*The 'Forever' loop - runs the plugin UIs etc - based on the FST gui event loop*/ while (!gui_quit) @@ -382,12 +381,12 @@ void* gui_event_loop (void* ptr) /*See if its time for us to do a scheduled event pass on all the plugins*/ - gettimeofday(&clock2, NULL); - const int elapsed_time = (clock2.tv_sec - clock1.tv_sec) * 1000 + (clock2.tv_usec - clock1.tv_usec) / 1000; + clock2 = g_get_monotonic_time(); + const int64_t elapsed_time_ms = (clock2 - clock1) / 1000; - if((LXVST_sched_timer_interval != 0) && elapsed_time >= LXVST_sched_timer_interval) + if((LXVST_sched_timer_interval != 0) && elapsed_time_ms >= LXVST_sched_timer_interval) { - //printf("elapsed %d ms ^= %.2f Hz\n", elapsed_time, 1000.0/(double)elapsed_time); // DEBUG + //printf("elapsed %d ms ^= %.2f Hz\n", elapsed_time_ms, 1000.0/(double)elapsed_time_ms); // DEBUG pthread_mutex_lock (&plugin_mutex); again: @@ -463,7 +462,7 @@ again: } pthread_mutex_unlock (&plugin_mutex); - gettimeofday(&clock1, NULL); + clock1 = g_get_monotonic_time(); } } @@ -772,6 +771,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; }