Changeset 905:2fd9cd5be5ef in roaraudio for roard/loop.c
- Timestamp:
- 11/28/08 22:24:43 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/loop.c
r729 r905 25 25 #include "roard.h" 26 26 27 int main_loop (int driver, DRIVER_USERDATA_T driver_inst, struct roar_audio_info * sa ) {27 int main_loop (int driver, DRIVER_USERDATA_T driver_inst, struct roar_audio_info * sa, int sysclocksync) { 28 28 void ** streams_input = NULL; 29 29 int term = 0; 30 30 int streams; 31 long int loopc = 0; 32 struct timeval try, ans; 33 float freq; 31 34 #ifdef MONITOR_LATENCY 32 struct timeval try, ans;33 35 long int ans_1last = 0, ans_2last = 0, ans_3last = 0; 34 long int loopc = 0;35 36 36 37 printf("\n\e[s"); … … 41 42 alive = 1; 42 43 g_pos = 0; 44 45 if ( sysclocksync ) { 46 gettimeofday(&try, NULL); 47 } 43 48 44 49 while (alive) { … … 109 114 ans_2last = ans_1last; 110 115 ans_1last = ans.tv_usec; 111 loopc++;112 116 #endif 117 118 if ( ! (loopc % sysclocksync ) ) { 119 gettimeofday(&ans, NULL); 120 121 while (ans.tv_sec > try.tv_sec) { 122 ans.tv_sec--; 123 ans.tv_usec += 1000000; 124 } 125 ans.tv_usec -= try.tv_usec; 126 127 128 freq = (sysclocksync * ROAR_OUTPUT_BUFFER_SAMPLES) / (ans.tv_usec / 1e6); 129 printf("SYNC: f_conf=%iHz, f_real=%.2fHz\n", sa->rate, freq); 130 131 // memcpy(&try, &ans, sizeof(try)); 132 gettimeofday(&try, NULL); 133 } 134 135 if ( sysclocksync ) 136 loopc++; 113 137 } 114 138
Note: See TracChangeset
for help on using the changeset viewer.