Update copyright noteices, etc.

This commit is contained in:
cnlohr 2015-07-29 01:56:18 -04:00
parent 95c0c4837b
commit bba28c688f
55 changed files with 201 additions and 41 deletions

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include "notefinder.h"
#include <stdio.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include "notefinder.h"
#include <stdio.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include "notefinder.h"
#include <stdio.h>

View file

@ -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 CONSIDER DUMPING

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include "notefinder.h"
#include <stdio.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include "notefinder.h"
#include <stdio.h>

View file

@ -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
a copy of this software and associated documentation files (the

View file

@ -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
#include "outdrivers.h"
#include "notefinder.h"
#include <stdio.h>

View file

@ -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.
#include "outdrivers.h"

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include "notefinder.h"
#include <stdio.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include <stdio.h>
#include <stdlib.h>

View file

@ -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 <stdlib.h>
#include <string.h>

View file

@ -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
#define _CHASH_H

View file

@ -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 <math.h>

View file

@ -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
#define _COLOR_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "decompose.h"
#include <stdio.h>
#include <math.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _DECOMPOSE_H
#define _DECOMPOSE_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "dft.h"
#include <math.h>
#include <stdio.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _DFT_H
#define _DFT_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "filter.h"
#include <math.h>
#include <string.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _FILTER_H
#define _FILTER_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "hook.h"
struct KeyEvent

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _KEYHOOK_H
#define _KEYHOOK_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include <ctype.h>
#include "color.h"
#include <math.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "notefinder.h"
#include "parameters.h"
#include <stdio.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _NOTEFINDER_H
#define _NOTEFINDER_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the NewBSD OR MIT/x11 License.
#include "os_generic.h"

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the NewBSD or MIT/x11 License.
#ifndef _OS_GENERIC_H
#define _OS_GENERIC_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "outdrivers.h"
#include <string.h>
#include "parameters.h"

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
//Output drivers, used for outputting lights, etc... However, this technique
//may be used for unrelated-to-output plugins.

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "parameters.h"
#include "chash.h"
#include <string.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _PARAMETERS_H
#define _PARAMETERS_H

View file

@ -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 <string.h>
#include <stdio.h>

View file

@ -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
#define _SORT_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "sound.h"
#include <string.h>
#include <stdio.h>

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _SOUND_H
#define _SOUND_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "sound.h"
#include "os_generic.h"
#include "parameters.h"

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "sound.h"
#include "os_generic.h"
#include <stdlib.h>

View file

@ -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.

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include <windows.h>
#include "parameters.h"
#include "sound.h"

View file

@ -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 <math.h>
#include <stdlib.h>

View file

@ -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
#define _UTIL_H

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "DFT32.h"
#include <string.h>

View file

@ -1,6 +1,9 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _DFT32_H
#define _DFT32_H
#include <ccconfig.h>
#include <stdint.h>
//A 32-bit version of the DFT used for ColorChord.

View file

@ -1,5 +1,8 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "embeddednf.h"
#include <stdio.h>
#include <string.h>
uint16_t folded_bins[FIXBPERO];
uint16_t fuzzed_bins[FIXBINS];
@ -9,6 +12,7 @@ uint16_t note_peak_amps2[MAXNOTES];
uint8_t note_jumped_to[MAXNOTES];
#ifndef PRECOMPUTE_FREQUENCY_TABLE
static const float bf_table[24] = {
1.000000, 1.029302, 1.059463, 1.090508, 1.122462, 1.155353,
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)]))
void UpdateFreqs()
{
#ifndef PRECOMPUTE_FREQUENCY_TABLE
uint16_t fbins[FIXBPERO];
int i;
@ -55,8 +62,18 @@ void UpdateFreqs()
for( i = 0; i < FIXBPERO; i++ )
{
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
UpdateBins32( fbins );
@ -65,7 +82,7 @@ void UpdateFreqs()
#endif
}
void Init()
void InitColorChord()
{
int i;
//Set up and initialize arrays.
@ -76,15 +93,8 @@ void Init()
note_peak_amps2[i] = 0;
}
for( i = 0; i < FIXBPERO; i++ )
{
folded_bins[i] = 0;
}
for( i = 0; i < FIXBINS; i++ )
{
fuzzed_bins[i] = 0;
}
memset( folded_bins, 0, sizeof( folded_bins ) );
memset( fuzzed_bins, 0, sizeof( fuzzed_bins ) );
//Step 1: Initialize the Integer DFT.
#ifdef USE_32DFT
@ -102,10 +112,7 @@ void HandleFrameInfo()
{
int i, j, k;
uint8_t hitnotes[MAXNOTES];
for( i = 0; i < MAXNOTES; i++ )
{
hitnotes[i] = 0;
}
memset( hitnotes, 0, sizeof( hitnotes ) );
#ifdef USE_32DFT
uint16_t * strens;

View file

@ -1,6 +1,10 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _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
//they can multiply quickly, this is the bees knees.
#define USE_32DFT
@ -9,7 +13,10 @@
#define DFREQ 8000
#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.
#define FUZZ_IIR_BITS 1
@ -54,12 +61,12 @@
#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"
#else
#include "dft.h"
#endif
extern uint16_t folded_bins[]; //[FIXBPERO] <- The folded fourier output.
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,
//this records where it went. I.e. if your note just disappeared, check this flag.
void Init();
void UpdateFreqs();
void HandleFrameInfo();
void UpdateFreqs(); //Not user-useful on most systems.
void HandleFrameInfo(); //Not user-useful on most systems
//Call this when starting.
void InitColorChord();
#endif

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#include "embeddedout.h"
//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 )
{
for( j = 0; j < NUM_LIN_LEDS * 3; j++ )
for( j = 0; j < USE_NUM_LIN_LEDS * 3; j++ )
{
ledOut[j] = 0;
}
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;
@ -122,7 +124,7 @@ void UpdateLinearLEDs()
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;
do
@ -151,14 +153,14 @@ void UpdateLinearLEDs()
#if LIN_WRAPAROUND
uint16_t midx = 0;
uint32_t mqty = 100000000;
for( j = 0; j < NUM_LIN_LEDS; j++ )
for( j = 0; j < USE_NUM_LIN_LEDS; j++ )
{
uint32_t dqty;
uint16_t localj;
dqty = 0;
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];
if( d < 0 ) d *= -1;
@ -166,7 +168,7 @@ void UpdateLinearLEDs()
dqty += ( d * d );
localj++;
if( localj == NUM_LIN_LEDS ) localj = 0;
if( localj == USE_NUM_LIN_LEDS ) localj = 0;
}
if( dqty < mqty )
@ -183,9 +185,9 @@ void UpdateLinearLEDs()
#endif
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];
uint16_t amp = ledAmpOut[j];
@ -208,7 +210,7 @@ void UpdateLinearLEDs()
ledOut[j*3+2] = ( color >>16 ) & 0xff;
j++;
if( j == NUM_LIN_LEDS ) j = 0;
if( j == USE_NUM_LIN_LEDS ) j = 0;
porpamps[i]--;
}
}*/

