glClear(GL_COLOR_BUFFER_BIT);
for ( ;; ) {
+ SDL_Event event;
+ while (SDL_PollEvent(&event)) {
+ switch (event.type) {
+ case SDL_KEYUP:
+ if (event.key.keysym.sym == SDLK_ESCAPE) {
+ exit(0);
+ }
+ break;
+ case SDL_QUIT:
+ exit(0);
+ }
+ }
+
short buf[FFT_LENGTH / PAD_FACTOR / OVERLAP];
read_chunk(fd, buf, FFT_LENGTH / PAD_FACTOR / OVERLAP);
std::pair<double, double> peak = pd.detect_pitch(buf);