From f80dd24a8d11303619b9ddc5badc33c611b45580 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Sat, 4 Apr 2015 22:16:55 -0400 Subject: [PATCH] rearrange files some a few cleanups, too. --- Makefile | 4 ++-- DFT32.c => embeddedcommon/DFT32.c | 0 DFT32.h => embeddedcommon/DFT32.h | 0 embeddednf.c => embeddedcommon/embeddednf.c | 4 ++-- embeddednf.h => embeddedcommon/embeddednf.h | 8 +++++--- embeddedout.c => embeddedcommon/embeddedout.c | 5 +++-- embeddedout.h => embeddedcommon/embeddedout.h | 2 +- embeddedlinux/Makefile | 4 ++-- embeddedlinux/embeddedcc.c | 2 +- 9 files changed, 16 insertions(+), 13 deletions(-) rename DFT32.c => embeddedcommon/DFT32.c (100%) rename DFT32.h => embeddedcommon/DFT32.h (100%) rename embeddednf.c => embeddedcommon/embeddednf.c (99%) rename embeddednf.h => embeddedcommon/embeddednf.h (95%) rename embeddedout.c => embeddedcommon/embeddedout.c (97%) rename embeddedout.h => embeddedcommon/embeddedout.h (92%) diff --git a/Makefile b/Makefile index dda437d..cd78272 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,10 @@ LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse CFLAGS:=-g -Os -flto -Wall EXTRALIBS:=-lusb-1.0 -colorchord : os_generic.o main.o dft.o decompose.o filter.o color.o sort.o notefinder.o util.o outdrivers.o $(RAWDRAW) $(SOUND) $(OUTS) parameters.o chash.o DFT32.o +colorchord : os_generic.o main.o dft.o decompose.o filter.o color.o sort.o notefinder.o util.o outdrivers.o $(RAWDRAW) $(SOUND) $(OUTS) parameters.o chash.o embeddedcommon/DFT32.o gcc -o $@ $^ $(CFLAGS) $(LDLIBS) $(EXTRALIBS) $(RAWDRAWLIBS) -colorchord.exe : os_generic.c main.c dft.c decompose.c filter.c color.c sort.c notefinder.c util.c outdrivers.c DrawFunctions.c parameters.c chash.c WinDriver.c sound.c sound_null.c sound_win.c OutputVoronoi.c DisplayArray.c OutputLinear.c DisplayPie.c DisplayNetwork.c DFT32.c +colorchord.exe : os_generic.c main.c dft.c decompose.c filter.c color.c sort.c notefinder.c util.c outdrivers.c DrawFunctions.c parameters.c chash.c WinDriver.c sound.c sound_null.c sound_win.c OutputVoronoi.c DisplayArray.c OutputLinear.c DisplayPie.c DisplayNetwork.c embeddedcommon/DFT32.c $(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS) diff --git a/DFT32.c b/embeddedcommon/DFT32.c similarity index 100% rename from DFT32.c rename to embeddedcommon/DFT32.c diff --git a/DFT32.h b/embeddedcommon/DFT32.h similarity index 100% rename from DFT32.h rename to embeddedcommon/DFT32.h diff --git a/embeddednf.c b/embeddedcommon/embeddednf.c similarity index 99% rename from embeddednf.c rename to embeddedcommon/embeddednf.c index aac3933..0c5349e 100644 --- a/embeddednf.c +++ b/embeddedcommon/embeddednf.c @@ -291,7 +291,7 @@ void HandleFrameInfo() note_peak_amps2[marked_note] = note_peak_amps2[marked_note] - (note_peak_amps2[marked_note]>>AMP_2_IIR_BITS) + - (this>>(AMP_2_IIR_BITS-3)); + ((this<<3)>>(AMP_2_IIR_BITS)); } } } @@ -325,7 +325,7 @@ void HandleFrameInfo() distance = ((1<<(SEMIBITSPERBIN))*FIXBPERO) - distance; } - if( distance > MAX_JUMP_DISTANCE * 2 ) + if( distance > MAX_COMBINE_DISTANCE ) { continue; } diff --git a/embeddednf.h b/embeddedcommon/embeddednf.h similarity index 95% rename from embeddednf.h rename to embeddedcommon/embeddednf.h index 90087f4..4619300 100644 --- a/embeddednf.h +++ b/embeddedcommon/embeddednf.h @@ -35,21 +35,23 @@ //distance times two. #define MAX_JUMP_DISTANCE 4 +#define MAX_COMBINE_DISTANCE 7 + //These control how quickly the IIR for the note strengths respond. AMP 1 is //the response for the slow-response, or what we use to determine size of //splotches, AMP 2 is the quick response, or what we use to see the visual //strength of the notes. #define AMP_1_IIR_BITS 5 -#define AMP_2_IIR_BITS 3 +#define AMP_2_IIR_BITS 2 //This is the amplitude, coming from folded_bins. If the value is below this //it is considered a non-note. -#define MIN_AMP_FOR_NOTE 128 +#define MIN_AMP_FOR_NOTE 80 //If the strength of a note falls below this, the note will disappear, and be //recycled back into the unused list of notes. -#define MINIMUM_AMP_FOR_NOTE_TO_DISAPPEAR 100 +#define MINIMUM_AMP_FOR_NOTE_TO_DISAPPEAR 64 diff --git a/embeddedout.c b/embeddedcommon/embeddedout.c similarity index 97% rename from embeddedout.c rename to embeddedcommon/embeddedout.c index c429766..f4eb756 100644 --- a/embeddedout.c +++ b/embeddedcommon/embeddedout.c @@ -83,14 +83,15 @@ void UpdateLinearLEDs() uint16_t local_peak_amps2[MAXNOTES]; uint8_t local_peak_freq[MAXNOTES]; + //Make a copy of all of the variables into local ones so we don't have to keep double-dereferencing. for( i = 0; i < sorted_map_count; i++ ) { - printf( "%5d ", local_peak_amps[i] ); + //printf( "%5d ", local_peak_amps[i] ); local_peak_amps[i] = note_peak_amps[sorted_note_map[i]] - note_nerf_a; local_peak_amps2[i] = note_peak_amps2[sorted_note_map[i]]; local_peak_freq[i] = note_peak_freqs[sorted_note_map[i]]; } - printf( "\n" ); +// printf( "\n" ); for( i = 0; i < sorted_map_count; i++ ) { diff --git a/embeddedout.h b/embeddedcommon/embeddedout.h similarity index 92% rename from embeddedout.h rename to embeddedcommon/embeddedout.h index 25c755b..8a9685f 100644 --- a/embeddedout.h +++ b/embeddedcommon/embeddedout.h @@ -5,7 +5,7 @@ //Controls brightness -#define NOTE_FINAL_AMP 16 //Number from 0...255 +#define NOTE_FINAL_AMP 12 //Number from 0...255 //Controls, basically, the minimum size of the splotches. #define NERF_NOTE_PORP 15 //value from 0 to 255 diff --git a/embeddedlinux/Makefile b/embeddedlinux/Makefile index 80ba9c9..28b9233 100644 --- a/embeddedlinux/Makefile +++ b/embeddedlinux/Makefile @@ -1,9 +1,9 @@ all : embeddedcc -CFLAGS:=-Ofast -DCCEMBEDDED -I.. -flto -m32 -DDFREQ=11025 +CFLAGS:=-Ofast -DCCEMBEDDED -I.. -flto -m32 -DDFREQ=11025 -I../embeddedcommon LDFLAGS:=-ffunction-sections -Wl,--gc-sections -fno-asynchronous-unwind-tables -Wl,--strip-all -embeddedcc : ../embeddednf.c ../DFT32.c embeddedcc.c ../embeddedout.c +embeddedcc : ../embeddedcommon/embeddednf.c ../embeddedcommon/DFT32.c embeddedcc.c ../embeddedcommon/embeddedout.c gcc -o $@ $^ $(CFLAGS) $(LDFLAGS) runembedded : embeddedcc diff --git a/embeddedlinux/embeddedcc.c b/embeddedlinux/embeddedcc.c index eb73181..2b25c1e 100644 --- a/embeddedlinux/embeddedcc.c +++ b/embeddedlinux/embeddedcc.c @@ -63,7 +63,7 @@ int main() Push8BitIntegerSkippy( (int8_t)cs ); #endif wf++; - if( wf == 64 ) + if( wf == 128 ) { NewFrame(); wf = 0;