diff --git a/colorchord2/DisplayNetwork.c b/colorchord2/DisplayNetwork.c index 4528619..ed91d07 100644 --- a/colorchord2/DisplayNetwork.c +++ b/colorchord2/DisplayNetwork.c @@ -80,9 +80,13 @@ static void DPOUpdate(void * id, struct NoteFinder*nf) uint8_t buffer[MAX_BUFFER]; uint8_t lbuff[MAX_BUFFER]; + d->firstval = 0; i = 0; while( i < d->skipfirst ) + { + lbuff[i] = d->firstval; buffer[i++] = d->firstval; + } if( d->leds * 3 + i >= MAX_BUFFER ) d->leds = (MAX_BUFFER-1)/3; @@ -134,7 +138,6 @@ static void DPOUpdate(void * id, struct NoteFinder*nf) { memcpy( buffer, lbuff, i ); } - int r = sendto( d->socket, buffer, i, MSG_NOSIGNAL,(const struct sockaddr *) &d->servaddr, sizeof( d->servaddr ) ); if( r < 0 ) { diff --git a/colorchord2/Makefile b/colorchord2/Makefile index 70e3dba..7cf9d83 100644 --- a/colorchord2/Makefile +++ b/colorchord2/Makefile @@ -16,7 +16,7 @@ LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse CFLAGS:=-g -O0 -flto -Wall -ffast-math -I../embeddedcommon -I. -DICACHE_FLASH_ATTR= 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 hook.o ../embeddedcommon/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 hook.o ../embeddedcommon/DFT32.o configs.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 hook.c RecorderPlugin.c ../embeddedcommon/DFT32.c OutputCells.c diff --git a/colorchord2/double_pie_voice.conf b/colorchord2/double_pie_voice.conf index a8d574c..192a0fb 100644 --- a/colorchord2/double_pie_voice.conf +++ b/colorchord2/double_pie_voice.conf @@ -2,13 +2,15 @@ outdrivers = DisplayPie,DisplayNetwork,OutputLinear,RecorderPlugin leds = 48 -light_siding = 2.5 #Turn this to ~1.9 for more uniformity, ~1.0 for less. +light_siding = 2.5 #2.5 #Turn this to ~1.9 for more uniformity, ~1.0 for less. satamp = 1.600 is_loop=1 led_floor = .1 #Turn to .25 for more uniformity, .1 for less. steady_bright = 0 - +## TODO: Come Thou Fount is 0 +# Don't forget to tune color balance. "Cloudy" +# 1/30, 4.5 - 800 iso. # For the final note information... How much to slack everything? @@ -25,7 +27,7 @@ port = 7777 address = 192.168.4.1 slope=.10 -amplify=.1 +amplify=.24 lightx = 20 @@ -41,7 +43,7 @@ fliprg = 1 skittlequantity = 24 -led_limit=.4 +led_limit=.5 diff --git a/colorchord2/main.c b/colorchord2/main.c index fe42b98..cc40af4 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -16,8 +16,7 @@ #include "outdrivers.h" #include "parameters.h" #include "hook.h" - -#define NRDEFFILES 10 +#include "configs.h" struct SoundDriver * sd; @@ -35,8 +34,6 @@ double Now = 0; int lastfps; short screenx, screeny; -int gargc; -char ** gargv; struct DriverInstances * outdriver[MAX_OUT_DRIVERS]; @@ -155,95 +152,6 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun } -void LoadFile( const char * filename ) -{ - char * buffer; - int r; - - FILE * f = fopen( filename, "rb" ); - if( !f ) - { - fprintf( stderr, "Warning: cannot open %s.\n", filename ); - } - else - { - fseek( f, 0, SEEK_END ); - int size = ftell( f ); - fseek( f, 0, SEEK_SET ); - buffer = malloc( size + 1 ); - r = fread( buffer, size, 1, f ); - fclose( f ); - buffer[size] = 0; - if( r != 1 ) - { - fprintf( stderr, "Warning: %d bytes read. Expected: %d from file %s\n", r, size, filename ); - } - else - { - SetParametersFromString( buffer ); - } - free( buffer ); - } -} - - -const char * InitialFile[NRDEFFILES]; -double FileTimes[NRDEFFILES]; -int InitialFileCount = 1; - -void SetEnvValues( int force ) -{ - int i; - int hits = 0; - for( i = 0; i < InitialFileCount; i++ ) - { - double ft = OGGetFileTime( InitialFile[i] ); - if( FileTimes[i] != ft ) - { - FileTimes[i] = ft; - hits++; - } - } - - if( !hits && !force ) return; - - //Otherwise, something changed. - - LoadFile( InitialFile[0] ); - - for( i = 1; i < gargc; i++ ) - { - if( strchr( gargv[i], '=' ) != 0 ) - { - printf( "AP: %s\n", gargv[i] ); - SetParametersFromString( gargv[i] ); - } - else - { - printf( "LF: %s\n", gargv[i] ); - LoadFile( gargv[i] ); - } - } -} - -void ProcessArgs() -{ - int i; - for( i = 1; i < gargc; i++ ) - { - if( strchr( gargv[i], '=' ) != 0 ) - { - //A value setting operation - } - else - { - InitialFile[InitialFileCount++] = gargv[i]; - } - } - - SetEnvValues( 1 ); -} - int main(int argc, char ** argv) { int i; @@ -267,9 +175,7 @@ int main(int argc, char ** argv) gargc = argc; gargv = argv; - InitialFile[0] = "default.conf"; - - ProcessArgs(); + SetupConfigs(); //Initialize Rawdraw int frames = 0; @@ -337,10 +243,9 @@ int main(int argc, char ** argv) nf = CreateNoteFinder( sd->spsRec ); - //Once everything was reinitialized, re-read the ini files. SetEnvValues( 1 ); -printf( "OK\n" ); + Now = OGGetAbsoluteTime(); double Last = Now; while(1) diff --git a/colorchord2/netlight.conf b/colorchord2/netlight.conf index 13ee3b5..5a01ad6 100644 --- a/colorchord2/netlight.conf +++ b/colorchord2/netlight.conf @@ -12,6 +12,7 @@ steady_bright = 0 #dft_q = 20.0000 #dft_speedup = 1000.0000 +sourcename = alsa_output.pci-0000_00_1f.3.analog-stereo.monitor skipfirst = 1 firstval = 0 port = 7777 diff --git a/embeddedcommon/DFT32.c b/embeddedcommon/DFT32.c index 75bd1bc..21df4dd 100644 --- a/embeddedcommon/DFT32.c +++ b/embeddedcommon/DFT32.c @@ -325,7 +325,7 @@ void DoDFTProgressive32( float * outbins, float * frequencies, int bins, const f if( FIXBINS != bins ) { - fprintf( stderr, "Error: Bins was reconfigured. skippy requires a constant number of bins.\n" ); + fprintf( stderr, "Error: Bins was reconfigured. skippy requires a constant number of bins (%d != %d).\n", FIXBINS, bins ); return; }