summaryrefslogtreecommitdiff
path: root/src/compute.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compute.c')
-rw-r--r--src/compute.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/compute.c b/src/compute.c
index ce0575f..e574838 100644
--- a/src/compute.c
+++ b/src/compute.c
@@ -1,3 +1,20 @@
+/*
+ Instru2Light - Illumine un instrument de musique en temps réel
+ Copyright (C) 2012 Ludovic Pouzenc <lpouzenc@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
#include "compute.h"
#include "fft.h"
@@ -6,10 +23,6 @@
#define MIN_SAMPLES 256
#define MAX_SAMPLES 2048
-//#define MAX(a,b) (a>b?a:b)
-//#define MIN(a,b) (a<b?a:b)
-
-//static inline float todB_a(const float *x);
void compute_spectrum(float *data, int width, float output[PSHalf]);
@@ -57,12 +70,13 @@ float compute_level(const float *data, size_t nsamples, int rate) {
return value;
}
+
/*
-static inline float todB_a(const float *x){
- return (float)((*(int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f;
-}
+ This function was adapted from Audacity 1.3.13
+ (orignally in C++ and with more genericity and functionnality)
+ Original Author : Dominic Mazzoni
+ Licenced under GPL 2.0
*/
-// Adapted from Audacity
void compute_spectrum(float *data, int width, float output[PSHalf]) {
int i, start, windows;