From f768723eb4fabb24838ff14497130927b53eeda5 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 8 May 2018 00:02:58 -0400 Subject: [PATCH 01/17] add winsock initialization --- colorchord2/DisplayNetwork.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/colorchord2/DisplayNetwork.c b/colorchord2/DisplayNetwork.c index 1a4dac5..6ea00c9 100644 --- a/colorchord2/DisplayNetwork.c +++ b/colorchord2/DisplayNetwork.c @@ -43,6 +43,19 @@ struct DPODriver static void DPOUpdate(void * id, struct NoteFinder*nf) { struct DPODriver * d = (struct DPODriver*)id; +#ifdef WIN32 + static int wsa_did_start; + if( !wsa_did_start ) + { + + WORD wVersionRequested; + WSADATA wsaData; + int err; + wVersionRequested = MAKEWORD(2, 2); + err = WSAStartup(wVersionRequested, &wsaData); + } +#endif + int i, j; if( strcmp( d->oldaddress, d->address ) != 0 || d->socket == -1 || d->oldport != d->port ) From fd61a36f16e10f8143ad860f1c69566a28860a4b Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 8 May 2018 00:04:11 -0400 Subject: [PATCH 02/17] bump makefile --- colorchord2/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/colorchord2/Makefile b/colorchord2/Makefile index e1c9ad3..2a74f53 100644 --- a/colorchord2/Makefile +++ b/colorchord2/Makefile @@ -6,20 +6,20 @@ SOUND:=sound.o sound_alsa.o sound_pulse.o sound_null.o OUTS := OutputVoronoi.o DisplayArray.o OutputLinear.o DisplayPie.o DisplayNetwork.o DisplayUSB2812.o DisplayDMX.o OutputProminent.o RecorderPlugin.o OutputCells.o WINGCC:= i686-w64-mingw32-gcc -WINGCCFLAGS:= -g -DICACHE_FLASH_ATTR= -I../embeddedcommon -I. -O1 #-O2 -Wl,--relax -Wl,--gc-sections -ffunction-sections -fdata-sections +WINGCCFLAGS:= -s -DICACHE_FLASH_ATTR= -I../embeddedcommon -I. -O1 #-O2 -Wl,--relax -Wl,--gc-sections -ffunction-sections -fdata-sections WINLDFLAGS:=-lwinmm -lgdi32 -lws2_32 RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse -CFLAGS:=-g -Os -flto -Wall -ffast-math -I../embeddedcommon -I. -DICACHE_FLASH_ATTR= +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 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 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 configs.c +colorchord.exe : os_generic.c main.c dft.c decompose.c filter.c color.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 OutputProminent.c DisplayArray.c OutputLinear.c DisplayPie.c DisplayNetwork.c hook.c RecorderPlugin.c ../embeddedcommon/DFT32.c OutputCells.c configs.c $(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS) From df19f5a5f74d766ca0f29176303e9588e7f9354a Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 8 May 2018 00:04:33 -0400 Subject: [PATCH 03/17] bump netlight --- colorchord2/netlight-irxmit.conf | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/colorchord2/netlight-irxmit.conf b/colorchord2/netlight-irxmit.conf index 2211bac..78fdadd 100644 --- a/colorchord2/netlight-irxmit.conf +++ b/colorchord2/netlight-irxmit.conf @@ -1,7 +1,8 @@ -outdrivers = DisplayArray,DisplayNetwork, OutputProminent +outdrivers = DisplayNetwork, OutputProminent ##DisplayArray, light_siding = 1.0 #Turn this to ~1.9 for more uniformity, ~1.0 for less. leds = 1 satamp = 1.600 +showfps = 1 is_loop=0 led_floor = .1 #Turn to .25 for more uniformity, .1 for less. #note_attach_amp_iir = .3 #.3000 @@ -12,11 +13,16 @@ steady_bright = 0 #dft_q = 20.0000 #dft_speedup = 1000.0000 -sourcename = alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor +sourcename = +#alsa_output.pci-0000_00_1b.0.analog-stereo.monitor +# home: alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor skipfirst = 1 firstval = 0 port = 7777 -address = 192.168.11.143 +address = 10.0.0.167 +#192.168.4.1 +#192.168.11.143 +headless=0 slope=.10 amplify=.3 @@ -25,3 +31,4 @@ amplify=.3 lightx = 20 lighty = 20 +cpu_autolimit_interval = .01 From 585881113e4032332116d154673492aaaa55bff7 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 8 May 2018 00:04:49 -0400 Subject: [PATCH 04/17] add autolimitingo --- colorchord2/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/colorchord2/main.c b/colorchord2/main.c index 5d782ac..981df57 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -49,6 +49,7 @@ int set_screenx = 640; REGISTER_PARAM( set_screenx, PAINT ); int set_screeny = 480; REGISTER_PARAM( set_screeny, PAINT ); char sound_source[16]; REGISTER_PARAM( sound_source, PABUFFER ); int cpu_autolimit = 1; REGISTER_PARAM( cpu_autolimit, PAINT ); +float cpu_autolimit_interval = 0.016; REGISTER_PARAM( cpu_autolimit_interval, PAFLOAT ); int sample_channel = -1;REGISTER_PARAM( sample_channel, PAINT ); int showfps = 0; REGISTER_PARAM( showfps, PAINT ); @@ -432,8 +433,8 @@ int main(int argc, char ** argv) if( cpu_autolimit ) { - SecToWait = .016 - ( ThisTime - LastFrameTime ); - LastFrameTime += .016; + SecToWait = cpu_autolimit_interval - ( ThisTime - LastFrameTime ); + LastFrameTime += cpu_autolimit_interval; if( SecToWait < -.1 ) LastFrameTime = ThisTime - .1; if( SecToWait > 0 ) OGUSleep( (int)( SecToWait * 1000000 ) ); From e990fadce805f467cb0275efd8a2fd203aaa342c Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 8 May 2018 00:47:53 -0400 Subject: [PATCH 05/17] Bump shmtest --- colorchord2/shmtest.conf | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/colorchord2/shmtest.conf b/colorchord2/shmtest.conf index a6dc6ed..9d001fc 100644 --- a/colorchord2/shmtest.conf +++ b/colorchord2/shmtest.conf @@ -6,7 +6,10 @@ set_screenx = 720 set_screeny = 480 sample_channel = -1 -sourcename = alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2.monitor +sourcename =alsa_output.pci-0000_00_1b.0.analog-stereo.monitor +# alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2.monitor (On desktop) + + #alsa_output.pci-0000_00_1f.3.analog-stereo.monitor #default # alsa_output.pci-0000_00_1b.0.analog-stereo.monitor @@ -39,10 +42,10 @@ shm_notes = /ccnotes lightx = 20 lighty = 4 fromsides = 1 -leds = 120 -qtyamp = 120 +leds = 14 +qtyamp = 20 -satamp = 2.800 +satamp = 4.800 amppow = 2.510 distpow = 1.500 From 8c7600117cac22cf401e11a453685468485f8fde Mon Sep 17 00:00:00 2001 From: cnlohr Date: Tue, 8 May 2018 00:48:29 -0400 Subject: [PATCH 06/17] make shmtest headless --- colorchord2/shmtest.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/colorchord2/shmtest.conf b/colorchord2/shmtest.conf index 9d001fc..d18986d 100644 --- a/colorchord2/shmtest.conf +++ b/colorchord2/shmtest.conf @@ -1,4 +1,5 @@ cpu_autolimit = 1 +headless=1 #General GUI properties. title = PA Test From cf4782813e3c038013630c3aa79cd0cf08296ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Here=C3=B1=C3=BA?= Date: Sat, 12 May 2018 19:08:36 -0300 Subject: [PATCH 07/17] Typo on paragraph #038 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 354de8f..04dc787 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ ColorChord 2 running a voronoi diagram with Mayhem's Dr. Rocker Current State of Affairs ------------------------ -Currently, ColorChord 2 is designed to run on Linux or Windows. It's not particularly tied to an architecture, but does pretty much need a dedicated FPU to achieve any decent performance. Right now there aren't very many output options available for it. The most interesting one used for debugging is a vornoi-diagram-like thing called "DisplayShapeDriver." +Currently, ColorChord 2 is designed to run on Linux or Windows. It's not particularly tied to an architecture, but does pretty much need a dedicated FPU to achieve any decent performance. Right now there aren't very many output options available for it. The most interesting one used for debugging is a voronoi-diagram-like thing called "DisplayShapeDriver." ColorChord: Embedded -------------------- -There is work on an embedded version of ColorChord, which avoids floating point operations anywhere in the output pipeline. Though I have made efforts to port it to AVRs, it doesn't seem feasable to operate on AVRs without some shifty tricks which I'd like to avoid, so I have retargeted my efforts to 32-bit systems, such as the STM32F303, STM32F407, and (somehow) the ESP8266. ColorChord Embedded uses a different codebase, located in the [embeddedcommon](embeddedcommon/) and distributed among the various embedded* folders. +There is work on an embedded version of ColorChord, which avoids floating point operations anywhere in the output pipeline. Though I have made efforts to port it to AVRs, it doesn't seem feasable to operate on AVRs without some shifty tricks which I'd like to avoid, so I have retargeted my efforts to 32-bit systems, such as the STM32F303, STM32F407, and (somehow) the ESP8266. ColorChord Embedded uses a different codebase, located in the [embeddedcommon](/embeddedcommon) and distributed among the various embedded* folders. Building with Linux From 7910c7e02918290ce2afdf91d6aa8426ba82c9b0 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Sun, 20 May 2018 21:50:29 -0400 Subject: [PATCH 08/17] Bump versions - add file writer for USB keyboard --- colorchord2/DisplayFileWrite.c | 115 +++++++++++++++++++++++++++++ colorchord2/Makefile | 2 +- colorchord2/keyboard_rgb_test.conf | 59 +++++++++++++++ colorchord2/main.c | 6 +- colorchord2/shmtest.conf | 5 +- 5 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 colorchord2/DisplayFileWrite.c create mode 100644 colorchord2/keyboard_rgb_test.conf diff --git a/colorchord2/DisplayFileWrite.c b/colorchord2/DisplayFileWrite.c new file mode 100644 index 0000000..3c049d0 --- /dev/null +++ b/colorchord2/DisplayFileWrite.c @@ -0,0 +1,115 @@ +//Copyright 2015 <>< Charles Lohr under the ColorChord License. + +#include "outdrivers.h" +#include "notefinder.h" +#include +#include "parameters.h" +#include +#include +#include +#include "color.h" +#include "DrawFunctions.h" +#include +#include /* For mode constants */ +#include /* For O_* constants */ +#include + +extern struct NoteFinder * nf; + +#ifndef O_DIRECT + #define O_DIRECT 00040000 +#endif + +struct FileWriteDriver +{ + int lights_file; + int total_leds; + int inflate_to_u32; + int asynchronous; + uint32_t pass_buffer[MAX_LEDS]; + og_thread_t rt_thread; +}; + +static void * LightsWrite( void * v ) +{ + struct FileWriteDriver * d = (struct FileWriteDriver *)v; + while(1) + { + + + if( d->lights_file > 0 ) + { + int btos = ((d->inflate_to_u32)?4:3)*d->total_leds; + int r = write( d->lights_file, d->pass_buffer, btos ); + if( r != btos ) goto fail_write; + } + else + { + const char * lightsfile = GetParameterS( "lightsfile", 0 ); + if( lightsfile ) + { + d->lights_file = open( lightsfile, O_WRONLY ); + if( d->lights_file <= 0 ) + { + fprintf( stderr, "Error: Can't open \"%s\" (%d)\n", lightsfile, d->lights_file ); + } + else + { + fprintf( stderr, "File %s opened OK\n", lightsfile ); + } + } + } + continue; + fail_write: + fprintf( stderr, "File writing fault\n" ); + close( d->lights_file ); + d->lights_file = 0; + } +} + +static void FileWriteUpdate(void * id, struct NoteFinder*nf) +{ + struct FileWriteDriver * d = (struct FileWriteDriver*)id; + + + if( !d->inflate_to_u32 ) + { + memcpy( d->pass_buffer, OutLEDs, d->total_leds*3 ); + } + else + { + int i; + for( i = 0; i < d->total_leds; i++ ) + { + uint8_t * ol = &OutLEDs[i*3]; + d->pass_buffer[i] = ol[0] | (ol[1]<<8) | (ol[2]<<16) | 0xff000000; + } + } + +} + +static void FileWriteParams(void * id ) +{ + struct FileWriteDriver * d = (struct FileWriteDriver*)id; + + d->total_leds = 300; RegisterValue( "leds", PAINT, &d->total_leds, sizeof( d->total_leds )); + d->inflate_to_u32 = 1; RegisterValue( "inflate_to_u32", PAINT, &d->inflate_to_u32, sizeof( d->inflate_to_u32 )); + d->asynchronous = 1; RegisterValue( "file_async", PAINT, &d->asynchronous, sizeof( d->asynchronous )); +} + +static struct DriverInstances * DisplayFileWrite(const char * parameters) +{ + struct DriverInstances * ret = malloc( sizeof( struct DriverInstances ) ); + struct FileWriteDriver * d = ret->id = malloc( sizeof( struct FileWriteDriver ) ); + memset( d, 0, sizeof( struct FileWriteDriver ) ); + ret->Func = FileWriteUpdate; + ret->Params = FileWriteParams; + FileWriteParams( d ); + printf( "Loaded DisplayFileWrite\n" ); + d->rt_thread = OGCreateThread( LightsWrite, d ); + return ret; +} + +REGISTER_OUT_DRIVER(DisplayFileWrite); + + diff --git a/colorchord2/Makefile b/colorchord2/Makefile index 64d16a8..f393fc3 100644 --- a/colorchord2/Makefile +++ b/colorchord2/Makefile @@ -3,7 +3,7 @@ all : colorchord RAWDRAW:=DrawFunctions.o XDriver.o SOUND:=sound.o sound_alsa.o sound_pulse.o sound_null.o -OUTS := OutputVoronoi.o DisplayArray.o OutputLinear.o DisplayPie.o DisplayNetwork.o DisplayUSB2812.o DisplayDMX.o OutputProminent.o RecorderPlugin.o DisplayHIDAPI.o hidapi.o OutputCells.o DisplaySHM.o +OUTS := OutputVoronoi.o DisplayArray.o OutputLinear.o DisplayPie.o DisplayNetwork.o DisplayUSB2812.o DisplayDMX.o OutputProminent.o RecorderPlugin.o DisplayHIDAPI.o hidapi.o OutputCells.o DisplaySHM.o DisplayFileWrite.o WINGCC:= i686-w64-mingw32-gcc diff --git a/colorchord2/keyboard_rgb_test.conf b/colorchord2/keyboard_rgb_test.conf new file mode 100644 index 0000000..311425a --- /dev/null +++ b/colorchord2/keyboard_rgb_test.conf @@ -0,0 +1,59 @@ +# This is the keyboard test for Clevo and PowerSpec 1510 and 1710 laptops, using the kernel module found here: +# https://github.com/cnlohr/clevo_xsm_wmi + +cpu_autolimit = 1 +headless=0 + +#General GUI properties. +title = PA Test +set_screenx = 720 +set_screeny = 480 +in_amplitude = 1.0 + +sample_channel = -1 +sourcename = alsa_output.pci-0000_00_1f.3.analog-stereo.monitor +#bluez_sink.40_EF_4C_CA_A4_5D.monitor +#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor +## alsa_output.pci-0000_00_1b.0.analog-stereo.monitor +# alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2.monitor (On desktop) + + +#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor +#default +# alsa_output.pci-0000_00_1b.0.analog-stereo.monitor +#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor << New laptop +#use pactl list | grep pci- | grep monitor + + +#How many bins a note can jump from frame to frame to be considered a slide. +#this is used to prevent notes from popping in and out a lot. +note_combine_distance = 0.5000 +note_jumpability = 1.8000 +note_minimum_new_distribution_value = 0.0200 +note_out_chop = 0.05000 + +#compress_coefficient = 4.0 +#compress_exponent = .5 + + +#======================================================================= +#Outputs + + +#DisplayArray +outdrivers = OutputCells, DisplayFileWrite, DisplayArray + +lightsfile = /sys/devices/platform/clevo_xsm_wmi/kb_rgb +inflate_to_u32 = 1 +lightx = 1 +lighty = 3 +fromsides = 1 +leds = 3 +qtyamp = 20 + +satamp = 4.800 +amppow = 2.510 +distpow = 1.500 + + + diff --git a/colorchord2/main.c b/colorchord2/main.c index 0a902de..fa4741f 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -53,6 +53,7 @@ int cpu_autolimit = 1; REGISTER_PARAM( cpu_autolimit, PAINT ); float cpu_autolimit_interval = 0.016; REGISTER_PARAM( cpu_autolimit_interval, PAFLOAT ); int sample_channel = -1;REGISTER_PARAM( sample_channel, PAINT ); int showfps = 0; REGISTER_PARAM( showfps, PAINT ); +float in_amplitude = 1; REGISTER_PARAM( in_amplitude, PAFLOAT ); struct NoteFinder * nf; @@ -133,7 +134,7 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun } fo /= channelin; - sound[soundhead] = fo; + sound[soundhead] = fo*in_amplitude; soundhead = (soundhead+1)%SOUNDCBSIZE; } else @@ -147,7 +148,7 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun //printf( "Sound fault B %d/%d\n", i, samplesr ); - sound[soundhead] = f; + sound[soundhead] = f*in_amplitude; soundhead = (soundhead+1)%SOUNDCBSIZE; } @@ -353,7 +354,6 @@ int main(int argc, char ** argv) int thisy = sound[thissoundhead] * 128 + 128; thissoundhead = (thissoundhead-1+SOUNDCBSIZE)%SOUNDCBSIZE; for( i = 0; i < screenx; i++ ) { - if( thisy < 0 || thisy > 256 ) printf( "%d/%d\n", thisy,thissoundhead ); CNFGTackSegment( i, lasty, i+1, thisy ); lasty = thisy; thisy = sound[thissoundhead] * 128 + 128; thissoundhead = (thissoundhead-1+SOUNDCBSIZE)%SOUNDCBSIZE; diff --git a/colorchord2/shmtest.conf b/colorchord2/shmtest.conf index d18986d..a1dbefb 100644 --- a/colorchord2/shmtest.conf +++ b/colorchord2/shmtest.conf @@ -5,9 +5,12 @@ headless=1 title = PA Test set_screenx = 720 set_screeny = 480 +in_amplitude = 3.0 sample_channel = -1 -sourcename =alsa_output.pci-0000_00_1b.0.analog-stereo.monitor +sourcename = bluez_sink.40_EF_4C_CA_A4_5D.monitor +#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor +## alsa_output.pci-0000_00_1b.0.analog-stereo.monitor # alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2.monitor (On desktop) From f5251a0e4127ce8bb86626937f6cec37021d0c8d Mon Sep 17 00:00:00 2001 From: cnlohr Date: Sun, 20 May 2018 22:24:20 -0400 Subject: [PATCH 09/17] Make asynchronous operation better. --- colorchord2/DisplayFileWrite.c | 10 ++++++++-- colorchord2/keyboard_rgb_test.conf | 7 ++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/colorchord2/DisplayFileWrite.c b/colorchord2/DisplayFileWrite.c index 3c049d0..915a259 100644 --- a/colorchord2/DisplayFileWrite.c +++ b/colorchord2/DisplayFileWrite.c @@ -25,8 +25,10 @@ struct FileWriteDriver int lights_file; int total_leds; int inflate_to_u32; + int file_thread_usleep; int asynchronous; uint32_t pass_buffer[MAX_LEDS]; + volatile int flagchanges; og_thread_t rt_thread; }; @@ -35,8 +37,9 @@ static void * LightsWrite( void * v ) struct FileWriteDriver * d = (struct FileWriteDriver *)v; while(1) { - - + usleep( d->file_thread_usleep ); + if( !d->flagchanges ) continue; + d->flagchanges = 0; if( d->lights_file > 0 ) { int btos = ((d->inflate_to_u32)?4:3)*d->total_leds; @@ -65,6 +68,7 @@ static void * LightsWrite( void * v ) close( d->lights_file ); d->lights_file = 0; } + return 0; } static void FileWriteUpdate(void * id, struct NoteFinder*nf) @@ -85,6 +89,7 @@ static void FileWriteUpdate(void * id, struct NoteFinder*nf) d->pass_buffer[i] = ol[0] | (ol[1]<<8) | (ol[2]<<16) | 0xff000000; } } + d->flagchanges = 1; } @@ -95,6 +100,7 @@ static void FileWriteParams(void * id ) d->total_leds = 300; RegisterValue( "leds", PAINT, &d->total_leds, sizeof( d->total_leds )); d->inflate_to_u32 = 1; RegisterValue( "inflate_to_u32", PAINT, &d->inflate_to_u32, sizeof( d->inflate_to_u32 )); d->asynchronous = 1; RegisterValue( "file_async", PAINT, &d->asynchronous, sizeof( d->asynchronous )); + d->file_thread_usleep = 10000; RegisterValue( "file_thread_usleep", PAINT, &d->file_thread_usleep, sizeof( d->file_thread_usleep )); } static struct DriverInstances * DisplayFileWrite(const char * parameters) diff --git a/colorchord2/keyboard_rgb_test.conf b/colorchord2/keyboard_rgb_test.conf index 311425a..d660bf8 100644 --- a/colorchord2/keyboard_rgb_test.conf +++ b/colorchord2/keyboard_rgb_test.conf @@ -2,7 +2,7 @@ # https://github.com/cnlohr/clevo_xsm_wmi cpu_autolimit = 1 -headless=0 +headless=1 #General GUI properties. title = PA Test @@ -41,7 +41,7 @@ note_out_chop = 0.05000 #DisplayArray -outdrivers = OutputCells, DisplayFileWrite, DisplayArray +outdrivers = OutputCells, DisplayFileWrite # DisplayArray lightsfile = /sys/devices/platform/clevo_xsm_wmi/kb_rgb inflate_to_u32 = 1 @@ -50,8 +50,9 @@ lighty = 3 fromsides = 1 leds = 3 qtyamp = 20 +file_thread_usleep = 18000 -satamp = 4.800 +satamp = 3.00 amppow = 2.510 distpow = 1.500 From 4cdf3ed859458dce3fd5ce2187d1f82dc9ed46ad Mon Sep 17 00:00:00 2001 From: cnlohr Date: Mon, 21 May 2018 00:50:25 -0400 Subject: [PATCH 10/17] Bump style for keyboard --- colorchord2/keyboard_rgb_test.conf | 20 +++++++++++++++----- colorchord2/shmtest.conf | 3 ++- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/colorchord2/keyboard_rgb_test.conf b/colorchord2/keyboard_rgb_test.conf index d660bf8..0fcdfdc 100644 --- a/colorchord2/keyboard_rgb_test.conf +++ b/colorchord2/keyboard_rgb_test.conf @@ -2,7 +2,11 @@ # https://github.com/cnlohr/clevo_xsm_wmi cpu_autolimit = 1 -headless=1 +headless=0 + + +octaves = 5 +base_hz = 82.406889228 #General GUI properties. title = PA Test @@ -35,6 +39,11 @@ note_out_chop = 0.05000 #compress_coefficient = 4.0 #compress_exponent = .5 +How much to slack everything? +note_attach_amp_iir = 0.4500 +note_attach_amp_iir2 = 0.350 +note_attach_freq_iir = 0.3000 + #======================================================================= #Outputs @@ -49,11 +58,12 @@ lightx = 1 lighty = 3 fromsides = 1 leds = 3 -qtyamp = 20 +qtyamp = 5 file_thread_usleep = 18000 - -satamp = 3.00 -amppow = 2.510 +light_siding = 2.0 +timebased=0 +satamp = 1.00 +amppow = 1.010 distpow = 1.500 diff --git a/colorchord2/shmtest.conf b/colorchord2/shmtest.conf index a1dbefb..eca7cd3 100644 --- a/colorchord2/shmtest.conf +++ b/colorchord2/shmtest.conf @@ -8,7 +8,8 @@ set_screeny = 480 in_amplitude = 3.0 sample_channel = -1 -sourcename = bluez_sink.40_EF_4C_CA_A4_5D.monitor +sourcename = alsa_output.pci-0000_00_1f.3.analog-stereo.monitor +#sourcename = bluez_sink.40_EF_4C_CA_A4_5D.monitor #alsa_output.pci-0000_00_1f.3.analog-stereo.monitor ## alsa_output.pci-0000_00_1b.0.analog-stereo.monitor # alsa_output.pci-0000_01_00.1.hdmi-stereo-extra2.monitor (On desktop) From d15f18113bf4a7fbe9758d50623d65dc42b452a9 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Mon, 21 May 2018 12:51:18 -0400 Subject: [PATCH 11/17] Use semaphores for better performance. --- colorchord2/DisplayFileWrite.c | 11 +++++------ colorchord2/keyboard_rgb_test.conf | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/colorchord2/DisplayFileWrite.c b/colorchord2/DisplayFileWrite.c index 915a259..ed1e2ce 100644 --- a/colorchord2/DisplayFileWrite.c +++ b/colorchord2/DisplayFileWrite.c @@ -28,8 +28,8 @@ struct FileWriteDriver int file_thread_usleep; int asynchronous; uint32_t pass_buffer[MAX_LEDS]; - volatile int flagchanges; og_thread_t rt_thread; + og_sema_t rt_sema; }; static void * LightsWrite( void * v ) @@ -37,9 +37,7 @@ static void * LightsWrite( void * v ) struct FileWriteDriver * d = (struct FileWriteDriver *)v; while(1) { - usleep( d->file_thread_usleep ); - if( !d->flagchanges ) continue; - d->flagchanges = 0; + OGLockSema( d->rt_sema ); if( d->lights_file > 0 ) { int btos = ((d->inflate_to_u32)?4:3)*d->total_leds; @@ -75,7 +73,7 @@ static void FileWriteUpdate(void * id, struct NoteFinder*nf) { struct FileWriteDriver * d = (struct FileWriteDriver*)id; - + if( OGGetSema( d->rt_sema ) > 0 ) return; if( !d->inflate_to_u32 ) { memcpy( d->pass_buffer, OutLEDs, d->total_leds*3 ); @@ -89,7 +87,7 @@ static void FileWriteUpdate(void * id, struct NoteFinder*nf) d->pass_buffer[i] = ol[0] | (ol[1]<<8) | (ol[2]<<16) | 0xff000000; } } - d->flagchanges = 1; + OGUnlockSema( d->rt_sema ); } @@ -112,6 +110,7 @@ static struct DriverInstances * DisplayFileWrite(const char * parameters) ret->Params = FileWriteParams; FileWriteParams( d ); printf( "Loaded DisplayFileWrite\n" ); + d->rt_sema = OGCreateSema(); d->rt_thread = OGCreateThread( LightsWrite, d ); return ret; } diff --git a/colorchord2/keyboard_rgb_test.conf b/colorchord2/keyboard_rgb_test.conf index 0fcdfdc..4d48d5d 100644 --- a/colorchord2/keyboard_rgb_test.conf +++ b/colorchord2/keyboard_rgb_test.conf @@ -1,9 +1,9 @@ # This is the keyboard test for Clevo and PowerSpec 1510 and 1710 laptops, using the kernel module found here: # https://github.com/cnlohr/clevo_xsm_wmi +cpu_autolimit_interval=.002 cpu_autolimit = 1 -headless=0 - +headless=1 octaves = 5 base_hz = 82.406889228 From 5acd811a83a922caee414bad04e6188a1622cb93 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Mon, 21 May 2018 12:52:19 -0400 Subject: [PATCH 12/17] Fix spacing --- colorchord2/DisplayFileWrite.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colorchord2/DisplayFileWrite.c b/colorchord2/DisplayFileWrite.c index ed1e2ce..e6fa123 100644 --- a/colorchord2/DisplayFileWrite.c +++ b/colorchord2/DisplayFileWrite.c @@ -29,7 +29,7 @@ struct FileWriteDriver int asynchronous; uint32_t pass_buffer[MAX_LEDS]; og_thread_t rt_thread; - og_sema_t rt_sema; + og_sema_t rt_sema; }; static void * LightsWrite( void * v ) @@ -37,7 +37,7 @@ static void * LightsWrite( void * v ) struct FileWriteDriver * d = (struct FileWriteDriver *)v; while(1) { - OGLockSema( d->rt_sema ); + OGLockSema( d->rt_sema ); if( d->lights_file > 0 ) { int btos = ((d->inflate_to_u32)?4:3)*d->total_leds; From 268ce8062b885b032f5f16a7f676c9b41d313d48 Mon Sep 17 00:00:00 2001 From: Paul Hendrix Date: Fri, 25 May 2018 21:00:41 +0200 Subject: [PATCH 13/17] Add libudev-dev to dependencies Compilation would otherwise fail with ``` hidapi.c:2161:21: fatal error: libudev.h: No such file or directory compilation terminated. : recipe for target 'hidapi.o' failed make: *** [hidapi.o] Error 1 ``` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04dc787..a368eb2 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Building with Linux ----------------- Use `apt-get` to install the following packages for Debian/Ubuntu/Mint: ``` -apt-get install libpulse-dev libasound2-dev libx11-dev libxext-dev libxinerama-dev libusb-1.0-0-dev +apt-get install libpulse-dev libasound2-dev libx11-dev libxext-dev libxinerama-dev libusb-1.0-0-dev libudev-dev ``` To make colorchord, type: From 9a89be3aa8ae366df85ecb9f8cb611ad202a416e Mon Sep 17 00:00:00 2001 From: HeMe2 Date: Sat, 30 Jun 2018 15:28:51 +0200 Subject: [PATCH 14/17] remove obsolete drawing in OutputVoronoi module Fixes issue, that voronoi output could not be used in headless mode! --- colorchord2/OutputVoronoi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/colorchord2/OutputVoronoi.c b/colorchord2/OutputVoronoi.c index 31390b3..2eb20c1 100644 --- a/colorchord2/OutputVoronoi.c +++ b/colorchord2/OutputVoronoi.c @@ -8,7 +8,6 @@ #include #include "color.h" #include -#include "DrawFunctions.h" //Uses: note_amplitudes2[note] for how many lights to use. //Uses: note_amplitudes_out[note] for how bright it should be. @@ -135,7 +134,6 @@ static void DPOUpdate(void * id, struct NoteFinder*nf) OutLEDs[led*3+2] = ( color >> 16 ) & 0xff; led++; } - CNFGColor ( 0xffffff ); } static void DPOParams(void * id ) From 6d4409b70a8ecd938b1b085c60e650cdab8bdec9 Mon Sep 17 00:00:00 2001 From: CNLohr Date: Tue, 3 Jul 2018 16:45:39 -0400 Subject: [PATCH 15/17] Update default.conf Change to -1 to make it more universally functional on Windows. --- colorchord2/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/default.conf b/colorchord2/default.conf index 41f76a5..293438c 100644 --- a/colorchord2/default.conf +++ b/colorchord2/default.conf @@ -18,7 +18,7 @@ play = 0 rec = 1 channels = 2 samplerate = 44100 -wininput = 1 +wininput = -1 #Compiled version will default this. #sound_source = ALSA From 8dc3110c5614fd8a055290fe1b4a1b356f3419bd Mon Sep 17 00:00:00 2001 From: CNLohr Date: Sun, 15 Jul 2018 23:31:34 -0400 Subject: [PATCH 16/17] Update default.conf --- colorchord2/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/default.conf b/colorchord2/default.conf index 293438c..c8d2a9d 100644 --- a/colorchord2/default.conf +++ b/colorchord2/default.conf @@ -59,7 +59,7 @@ octaves = 5 # 2 = DFT Progressive Integer # 3 = DFT Progressive Integer Skippy # 4 = Integer, 32-Bit, Progressive, Skippy. -do_progressive_dft = 4fa +do_progressive_dft = 4 filter_iter = 2 From bcc3347893f6145dcfa7bc7d8b9d5c94ab6108d1 Mon Sep 17 00:00:00 2001 From: CNLohr Date: Sun, 22 Jul 2018 19:35:04 -0400 Subject: [PATCH 17/17] Update ws2812_i2s.c --- embedded8266/user/ws2812_i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/embedded8266/user/ws2812_i2s.c b/embedded8266/user/ws2812_i2s.c index 2149e4b..f2e018b 100644 --- a/embedded8266/user/ws2812_i2s.c +++ b/embedded8266/user/ws2812_i2s.c @@ -249,7 +249,7 @@ static unsigned int i2sBlock[WS_BLOCKSIZE/4]; //DMA underrun counter -#ifdef USE_2812_INTERRUPTS +#if USE_2812_INTERRUPTS volatile uint8_t ws2812_dma_complete; @@ -496,7 +496,7 @@ void ws2812_push( uint8_t * buffer, uint16_t buffersize ) } #endif -#ifdef USE_2812_INTERRUPTS +#if USE_2812_INTERRUPTS uint16_t leftover = buffersize & 0x1f; if( leftover ) leftover = 32 - leftover;