Move the configuration into its own header file.
authorsgunderson@bigfoot.com <>
Mon, 19 Jul 2010 21:34:23 +0000 (23:34 +0200)
committersgunderson@bigfoot.com <>
Mon, 19 Jul 2010 21:34:23 +0000 (23:34 +0200)
config.h [new file with mode: 0644]
pitch.cpp

diff --git a/config.h b/config.h
new file mode 100644 (file)
index 0000000..87f25e9
--- /dev/null
+++ b/config.h
@@ -0,0 +1,18 @@
+#ifndef _CONFIG_H
+#define _CONFIG_H 1
+
+#define BASE_PITCH      440.0
+#define SAMPLE_RATE     22050
+#define FFT_LENGTH      4096     /* in samples */
+#define PAD_FACTOR      2        /* 1/pf of the FFT samples are real samples, the rest are padding */
+#define OVERLAP         4        /* 1/ol samples will be replaced in the buffer every frame. Should be
+                                 * a multiple of 2 for the Hamming window (see
+                                 * http://www-ccrma.stanford.edu/~jos/parshl/Choice_Hop_Size.html).
+                                 */
+
+#define EQUAL_TEMPERAMENT     0
+#define WELL_TEMPERED_GUITAR  1
+
+#define TUNING WELL_TEMPERED_GUITAR
+
+#endif /* !defined(_CONFIG_H) */
index 1ab4696..bc97ee5 100644 (file)
--- a/pitch.cpp
+++ b/pitch.cpp
@@ -3,23 +3,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "config.h"
+#include "notes.h"
 #include "linux_audio.h"
 #include "pitchdetector.h"
 
-#define BASE_PITCH      440.0
-#define SAMPLE_RATE     22050
-#define FFT_LENGTH      4096     /* in samples */
-#define PAD_FACTOR      2        /* 1/pf of the FFT samples are real samples, the rest are padding */
-#define OVERLAP         4        /* 1/ol samples will be replaced in the buffer every frame. Should be
-                                 * a multiple of 2 for the Hamming window (see
-                                 * http://www-ccrma.stanford.edu/~jos/parshl/Choice_Hop_Size.html).
-                                 */
-
-#define EQUAL_TEMPERAMENT     0
-#define WELL_TEMPERED_GUITAR  1
-
-#define TUNING WELL_TEMPERED_GUITAR
-
 void print_spectrogram(double freq, double amp);
 void write_sine(int dsp_fd, double freq, unsigned num_samples);