From 09fabeb39bc13d46d88351729d3b8daecab8820e Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Tue, 20 Jul 2010 01:02:58 +0200 Subject: [PATCH] Make glpitch user exitable. --- glpitch.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/glpitch.cpp b/glpitch.cpp index e40f8ce..a3c3010 100644 --- a/glpitch.cpp +++ b/glpitch.cpp @@ -27,6 +27,19 @@ int main(void) 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 peak = pd.detect_pitch(buf); -- 2.39.2