Add a gaussian filter for maximum beeping pleasure.
authorSimon Schubert <corecode@dragonflybsd.org>
Sat, 29 Nov 2008 23:41:05 +0000 (00:41 +0100)
committerSimon Schubert <corecode@dragonflybsd.org>
Sun, 30 Nov 2008 12:26:16 +0000 (13:26 +0100)
games/morse/morse.c

index eb79b5b..790bd44 100644 (file)
@@ -433,14 +433,14 @@ alloc_soundbuf(struct tone_data *tone, double len, int on)
                        /*
                         * Gauss window
                         */
-#if 0
+#ifdef GAUSS_FILTER
                        int fi = i;
 
                        if (i > FILTER_SAMPLES)
                                fi = samples - i;
-                       filter = exp(-0.5 *
-                                    pow((double)(fi - FILTER_SAMPLES) /
-                                        (0.4 * FILTER_SAMPLES), 2));
+                       filter = exp(-4.0 *
+                                    pow((double)(FILTER_SAMPLES - fi) /
+                                        FILTER_SAMPLES, 2));
 #else
                        /*
                         * Triangle window