summaryrefslogtreecommitdiff
path: root/src/compute.c
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2012-06-22 22:58:30 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2012-06-22 22:58:30 +0000
commit792fd531f67a9490f16eb594b4b3eb646128275e (patch)
tree15d365884caf2d2da5b3f4bf005a224d36d1af00 /src/compute.c
parentfcc319c1cd7857816447b68036252c82d7365df3 (diff)
download2012-violon-leds-792fd531f67a9490f16eb594b4b3eb646128275e.tar.gz
2012-violon-leds-792fd531f67a9490f16eb594b4b3eb646128275e.tar.bz2
2012-violon-leds-792fd531f67a9490f16eb594b4b3eb646128275e.zip
"Backport de l'IHM de test7 dans le projet principal.
Application licence GPL v3.0 Renommage appli Music2Light (homonymes existants) -> Instru2Light git-svn-id: file:///var/svn/2012-violon-leds/trunk@30 6be1fa4d-33ac-4c33-becc-79fcb3794bb6
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;