uint8_t PLR_PlayFullFile(const char* filename) { uint8_t err = ERR_OK; err = PLR_StartNewFile(filename,FALSE); if (err != ERR_OK) { return err; } while (PlaybackIsSet()) { feedDataStream(); } return ERR_OK; }
static portTASK_FUNCTION( playerTask, pvParameters) { (void) pvParameters; /* not used */ //VS_SetVolume(0x2014); VS_SetVolume(0x0000); for (;;) { turnlight(); feedDataStream(); FRTOS1_vTaskDelay(TASKDEL_MS / portTICK_RATE_MS); } }
static int zerocorr(const char *confFile, int verbose) { Baseline *B; int n, j, v, index; sighandler_t oldsiginthand; double x, y, window, scale; oldsiginthand = signal(SIGINT, siginthand); B = newBaseline(confFile); if(!B) { return EXIT_FAILURE; } if(verbose > 0) { printBaseline(B); } for(n = 0; n < B->nFFT; n++) { if(verbose > 1 && n % 100 == 0) { printf("%d of %d FFTs complete\n", n, B->nFFT); } v = feedDataStream(B->ds1); if(v < 0) { break; } v = feedDataStream(B->ds2); if(v < 0) { break; } if(verbose > 2 && n % 1000 == 0) report_baseline_data(B, verbose > 3); for(j = 0; j < B->nChan; j++) { B->visibility[j] += B->ds1->spec[j]*~B->ds2->spec[j]; B->ac1[j] += creal(B->ds1->spec[j]*~B->ds1->spec[j]); B->ac2[j] += creal(B->ds2->spec[j]*~B->ds2->spec[j]); } if(die) { fprintf(stderr, "\nStopping early at %d / %d\n", n+1, B->nFFT); break; } } if(n == 0) { fprintf(stderr, "No data correlated!\n"); } else { printf("%d FFTs processed\n", n); scale = 1.0/(n); for(j = 0; j < B->nChan; j++) { x = creal(B->visibility[j])*scale; y = cimag(B->visibility[j])*scale; fprintf(B->outVis, "%d %e %e %e %e %e %e %e\n", j, j*B->deltaF, x, y, sqrt(x*x+y*y), atan2(y, x), B->ac1[j]/n, B->ac2[j]/n); } fftw_execute(B->plan); scale = 1.0/(n); for(j = -B->nChan/2+1; j < B->nChan/2; j++) { index = j >= 0 ? j : j+B->nChan; window = (B->nChan/2 - abs(j))/(float)(B->nChan/2); x = creal(B->lags[index])*scale; y = cimag(B->lags[index])*scale; fprintf(B->outLag, "%d %e %e %e %e %e %e\n", j, j*B->deltaT, x, y, sqrt(x*x+y*y), atan2(y, x), window); } } deleteBaseline(B); signal(SIGINT, oldsiginthand); return EXIT_SUCCESS; }