Changeset 905:2fd9cd5be5ef in roaraudio
- Timestamp:
- 11/28/08 22:24:43 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/include/roard.h
r668 r905 64 64 int g_standby; 65 65 66 int main_loop (int driver, DRIVER_USERDATA_T driver_inst, struct roar_audio_info * sa );66 int main_loop (int driver, DRIVER_USERDATA_T driver_inst, struct roar_audio_info * sa, int sysclocksync); 67 67 void cleanup_listen_socket (int terminate); 68 68 void clean_quit (void); -
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 -
roard/roard.c
r775 r905 40 40 " --setgid - GroupID to the audio group as specified via -G\n" 41 41 " --setuid - UserID to the audio user as specified via -U\n" 42 " --sysclocksync - calculate exact sample rate using the system clock\n" 42 43 ); 43 44 … … 116 117 int i; 117 118 char * k; 118 char user_sock[80] = {0};119 char user_sock[80] = {0}; 119 120 struct roar_audio_info sa; 120 int daemon = 0; 121 int realtime = 0; 121 int daemon = 0; 122 int realtime = 0; 123 int sysclocksync = 0; 122 124 char * driver = getenv("ROAR_DRIVER"); 123 125 char * device = getenv("ROAR_DEVICE"); … … 204 206 } else if ( strcmp(k, "--terminate") == 0 ) { 205 207 g_terminate = 1; 208 } else if ( strcmp(k, "--sysclocksync") == 0 ) { 209 sysclocksync = 1000; 206 210 } else if ( strcmp(k, "--realtime") == 0 ) { 207 211 realtime++; … … 463 467 464 468 // start main loop... 465 main_loop(drvid, drvinst, &sa );469 main_loop(drvid, drvinst, &sa, sysclocksync); 466 470 467 471 // clean up.
Note: See TracChangeset
for help on using the changeset viewer.