Update copyright noteices, etc.
This commit is contained in:
parent
95c0c4837b
commit
bba28c688f
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
//XXX This needs to be re-worked to only output LEDs so DisplayArray can take it.
|
//XXX This needs to be re-worked to only output LEDs so DisplayArray can take it.
|
||||||
//XXX CONSIDER DUMPING
|
//XXX CONSIDER DUMPING
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2010, 2011 Charles Lohr
|
Copyright (c) 2010, 2011, 2015 <>< Charles Lohr
|
||||||
|
|
||||||
|
This file may be licensed under the NewBSD License OR The license found
|
||||||
|
here:
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
//XXX TODO Figure out why it STILL fails when going around a loop
|
//XXX TODO Figure out why it STILL fails when going around a loop
|
||||||
|
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
//Really basic driver, that just selects the most prominent color and washes all the LEDs with that.
|
//Really basic driver, that just selects the most prominent color and washes all the LEDs with that.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
//Generic C Hash table thing.
|
||||||
|
//WARNING: There is a known bug somewhere in the remove entry thing.
|
||||||
|
//I never found it...
|
||||||
|
//
|
||||||
|
// Copyright 2015 <>< Charles Lohr, under the NewBSD or MIT/x11 License.
|
||||||
|
|
||||||
#include "chash.h"
|
#include "chash.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
//Generic C Hash table thing.
|
||||||
|
//WARNING: There is a known bug somewhere in the remove entry thing.
|
||||||
|
//I never found it...
|
||||||
|
//
|
||||||
|
// Copyright 2015 <>< Charles Lohr, under the NewBSD or MIT/x11 License.
|
||||||
|
|
||||||
#ifndef _CHASH_H
|
#ifndef _CHASH_H
|
||||||
#define _CHASH_H
|
#define _CHASH_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
//Copyright (Public Domain) 2015 <>< Charles Lohr, under the NewBSD License.
|
||||||
|
//This file may be used in whole or part in any way for any purpose by anyone
|
||||||
|
//without restriction.
|
||||||
|
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
//Copyright (Public Domain) 2015 <>< Charles Lohr, under the NewBSD License.
|
||||||
|
//This file may be used in whole or part in any way for any purpose by anyone
|
||||||
|
//without restriction.
|
||||||
|
|
||||||
#ifndef _COLOR_H
|
#ifndef _COLOR_H
|
||||||
#define _COLOR_H
|
#define _COLOR_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "decompose.h"
|
#include "decompose.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _DECOMPOSE_H
|
#ifndef _DECOMPOSE_H
|
||||||
#define _DECOMPOSE_H
|
#define _DECOMPOSE_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "dft.h"
|
#include "dft.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _DFT_H
|
#ifndef _DFT_H
|
||||||
#define _DFT_H
|
#define _DFT_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "filter.h"
|
#include "filter.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _FILTER_H
|
#ifndef _FILTER_H
|
||||||
#define _FILTER_H
|
#define _FILTER_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
|
|
||||||
struct KeyEvent
|
struct KeyEvent
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _KEYHOOK_H
|
#ifndef _KEYHOOK_H
|
||||||
#define _KEYHOOK_H
|
#define _KEYHOOK_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "notefinder.h"
|
#include "notefinder.h"
|
||||||
#include "parameters.h"
|
#include "parameters.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _NOTEFINDER_H
|
#ifndef _NOTEFINDER_H
|
||||||
#define _NOTEFINDER_H
|
#define _NOTEFINDER_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the NewBSD OR MIT/x11 License.
|
||||||
|
|
||||||
#include "os_generic.h"
|
#include "os_generic.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the NewBSD or MIT/x11 License.
|
||||||
|
|
||||||
#ifndef _OS_GENERIC_H
|
#ifndef _OS_GENERIC_H
|
||||||
#define _OS_GENERIC_H
|
#define _OS_GENERIC_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "outdrivers.h"
|
#include "outdrivers.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "parameters.h"
|
#include "parameters.h"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
//Output drivers, used for outputting lights, etc... However, this technique
|
//Output drivers, used for outputting lights, etc... However, this technique
|
||||||
//may be used for unrelated-to-output plugins.
|
//may be used for unrelated-to-output plugins.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "parameters.h"
|
#include "parameters.h"
|
||||||
#include "chash.h"
|
#include "chash.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _PARAMETERS_H
|
#ifndef _PARAMETERS_H
|
||||||
#define _PARAMETERS_H
|
#define _PARAMETERS_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
//Copyright (Public Domain) 2015 <>< Charles Lohr, under the NewBSD License.
|
||||||
|
//This file may be used in whole or part in any way for any purpose by anyone
|
||||||
|
//without restriction.
|
||||||
|
|
||||||
#include "sort.h"
|
#include "sort.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
//Copyright (Public Domain) 2015 <>< Charles Lohr, under the NewBSD License.
|
||||||
|
//This file may be used in whole or part in any way for any purpose by anyone
|
||||||
|
//without restriction.
|
||||||
|
|
||||||
#ifndef _SORT_H
|
#ifndef _SORT_H
|
||||||
#define _SORT_H
|
#define _SORT_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _SOUND_H
|
#ifndef _SOUND_H
|
||||||
#define _SOUND_H
|
#define _SOUND_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "os_generic.h"
|
#include "os_generic.h"
|
||||||
#include "parameters.h"
|
#include "parameters.h"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "os_generic.h"
|
#include "os_generic.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
//This file is really rough. Full duplex doesn't seem to work hardly at all.
|
//This file is really rough. Full duplex doesn't seem to work hardly at all.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "parameters.h"
|
#include "parameters.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
//Copyright (Public Domain) 2015 <>< Charles Lohr, under the NewBSD License.
|
||||||
|
//This file may be used in whole or part in any way for any purpose by anyone
|
||||||
|
//without restriction.
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
//Copyright (Public Domain) 2015 <>< Charles Lohr, under the NewBSD License.
|
||||||
|
//This file may be used in whole or part in any way for any purpose by anyone
|
||||||
|
//without restriction.
|
||||||
|
|
||||||
#ifndef _UTIL_H
|
#ifndef _UTIL_H
|
||||||
#define _UTIL_H
|
#define _UTIL_H
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "DFT32.h"
|
#include "DFT32.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _DFT32_H
|
#ifndef _DFT32_H
|
||||||
#define _DFT32_H
|
#define _DFT32_H
|
||||||
|
|
||||||
|
#include <ccconfig.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
//A 32-bit version of the DFT used for ColorChord.
|
//A 32-bit version of the DFT used for ColorChord.
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "embeddednf.h"
|
#include "embeddednf.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
uint16_t folded_bins[FIXBPERO];
|
uint16_t folded_bins[FIXBPERO];
|
||||||
uint16_t fuzzed_bins[FIXBINS];
|
uint16_t fuzzed_bins[FIXBINS];
|
||||||
|
@ -9,6 +12,7 @@ uint16_t note_peak_amps2[MAXNOTES];
|
||||||
uint8_t note_jumped_to[MAXNOTES];
|
uint8_t note_jumped_to[MAXNOTES];
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PRECOMPUTE_FREQUENCY_TABLE
|
||||||
static const float bf_table[24] = {
|
static const float bf_table[24] = {
|
||||||
1.000000, 1.029302, 1.059463, 1.090508, 1.122462, 1.155353,
|
1.000000, 1.029302, 1.059463, 1.090508, 1.122462, 1.155353,
|
||||||
1.189207, 1.224054, 1.259921, 1.296840, 1.334840, 1.373954,
|
1.189207, 1.224054, 1.259921, 1.296840, 1.334840, 1.373954,
|
||||||
|
@ -36,12 +40,15 @@ int main()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
|
||||||
|
|
||||||
|
|
||||||
void UpdateFreqs()
|
void UpdateFreqs()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifndef PRECOMPUTE_FREQUENCY_TABLE
|
||||||
uint16_t fbins[FIXBPERO];
|
uint16_t fbins[FIXBPERO];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -55,8 +62,18 @@ void UpdateFreqs()
|
||||||
for( i = 0; i < FIXBPERO; i++ )
|
for( i = 0; i < FIXBPERO; i++ )
|
||||||
{
|
{
|
||||||
float frq = ( bf_table[i] * BASE_FREQ );
|
float frq = ( bf_table[i] * BASE_FREQ );
|
||||||
fbins[i] = ( 65536.0 ) / ( DFREQ ) * frq * 16;
|
fbins[i] = ( 65536.0 ) / ( DFREQ ) * frq * 16 + 0.5;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define PCOMP( f ) (uint16_t)((65536.0)/(DFREQ) * (f * BASE_FREQ) * 16 + 0.5)
|
||||||
|
|
||||||
|
static const uint16_t fbins[FIXBPERO] = {
|
||||||
|
PCOMP( 1.000000 ), PCOMP( 1.029302 ), PCOMP( 1.059463 ), PCOMP( 1.090508 ), PCOMP( 1.122462 ), PCOMP( 1.155353 ),
|
||||||
|
PCOMP( 1.189207 ), PCOMP( 1.224054 ), PCOMP( 1.259921 ), PCOMP( 1.296840 ), PCOMP( 1.334840 ), PCOMP( 1.373954 ),
|
||||||
|
PCOMP( 1.414214 ), PCOMP( 1.455653 ), PCOMP( 1.498307 ), PCOMP( 1.542211 ), PCOMP( 1.587401 ), PCOMP( 1.633915 ),
|
||||||
|
PCOMP( 1.681793 ), PCOMP( 1.731073 ), PCOMP( 1.781797 ), PCOMP( 1.834008 ), PCOMP( 1.887749 ), PCOMP( 1.943064 ) };
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_32DFT
|
#ifdef USE_32DFT
|
||||||
UpdateBins32( fbins );
|
UpdateBins32( fbins );
|
||||||
|
@ -65,7 +82,7 @@ void UpdateFreqs()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void InitColorChord()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
//Set up and initialize arrays.
|
//Set up and initialize arrays.
|
||||||
|
@ -76,15 +93,8 @@ void Init()
|
||||||
note_peak_amps2[i] = 0;
|
note_peak_amps2[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < FIXBPERO; i++ )
|
memset( folded_bins, 0, sizeof( folded_bins ) );
|
||||||
{
|
memset( fuzzed_bins, 0, sizeof( fuzzed_bins ) );
|
||||||
folded_bins[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( i = 0; i < FIXBINS; i++ )
|
|
||||||
{
|
|
||||||
fuzzed_bins[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Step 1: Initialize the Integer DFT.
|
//Step 1: Initialize the Integer DFT.
|
||||||
#ifdef USE_32DFT
|
#ifdef USE_32DFT
|
||||||
|
@ -102,10 +112,7 @@ void HandleFrameInfo()
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
uint8_t hitnotes[MAXNOTES];
|
uint8_t hitnotes[MAXNOTES];
|
||||||
for( i = 0; i < MAXNOTES; i++ )
|
memset( hitnotes, 0, sizeof( hitnotes ) );
|
||||||
{
|
|
||||||
hitnotes[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_32DFT
|
#ifdef USE_32DFT
|
||||||
uint16_t * strens;
|
uint16_t * strens;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _EMBEDDEDNF_H
|
#ifndef _EMBEDDEDNF_H
|
||||||
#define _EMBEDDEDNF_H
|
#define _EMBEDDEDNF_H
|
||||||
|
|
||||||
|
#include <ccconfig.h>
|
||||||
|
|
||||||
//Use a 32-bit DFT. It won't work for AVRs, but for any 32-bit systems where
|
//Use a 32-bit DFT. It won't work for AVRs, but for any 32-bit systems where
|
||||||
//they can multiply quickly, this is the bees knees.
|
//they can multiply quickly, this is the bees knees.
|
||||||
#define USE_32DFT
|
#define USE_32DFT
|
||||||
|
@ -9,7 +13,10 @@
|
||||||
#define DFREQ 8000
|
#define DFREQ 8000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BASE_FREQ 55.0 // You may make this a float.
|
//You may make this a float. If PRECOMPUTE_FREQUENCY_TABLE is defined, then
|
||||||
|
//it will create the table at compile time, and the float will never be used
|
||||||
|
//runtime.
|
||||||
|
#define BASE_FREQ 55.0
|
||||||
|
|
||||||
//The higher the number the slackier your FFT will be come.
|
//The higher the number the slackier your FFT will be come.
|
||||||
#define FUZZ_IIR_BITS 1
|
#define FUZZ_IIR_BITS 1
|
||||||
|
@ -54,12 +61,12 @@
|
||||||
#define MINIMUM_AMP_FOR_NOTE_TO_DISAPPEAR 64
|
#define MINIMUM_AMP_FOR_NOTE_TO_DISAPPEAR 64
|
||||||
|
|
||||||
|
|
||||||
|
//This prevents compilation of any floating-point code, but it does come with
|
||||||
|
//an added restriction: Both DFREQ and BASE_FREQ must be #defined to be
|
||||||
|
//constants.
|
||||||
|
#define PRECOMPUTE_FREQUENCY_TABLE
|
||||||
|
|
||||||
#ifdef USE_32DFT
|
|
||||||
#include "DFT32.h"
|
#include "DFT32.h"
|
||||||
#else
|
|
||||||
#include "dft.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern uint16_t folded_bins[]; //[FIXBPERO] <- The folded fourier output.
|
extern uint16_t folded_bins[]; //[FIXBPERO] <- The folded fourier output.
|
||||||
extern uint16_t fuzzed_bins[]; //[FIXBINS] <- The Full DFT after IIR, Blur and Taper
|
extern uint16_t fuzzed_bins[]; //[FIXBINS] <- The Full DFT after IIR, Blur and Taper
|
||||||
|
@ -72,11 +79,14 @@ extern uint16_t note_peak_amps2[]; //[MAXNOTES] (Responds quicker)
|
||||||
extern uint8_t note_jumped_to[]; //[MAXNOTES] When a note combines into another one,
|
extern uint8_t note_jumped_to[]; //[MAXNOTES] When a note combines into another one,
|
||||||
//this records where it went. I.e. if your note just disappeared, check this flag.
|
//this records where it went. I.e. if your note just disappeared, check this flag.
|
||||||
|
|
||||||
void Init();
|
void UpdateFreqs(); //Not user-useful on most systems.
|
||||||
void UpdateFreqs();
|
void HandleFrameInfo(); //Not user-useful on most systems
|
||||||
void HandleFrameInfo();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Call this when starting.
|
||||||
|
void InitColorChord();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#include "embeddedout.h"
|
#include "embeddedout.h"
|
||||||
|
|
||||||
//uint8_t ledArray[NUM_LIN_LEDS]; //Points to which notes correspond to these LEDs
|
//uint8_t ledArray[NUM_LIN_LEDS]; //Points to which notes correspond to these LEDs
|
||||||
|
@ -105,14 +107,14 @@ void UpdateLinearLEDs()
|
||||||
|
|
||||||
if( total_size_all_notes == 0 )
|
if( total_size_all_notes == 0 )
|
||||||
{
|
{
|
||||||
for( j = 0; j < NUM_LIN_LEDS * 3; j++ )
|
for( j = 0; j < USE_NUM_LIN_LEDS * 3; j++ )
|
||||||
{
|
{
|
||||||
ledOut[j] = 0;
|
ledOut[j] = 0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t porportional = (uint32_t)(NUM_LIN_LEDS<<16)/((uint32_t)total_size_all_notes);
|
uint32_t porportional = (uint32_t)(USE_NUM_LIN_LEDS<<16)/((uint32_t)total_size_all_notes);
|
||||||
|
|
||||||
uint16_t total_accounted_leds = 0;
|
uint16_t total_accounted_leds = 0;
|
||||||
|
|
||||||
|
@ -122,7 +124,7 @@ void UpdateLinearLEDs()
|
||||||
total_accounted_leds += porpamps[i];
|
total_accounted_leds += porpamps[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t total_unaccounted_leds = NUM_LIN_LEDS - total_accounted_leds;
|
int16_t total_unaccounted_leds = USE_NUM_LIN_LEDS - total_accounted_leds;
|
||||||
|
|
||||||
int addedlast = 1;
|
int addedlast = 1;
|
||||||
do
|
do
|
||||||
|
@ -151,14 +153,14 @@ void UpdateLinearLEDs()
|
||||||
#if LIN_WRAPAROUND
|
#if LIN_WRAPAROUND
|
||||||
uint16_t midx = 0;
|
uint16_t midx = 0;
|
||||||
uint32_t mqty = 100000000;
|
uint32_t mqty = 100000000;
|
||||||
for( j = 0; j < NUM_LIN_LEDS; j++ )
|
for( j = 0; j < USE_NUM_LIN_LEDS; j++ )
|
||||||
{
|
{
|
||||||
uint32_t dqty;
|
uint32_t dqty;
|
||||||
uint16_t localj;
|
uint16_t localj;
|
||||||
|
|
||||||
dqty = 0;
|
dqty = 0;
|
||||||
localj = j;
|
localj = j;
|
||||||
for( l = 0; l < NUM_LIN_LEDS; l++ )
|
for( l = 0; l < USE_NUM_LIN_LEDS; l++ )
|
||||||
{
|
{
|
||||||
int32_t d = (int32_t)ledFreqOut[localj] - (int32_t)ledFreqOutOld[l];
|
int32_t d = (int32_t)ledFreqOut[localj] - (int32_t)ledFreqOutOld[l];
|
||||||
if( d < 0 ) d *= -1;
|
if( d < 0 ) d *= -1;
|
||||||
|
@ -166,7 +168,7 @@ void UpdateLinearLEDs()
|
||||||
dqty += ( d * d );
|
dqty += ( d * d );
|
||||||
|
|
||||||
localj++;
|
localj++;
|
||||||
if( localj == NUM_LIN_LEDS ) localj = 0;
|
if( localj == USE_NUM_LIN_LEDS ) localj = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dqty < mqty )
|
if( dqty < mqty )
|
||||||
|
@ -183,9 +185,9 @@ void UpdateLinearLEDs()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
j = ledSpin;
|
j = ledSpin;
|
||||||
for( l = 0; l < NUM_LIN_LEDS; l++, j++ )
|
for( l = 0; l < USE_NUM_LIN_LEDS; l++, j++ )
|
||||||
{
|
{
|
||||||
if( j >= NUM_LIN_LEDS ) j = 0;
|
if( j >= USE_NUM_LIN_LEDS ) j = 0;
|
||||||
ledFreqOutOld[l] = ledFreqOut[j];
|
ledFreqOutOld[l] = ledFreqOut[j];
|
||||||
|
|
||||||
uint16_t amp = ledAmpOut[j];
|
uint16_t amp = ledAmpOut[j];
|
||||||
|
@ -208,7 +210,7 @@ void UpdateLinearLEDs()
|
||||||
ledOut[j*3+2] = ( color >>16 ) & 0xff;
|
ledOut[j*3+2] = ( color >>16 ) & 0xff;
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
if( j == NUM_LIN_LEDS ) j = 0;
|
if( j == USE_NUM_LIN_LEDS ) j = 0;
|
||||||
porpamps[i]--;
|
porpamps[i]--;
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
|
||||||
|
|
||||||
#ifndef _EMBEDDEDOUT_H
|
#ifndef _EMBEDDEDOUT_H
|
||||||
#define _EMBEDDEDOUT_H
|
#define _EMBEDDEDOUT_H
|
||||||
|
|
||||||
|
@ -18,12 +20,19 @@
|
||||||
#define NUM_LIN_LEDS 32
|
#define NUM_LIN_LEDS 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LIN_WRAPAROUND
|
#ifndef USE_NUM_LIN_LEDS
|
||||||
#define LIN_WRAPAROUND 0 //Whether the output lights wrap around. (Can't easily run on embedded systems)
|
#define USE_NUM_LIN_LEDS NUM_LIN_LEDS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SORT_NOTES
|
|
||||||
#define SORT_NOTES 0 //Whether the notes will be sorted.
|
#ifndef LIN_WRAPAROUND
|
||||||
|
//Whether the output lights wrap around.
|
||||||
|
//(Can't easily run on embedded systems)
|
||||||
|
#define LIN_WRAPAROUND 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SORT_NOTES
|
||||||
|
#define SORT_NOTES 0 //Whether the notes will be sorted. BUGGY Don't use.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint8_t ledArray[];
|
extern uint8_t ledArray[];
|
||||||
|
|
|
@ -30,7 +30,7 @@ CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) \
|
||||||
-I../embeddedcommon \
|
-I../embeddedcommon \
|
||||||
-Wl,-T,lib/stm32f303.ld
|
-Wl,-T,lib/stm32f303.ld
|
||||||
CFLAGS+=-DDEBUG
|
CFLAGS+=-DDEBUG
|
||||||
CFLAGS+=-DNUM_LIN_LEDS=17 -DDFREQ=12500 -DCCEMBEDDED
|
CFLAGS+=-I.
|
||||||
|
|
||||||
AFLAGS = $(MCFLAGS)
|
AFLAGS = $(MCFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define _ADC_H
|
#define _ADC_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "ccconfig.h"
|
||||||
#define ADCFS DFREQ
|
#define ADCFS DFREQ
|
||||||
#define ADCOVERSAMP 4
|
#define ADCOVERSAMP 4
|
||||||
|
|
||||||
|
|
10
embeddedstm32f303/ccconfig.h
Normal file
10
embeddedstm32f303/ccconfig.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef _CCCONFIG_H
|
||||||
|
#define _CCCONFIG_H
|
||||||
|
|
||||||
|
#define CCEMBEDDED
|
||||||
|
#define NUM_LIN_LEDS 24
|
||||||
|
#define USE_NUM_LIN_LEDS 24
|
||||||
|
#define DFREQ 12500
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -32,7 +32,7 @@ CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) \
|
||||||
-Wl,-T,lib/stm32f407.ld
|
-Wl,-T,lib/stm32f407.ld
|
||||||
|
|
||||||
CFLAGS+=-DDEBUG
|
CFLAGS+=-DDEBUG
|
||||||
CFLAGS+=-DNUM_LIN_LEDS=17 -DDFREQ=12000 -DCCEMBEDDED
|
CFLAGS+=-I.
|
||||||
|
|
||||||
AFLAGS = $(MCFLAGS)
|
AFLAGS = $(MCFLAGS)
|
||||||
|
|
||||||
|
|
10
embeddedstm32f407/ccconfig.h
Normal file
10
embeddedstm32f407/ccconfig.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef _CCCONFIG_H
|
||||||
|
#define _CCCONFIG_H
|
||||||
|
|
||||||
|
#define CCEMBEDDED
|
||||||
|
#define NUM_LIN_LEDS 217
|
||||||
|
#define USE_NUM_LIN_LEDS 217
|
||||||
|
#define DFREQ 12000
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -116,7 +116,7 @@ int main(void)
|
||||||
// it also takes up a bunch of space. No printf = no space wasted in printf.
|
// it also takes up a bunch of space. No printf = no space wasted in printf.
|
||||||
// printf( "Operating at %.3fMHz\n", fv );
|
// printf( "Operating at %.3fMHz\n", fv );
|
||||||
|
|
||||||
Init();
|
InitColorChord();
|
||||||
Configure_PA0();
|
Configure_PA0();
|
||||||
InitMP45DT02();
|
InitMP45DT02();
|
||||||
InitSPI2812();
|
InitSPI2812();
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#ifndef _MP45DT02
|
#ifndef _MP45DT02
|
||||||
#define _MP45DT02
|
#define _MP45DT02
|
||||||
|
|
||||||
|
#include "ccconfig.h"
|
||||||
|
|
||||||
//sampling frequency
|
//sampling frequency
|
||||||
#define FS DFREQ
|
#define FS DFREQ
|
||||||
|
|
Loading…
Reference in a new issue