Changeset 9:73840ee4793d in roaraudio
- Timestamp:
- 06/18/08 15:15:31 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/loop.c
r0 r9 6 6 void ** streams_input = NULL; 7 7 uint32_t pos = 0; 8 #ifdef MONITOR_LATENCY 9 struct timeval try, ans; 10 long int ans_1last = 0, ans_2last = 0, ans_3last = 0; 11 12 printf("\n\e[s"); 13 fflush(stdout); 14 #endif 8 15 9 16 ROAR_DBG("main_loop(*) = ?"); … … 11 18 12 19 while (alive) { 20 #ifdef MONITOR_LATENCY 21 gettimeofday(&try, NULL); 22 #endif 23 13 24 ROAR_DBG("main_loop(*): looping..."); 14 25 … … 45 56 pos = ROAR_MATH_OVERFLOW_ADD(pos, ROAR_OUTPUT_BUFFER_SAMPLES); 46 57 ROAR_DBG("main_loop(*): current pos: %u", pos); 58 #ifdef MONITOR_LATENCY 59 gettimeofday(&ans, NULL); 60 61 while (ans.tv_sec > try.tv_sec) { 62 ans.tv_sec--; 63 ans.tv_usec += 1000000; 64 } 65 ans.tv_usec -= try.tv_usec; 66 67 if ( pos % 3 ) { 68 printf("\e[ucurrent latency: %.3fms average: %.3fms ", ans.tv_usec / (double)1000, 69 (ans.tv_usec+ans_3last+ans_2last+ans_1last)/ (double)4000); 70 fflush(stdout); 71 } 72 73 ans_3last = ans_2last; 74 ans_2last = ans_1last; 75 ans_1last = ans.tv_usec; 76 #endif 47 77 } 48 78
Note: See TracChangeset
for help on using the changeset viewer.