From ee621d9e7570532215feb116d8a6484146a73e14 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:35:57 -0400 Subject: [PATCH 01/23] Added makefile to compile on Windows with clang --- colorchord2/windows/Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 colorchord2/windows/Makefile diff --git a/colorchord2/windows/Makefile b/colorchord2/windows/Makefile new file mode 100644 index 0000000..23983f7 --- /dev/null +++ b/colorchord2/windows/Makefile @@ -0,0 +1,33 @@ +all : colorchord + +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 + +SRCS := ../main.c ../dft.c ../decompose.c ../filter.c ../color.c ../notefinder.c ../util.c ../outdrivers.c +SRCS += ../parameters.c ../chash.c ../OutputVoronoi.c ../OutputProminent.c ../DisplayArray.c +SRCS += ../OutputLinear.c ../DisplayPie.c ../DisplayNetwork.c ../hook.c ../RecorderPlugin.c +SRCS += ../../embeddedcommon/DFT32.c ../OutputCells.c ../configs.c ../hidapi.c ../DisplayHIDAPI.c + +WINGCC:= clang -fcolor-diagnostics + +WINGCCFLAGS:= -g -D_CRT_SECURE_NO_WARNINGS -Wno-deprecated-declarations -DICACHE_FLASH_ATTR= -I../../embeddedcommon -I../cnfa -I../rawdraw -I../ -O1 #-O2 -Wl,--relax -Wl,--gc-sections -ffunction-sections -fdata-sections +WINLDFLAGS:=-lwinmm -lgdi32 -lws2_32 -lsetupapi + +RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext +LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse -ludev -lrt + + +CFLAGS:=-g -O1 -flto -Wall -ffast-math -I../embeddedcommon -I. -Icnfa -Irawdraw -DICACHE_FLASH_ATTR= +EXTRALIBS:=-lusb-1.0 + +OBJS:=../main.o ../dft.o ../decompose.o ../filter.o ../color.o ../notefinder.o ../util.o ../outdrivers.o $(OUTS) ../parameters.o ../chash.o ../hook.o ../../embeddedcommon/DFT32.o ../configs.o + +colorchord : $(OBJS) + gcc -o $@ $^ $(CFLAGS) $(LDLIBS) $(EXTRALIBS) $(RAWDRAWLIBS) + + +colorchord.exe : $(SRCS) + $(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS) + + +clean : + rm -rf *.o *~ colorchord colorchord.exe embeddedcc $(OBJS) From 7c6f7c6aaf1e4a6373322074091b81aa0fb2e105 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:48:19 -0400 Subject: [PATCH 02/23] Update main.c so that it matches latest code --- colorchord2/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/main.c b/colorchord2/main.c index 62110e1..2fd9402 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -429,7 +429,7 @@ int main(int argc, char ** argv) Now = OGGetAbsoluteTime(); double Last = Now; - while( !bQuitColorChord ) + while( !headless ) { char stt[1024]; //Handle Rawdraw frame swappign From 3030d2a8735d4d7616f3a68d2042067f0cd259e5 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:49:01 -0400 Subject: [PATCH 03/23] Update Makefile to compile with clang --- colorchord2/windows/Makefile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/colorchord2/windows/Makefile b/colorchord2/windows/Makefile index 23983f7..0701174 100644 --- a/colorchord2/windows/Makefile +++ b/colorchord2/windows/Makefile @@ -1,4 +1,4 @@ -all : colorchord +all : colorchord.exe 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 @@ -15,19 +15,10 @@ WINLDFLAGS:=-lwinmm -lgdi32 -lws2_32 -lsetupapi RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse -ludev -lrt - -CFLAGS:=-g -O1 -flto -Wall -ffast-math -I../embeddedcommon -I. -Icnfa -Irawdraw -DICACHE_FLASH_ATTR= -EXTRALIBS:=-lusb-1.0 - OBJS:=../main.o ../dft.o ../decompose.o ../filter.o ../color.o ../notefinder.o ../util.o ../outdrivers.o $(OUTS) ../parameters.o ../chash.o ../hook.o ../../embeddedcommon/DFT32.o ../configs.o -colorchord : $(OBJS) - gcc -o $@ $^ $(CFLAGS) $(LDLIBS) $(EXTRALIBS) $(RAWDRAWLIBS) - - colorchord.exe : $(SRCS) $(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS) - clean : rm -rf *.o *~ colorchord colorchord.exe embeddedcc $(OBJS) From 72d8e1dce9cb62208f35af2649082309194ff323 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:50:50 -0400 Subject: [PATCH 04/23] Make CNFA module point to CaiB's repo --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index ae541d5..0803dc3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/cntools/rawdraw [submodule "colorchord2/cnfa"] path = colorchord2/cnfa - url = https://github.com/cnlohr/cnfa + url = https://github.com/CaiB/cnfa [submodule "colorchord2/android/rawdrawandroid"] path = colorchord2/android/rawdrawandroid url = https://github.com/cnlohr/rawdrawandroid From d4e19a6a12e9c265d08c22a49cfec07a91898f21 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:35:57 -0400 Subject: [PATCH 05/23] Added makefile to compile on Windows with clang --- colorchord2/windows/Makefile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 colorchord2/windows/Makefile diff --git a/colorchord2/windows/Makefile b/colorchord2/windows/Makefile new file mode 100644 index 0000000..23983f7 --- /dev/null +++ b/colorchord2/windows/Makefile @@ -0,0 +1,33 @@ +all : colorchord + +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 + +SRCS := ../main.c ../dft.c ../decompose.c ../filter.c ../color.c ../notefinder.c ../util.c ../outdrivers.c +SRCS += ../parameters.c ../chash.c ../OutputVoronoi.c ../OutputProminent.c ../DisplayArray.c +SRCS += ../OutputLinear.c ../DisplayPie.c ../DisplayNetwork.c ../hook.c ../RecorderPlugin.c +SRCS += ../../embeddedcommon/DFT32.c ../OutputCells.c ../configs.c ../hidapi.c ../DisplayHIDAPI.c + +WINGCC:= clang -fcolor-diagnostics + +WINGCCFLAGS:= -g -D_CRT_SECURE_NO_WARNINGS -Wno-deprecated-declarations -DICACHE_FLASH_ATTR= -I../../embeddedcommon -I../cnfa -I../rawdraw -I../ -O1 #-O2 -Wl,--relax -Wl,--gc-sections -ffunction-sections -fdata-sections +WINLDFLAGS:=-lwinmm -lgdi32 -lws2_32 -lsetupapi + +RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext +LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse -ludev -lrt + + +CFLAGS:=-g -O1 -flto -Wall -ffast-math -I../embeddedcommon -I. -Icnfa -Irawdraw -DICACHE_FLASH_ATTR= +EXTRALIBS:=-lusb-1.0 + +OBJS:=../main.o ../dft.o ../decompose.o ../filter.o ../color.o ../notefinder.o ../util.o ../outdrivers.o $(OUTS) ../parameters.o ../chash.o ../hook.o ../../embeddedcommon/DFT32.o ../configs.o + +colorchord : $(OBJS) + gcc -o $@ $^ $(CFLAGS) $(LDLIBS) $(EXTRALIBS) $(RAWDRAWLIBS) + + +colorchord.exe : $(SRCS) + $(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS) + + +clean : + rm -rf *.o *~ colorchord colorchord.exe embeddedcc $(OBJS) From 4a3d06397b810a2d51e50079992948ab2c5dd0c4 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:48:19 -0400 Subject: [PATCH 06/23] Update main.c so that it matches latest code --- colorchord2/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/main.c b/colorchord2/main.c index b80d5e9..81a5de1 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -429,7 +429,7 @@ int main(int argc, char ** argv) Now = OGGetAbsoluteTime(); double Last = Now; - while( !bQuitColorChord ) + while( !headless ) { char stt[1024]; //Handle Rawdraw frame swappign From 84ccaf60e02f43d9c1ce4597682089ded6f289a8 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:49:01 -0400 Subject: [PATCH 07/23] Update Makefile to compile with clang --- colorchord2/windows/Makefile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/colorchord2/windows/Makefile b/colorchord2/windows/Makefile index 23983f7..0701174 100644 --- a/colorchord2/windows/Makefile +++ b/colorchord2/windows/Makefile @@ -1,4 +1,4 @@ -all : colorchord +all : colorchord.exe 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 @@ -15,19 +15,10 @@ WINLDFLAGS:=-lwinmm -lgdi32 -lws2_32 -lsetupapi RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse -ludev -lrt - -CFLAGS:=-g -O1 -flto -Wall -ffast-math -I../embeddedcommon -I. -Icnfa -Irawdraw -DICACHE_FLASH_ATTR= -EXTRALIBS:=-lusb-1.0 - OBJS:=../main.o ../dft.o ../decompose.o ../filter.o ../color.o ../notefinder.o ../util.o ../outdrivers.o $(OUTS) ../parameters.o ../chash.o ../hook.o ../../embeddedcommon/DFT32.o ../configs.o -colorchord : $(OBJS) - gcc -o $@ $^ $(CFLAGS) $(LDLIBS) $(EXTRALIBS) $(RAWDRAWLIBS) - - colorchord.exe : $(SRCS) $(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS) - clean : rm -rf *.o *~ colorchord colorchord.exe embeddedcc $(OBJS) From ce1c86fa1b3f110f32d8843d4e0bab091c01074d Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 01:50:50 -0400 Subject: [PATCH 08/23] Make CNFA module point to CaiB's repo --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index ae541d5..0803dc3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/cntools/rawdraw [submodule "colorchord2/cnfa"] path = colorchord2/cnfa - url = https://github.com/cnlohr/cnfa + url = https://github.com/CaiB/cnfa [submodule "colorchord2/android/rawdrawandroid"] path = colorchord2/android/rawdrawandroid url = https://github.com/cnlohr/rawdrawandroid From d77eced8c59ff967e08ccfe1b0c5243d648b2c2d Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 22:47:20 -0400 Subject: [PATCH 09/23] Change sleep function --- colorchord2/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colorchord2/main.c b/colorchord2/main.c index 81a5de1..7a16b2d 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -1,6 +1,6 @@ //Copyright 2015 <>< Charles Lohr under the ColorChord License. -#if defined(WIN32) || defined(USE_WINDOWS) +#if defined(WIN32) || defined(USE_WINDOWS) #include #include #endif @@ -417,7 +417,7 @@ int main(int argc, char ** argv) CNFGClearFrame(); CNFGDrawText( "Colorchord must be used with sound. Sound not available.", 10 ); CNFGSwapBuffers(); - sleep(1); + OGSleep(1); } while( 1 ); nf = CreateNoteFinder( sd->sps ); From 5fcc4b0881296e39ec6e7ccacbeaa8bb5ae9d33a Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Thu, 14 May 2020 22:47:59 -0400 Subject: [PATCH 10/23] Added script to compile with clang on Windows --- colorchord2/windows/compile-clang.bat | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 colorchord2/windows/compile-clang.bat diff --git a/colorchord2/windows/compile-clang.bat b/colorchord2/windows/compile-clang.bat new file mode 100644 index 0000000..6e66b9f --- /dev/null +++ b/colorchord2/windows/compile-clang.bat @@ -0,0 +1,11 @@ +set CC="C:\Program Files\LLVM\bin\clang.exe" +set CCFLAGS=-g -D_CRT_SECURE_NO_WARNINGS -Wno-deprecated-declarations -DICACHE_FLASH_ATTR= -Dstrdup=_strdup +set CCIFLAGS=-I../../embeddedcommon -I../cnfa -I../rawdraw -I../ -O1 +set CCLFLAGS=-lwinmm -lgdi32 -lws2_32 -lsetupapi -lkernel32 -luser32 -ldbghelp -lole32 -lmmdevapi +set SOURCES=../main.c ../dft.c ../decompose.c ../filter.c ../color.c ../notefinder.c ../util.c ../outdrivers.c ^ +../parameters.c ../chash.c ../OutputVoronoi.c ../OutputProminent.c ../DisplayArray.c ^ +../OutputLinear.c ../DisplayPie.c ../DisplayNetwork.c ../hook.c ../RecorderPlugin.c ^ +../../embeddedcommon/DFT32.c ../OutputCells.c ../configs.c ../hidapi.c ../DisplayHIDAPI.c + +@echo on +%CC% %CCFLAGS% %CCIFLAGS% -o colorchord.exe %SOURCES% %CCLFLAGS% From c27b90a1f2c0390e1c4cd23fff74ad4bdfda0963 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Fri, 15 May 2020 02:14:39 -0400 Subject: [PATCH 11/23] updated tcc build script --- colorchord2/windows/compile.bat | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/colorchord2/windows/compile.bat b/colorchord2/windows/compile.bat index 79c0915..a492683 100644 --- a/colorchord2/windows/compile.bat +++ b/colorchord2/windows/compile.bat @@ -1,12 +1,22 @@ @echo off echo Unzip http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win64-bin.zip to C:\tcc echo Don't worry. It includes the i386 compiler in the win64 build. -set CFLAGS=-v -DHIDAPI -DWINDOWS -DWIN32 -DTCC -DRUNTIME_SYMNUM -Os -Itccinc -DINCLUDING_EMBEDDED -I../rawdraw -I../cnfa -I.. -I. -I../../embeddedcommon -rdynamic -g + +set CFLAGS= -v -DHIDAPI -DWINDOWS -DWIN32 -DTCC -DRUNTIME_SYMNUM -Os -Itccinc -DINCLUDING_EMBEDDED -rdynamic -g +set INCLUDES=-I../rawdraw -I../cnfa -I.. -I. -I../../embeddedcommon set LDFLAGS=-lkernel32 -lgdi32 -luser32 -lsetupapi -ldbghelp -lws2_32 -set SOURCES=..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\DisplayNetwork.c ..\DisplayArray.c ..\DisplayHIDAPI.c ..\DisplayOUTDriver.c ..\DisplayPie.c ..\filter.c ..\hidapi.c ..\hook.c ..\main.c ..\outdrivers.c ..\OutputCells.c ..\OutputLinear.c ..\OutputProminent.c ..\OutputVoronoi.c ..\parameters.c ..\util.c ..\notefinder.c ..\..\embeddedcommon\DFT32.c tcc_stubs.c symbol_enumerator.c -set ARCH_SPECIFIC=-L32 C:\windows\system32\winmm.dll -set CC=C:\tcc\i386-win32-tcc.exe + +rem lots of source files +set SOURCES=..\main.c ..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\filter.c ^ +..\outdrivers.c ..\hidapi.c ..\hook.c ..\parameters.c ..\util.c ..\notefinder.c ^ +..\..\embeddedcommon\DFT32.c tcc_stubs.c symbol_enumerator.c ^ +..\DisplayNetwork.c ..\DisplayArray.c ..\DisplayHIDAPI.c ..\DisplayOUTDriver.c ..\DisplayPie.c ^ +..\OutputCells.c ..\OutputLinear.c ..\OutputProminent.c ..\OutputVoronoi.c + +set ARCH_SPECIFIC=-L32 C:\windows\system32\winmm.dll -Dstrdup=_strdup -DWIN32_LEAN_AND_MEAN +set CC=C:\tcc\tcc.exe +rem set CC=C:\tcc\i386-win32-tcc.exe rem set CC=C:\tcc\x86_64-win32-tcc.exe @echo on -%CC% %CFLAGS% %ARCH_SPECIFIC% %SOURCES% %LDFLAGS% -o ..\colorchord.exe +%CC% %CFLAGS% %INCLUDES% %ARCH_SPECIFIC% %SOURCES% %LDFLAGS% -o ..\colorchord.exe pause From 457f9797231e2a5fd8386c2d0d84f704d63f4a1e Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Fri, 15 May 2020 02:15:21 -0400 Subject: [PATCH 12/23] cnfa points to my repo --- .gitmodules | 2 +- colorchord2/cnfa | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 0803dc3..7008f08 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/cntools/rawdraw [submodule "colorchord2/cnfa"] path = colorchord2/cnfa - url = https://github.com/CaiB/cnfa + url = git@github.com:sellicott/cnfa.git [submodule "colorchord2/android/rawdrawandroid"] path = colorchord2/android/rawdrawandroid url = https://github.com/cnlohr/rawdrawandroid diff --git a/colorchord2/cnfa b/colorchord2/cnfa index 6c9dd09..d3f16d2 160000 --- a/colorchord2/cnfa +++ b/colorchord2/cnfa @@ -1 +1 @@ -Subproject commit 6c9dd0901ba034577dea72f86756f3ac2f748862 +Subproject commit d3f16d2edbdca273a5bc8fab7df781ed37827f4b From 184dd91a679476e03ad5bd48d2c8055d55445e61 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Fri, 15 May 2020 02:15:38 -0400 Subject: [PATCH 13/23] this still needs some cleanup --- colorchord2/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/colorchord2/main.c b/colorchord2/main.c index 7a16b2d..be0f841 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -3,6 +3,7 @@ #if defined(WIN32) || defined(USE_WINDOWS) #include #include +#define strdup _strdup #endif #include From c51221b4fd70a327a1ab7b711d231eaec44d00b9 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Fri, 15 May 2020 18:52:57 -0400 Subject: [PATCH 14/23] Added necessary library to build --- colorchord2/windows/compile.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/windows/compile.bat b/colorchord2/windows/compile.bat index a492683..c5b3364 100644 --- a/colorchord2/windows/compile.bat +++ b/colorchord2/windows/compile.bat @@ -4,7 +4,7 @@ echo Don't worry. It includes the i386 compiler in the win64 build. set CFLAGS= -v -DHIDAPI -DWINDOWS -DWIN32 -DTCC -DRUNTIME_SYMNUM -Os -Itccinc -DINCLUDING_EMBEDDED -rdynamic -g set INCLUDES=-I../rawdraw -I../cnfa -I.. -I. -I../../embeddedcommon -set LDFLAGS=-lkernel32 -lgdi32 -luser32 -lsetupapi -ldbghelp -lws2_32 +set LDFLAGS=-lkernel32 -lOle32 -lgdi32 -luser32 -lsetupapi -ldbghelp -lws2_32 rem lots of source files set SOURCES=..\main.c ..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\filter.c ^ From 328852d9e94cd15280f606052ede5096d4956b3e Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:35:49 -0400 Subject: [PATCH 15/23] fix reversal in fread input arguments --- colorchord2/configs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/colorchord2/configs.c b/colorchord2/configs.c index dadb57f..2c26c03 100644 --- a/colorchord2/configs.c +++ b/colorchord2/configs.c @@ -31,12 +31,12 @@ void LoadFile( const char * filename ) int size = ftell( f ); fseek( f, 0, SEEK_SET ); buffer = malloc( size + 1 ); - r = fread( buffer, size, 1, f ); + r = fread( buffer, 1, size, f); fclose( f ); buffer[size] = 0; - if( r != 1 ) + if( r != size ) { - fprintf( stderr, "Warning: %d bytes read. Expected: %d from file %s\n", r, size, filename ); + fprintf( stderr, "Warning: %d bytes read. Expected: %d from file %s\n", r, size, filename ); } else { From 4c3b7b294a972b731e84244c96386b6d879a420e Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:39:22 -0400 Subject: [PATCH 16/23] Call necessary registration functions --- colorchord2/main.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/colorchord2/main.c b/colorchord2/main.c index be0f841..177a9fa 100644 --- a/colorchord2/main.c +++ b/colorchord2/main.c @@ -312,6 +312,24 @@ void HandleResume() int main(int argc, char ** argv) { int i; +#if defined(__TINYC__) + // zero out the drivers list + for ( int ii = 0; i< MAX_OUT_DRIVERS; ++i) { + ODList[i].Name = NULL; + ODList[i].Init = NULL; + } + + + REGISTERheadless(); + REGISTERset_screenx(); + REGISTERset_screeny(); + REGISTERsound_source(); + REGISTERcpu_autolimit(); + REGISTERcpu_autolimit_interval(); + REGISTERsample_channel(); + REGISTERshowfps(); +#endif + #ifdef TCC void ManuallyRegisterDevices(); @@ -328,7 +346,8 @@ int main(int argc, char ** argv) WSAStartup(0x202, &wsaData); - strcpy( sound_source, "WIN" ); + REGISTERcnfa_wasapi(); + strcpy( sound_source, "WASAPI" ); #elif defined( ANDROID ) strcpy( sound_source, "ANDROID" ); From 1eb42353bd4adf3af949b4ce4697acae0c2435e1 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:40:17 -0400 Subject: [PATCH 17/23] Added logging output --- colorchord2/parameters.c | 1 + 1 file changed, 1 insertion(+) diff --git a/colorchord2/parameters.c b/colorchord2/parameters.c index 3800694..05ae639 100644 --- a/colorchord2/parameters.c +++ b/colorchord2/parameters.c @@ -137,6 +137,7 @@ static int SetParameter( struct Param * p, const char * str ) void RegisterValue( const char * name, enum ParamType t, void * ptr, int size ) { + printf("[SDE] Registering parameter %s\n", name); Init(); struct Param * p = (struct Param*)HashGetEntry( parameters, name ); From f9ed8625087b6198442e9e2ddce06c664f21d109 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:40:45 -0400 Subject: [PATCH 18/23] Make function prototype match implemented function --- colorchord2/outdrivers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/outdrivers.h b/colorchord2/outdrivers.h index 44db767..0a39d4d 100644 --- a/colorchord2/outdrivers.h +++ b/colorchord2/outdrivers.h @@ -37,7 +37,7 @@ extern struct OutDriverListElem ODList[MAX_OUT_DRIVERS]; extern const char OutDriverParameters[MAX_OUT_DRIVER_STRING]; //Pass setup "name=[driver]" -struct DriverInstances * SetupOutDriver( ); +struct DriverInstances * SetupOutDriver( const char * drivername ); void RegOutDriver( const char * ron, struct DriverInstances * (*Init)( ) ); #define REGISTER_OUT_DRIVER( name ) \ From 3402711e6f485d001b193687405cddc253da8889 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:41:20 -0400 Subject: [PATCH 19/23] Slightly change build scripts --- colorchord2/windows/compile-clang.bat | 2 +- colorchord2/windows/compile.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/colorchord2/windows/compile-clang.bat b/colorchord2/windows/compile-clang.bat index 6e66b9f..fb87658 100644 --- a/colorchord2/windows/compile-clang.bat +++ b/colorchord2/windows/compile-clang.bat @@ -8,4 +8,4 @@ set SOURCES=../main.c ../dft.c ../decompose.c ../filter.c ../color.c ../notefin ../../embeddedcommon/DFT32.c ../OutputCells.c ../configs.c ../hidapi.c ../DisplayHIDAPI.c @echo on -%CC% %CCFLAGS% %CCIFLAGS% -o colorchord.exe %SOURCES% %CCLFLAGS% +%CC% %CCFLAGS% %CCIFLAGS% -o ../colorchord.exe %SOURCES% %CCLFLAGS% diff --git a/colorchord2/windows/compile.bat b/colorchord2/windows/compile.bat index c5b3364..f8f48cc 100644 --- a/colorchord2/windows/compile.bat +++ b/colorchord2/windows/compile.bat @@ -4,7 +4,7 @@ echo Don't worry. It includes the i386 compiler in the win64 build. set CFLAGS= -v -DHIDAPI -DWINDOWS -DWIN32 -DTCC -DRUNTIME_SYMNUM -Os -Itccinc -DINCLUDING_EMBEDDED -rdynamic -g set INCLUDES=-I../rawdraw -I../cnfa -I.. -I. -I../../embeddedcommon -set LDFLAGS=-lkernel32 -lOle32 -lgdi32 -luser32 -lsetupapi -ldbghelp -lws2_32 +set LDFLAGS=-lkernel32 -lole32 -lgdi32 -luser32 -lsetupapi -ldbghelp -lws2_32 rem lots of source files set SOURCES=..\main.c ..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\filter.c ^ From 0288cec7130c126dd57bce31d7e02a90c17a3d60 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:42:46 -0400 Subject: [PATCH 20/23] bump submodule --- colorchord2/cnfa | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/cnfa b/colorchord2/cnfa index d3f16d2..38a0235 160000 --- a/colorchord2/cnfa +++ b/colorchord2/cnfa @@ -1 +1 @@ -Subproject commit d3f16d2edbdca273a5bc8fab7df781ed37827f4b +Subproject commit 38a023556310f0377c6b3d6c2f7a3106ff7e14ef From 4c229fbe279a008703424684e8d67b60f1ebc375 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:50:20 -0400 Subject: [PATCH 21/23] switch submodule to https --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 7008f08..0bc1620 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/cntools/rawdraw [submodule "colorchord2/cnfa"] path = colorchord2/cnfa - url = git@github.com:sellicott/cnfa.git + url = https://github.com:sellicott/cnfa [submodule "colorchord2/android/rawdrawandroid"] path = colorchord2/android/rawdrawandroid url = https://github.com/cnlohr/rawdrawandroid From 2bbeb2d7df328f3a2adca94f3ae0f0e553681689 Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 02:55:01 -0400 Subject: [PATCH 22/23] fixed bad URL --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 0bc1620..ed613bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/cntools/rawdraw [submodule "colorchord2/cnfa"] path = colorchord2/cnfa - url = https://github.com:sellicott/cnfa + url = https://github.com/sellicott/cnfa [submodule "colorchord2/android/rawdrawandroid"] path = colorchord2/android/rawdrawandroid url = https://github.com/cnlohr/rawdrawandroid From c7f058b72b70367ee789a2973c5197a54a0ce14c Mon Sep 17 00:00:00 2001 From: Sam Ellicott Date: Sat, 16 May 2020 03:21:25 -0400 Subject: [PATCH 23/23] bump submodule version --- colorchord2/cnfa | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorchord2/cnfa b/colorchord2/cnfa index 38a0235..cdffc38 160000 --- a/colorchord2/cnfa +++ b/colorchord2/cnfa @@ -1 +1 @@ -Subproject commit 38a023556310f0377c6b3d6c2f7a3106ff7e14ef +Subproject commit cdffc38b0193174f6c416c32189da380b9c84701