View file

@ -1,3 +1,5 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#ifndef _EMBEDDEDOUT_H
#define _EMBEDDEDOUT_H
@ -18,12 +20,19 @@
#define NUM_LIN_LEDS 32
#endif
#ifndef LIN_WRAPAROUND
#define LIN_WRAPAROUND 0 //Whether the output lights wrap around. (Can't easily run on embedded systems)
#ifndef USE_NUM_LIN_LEDS
#define USE_NUM_LIN_LEDS NUM_LIN_LEDS
#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
extern uint8_t ledArray[];

View file

@ -30,7 +30,7 @@ CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) \
-I../embeddedcommon \
-Wl,-T,lib/stm32f303.ld
CFLAGS+=-DDEBUG
CFLAGS+=-DNUM_LIN_LEDS=17 -DDFREQ=12500 -DCCEMBEDDED
CFLAGS+=-I.
AFLAGS = $(MCFLAGS)

View file

@ -2,7 +2,7 @@
#define _ADC_H
#include <stdint.h>
#include "ccconfig.h"
#define ADCFS DFREQ
#define ADCOVERSAMP 4

View 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

View file

@ -32,7 +32,7 @@ CFLAGS = $(MCFLAGS) $(OPTIMIZE) $(DEFS) \
-Wl,-T,lib/stm32f407.ld
CFLAGS+=-DDEBUG
CFLAGS+=-DNUM_LIN_LEDS=17 -DDFREQ=12000 -DCCEMBEDDED
CFLAGS+=-I.
AFLAGS = $(MCFLAGS)

View 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

View file

@ -116,7 +116,7 @@ int main(void)
// it also takes up a bunch of space. No printf = no space wasted in printf.
// printf( "Operating at %.3fMHz\n", fv );
Init();
InitColorChord();
Configure_PA0();
InitMP45DT02();
InitSPI2812();

View file

@ -3,6 +3,7 @@
#ifndef _MP45DT02
#define _MP45DT02
#include "ccconfig.h"
//sampling frequency
#define FS DFREQ