Merge pull request #1 from sellicott/master

Merging in Sam's Work
This commit is contained in:
Cai Biesinger 2020-05-17 13:29:15 +09:00 committed by GitHub
commit c6f64773a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 82 additions and 16 deletions

2
.gitmodules vendored
View file

@ -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/sellicott/cnfa
[submodule "colorchord2/android/rawdrawandroid"]
path = colorchord2/android/rawdrawandroid
url = https://github.com/cnlohr/rawdrawandroid

@ -1 +1 @@
Subproject commit 6c9dd0901ba034577dea72f86756f3ac2f748862
Subproject commit cdffc38b0193174f6c416c32189da380b9c84701

View file

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

View file

@ -1,8 +1,9 @@
//Copyright 2015 <>< Charles Lohr under the ColorChord License.
#if defined(WIN32) || defined(USE_WINDOWS)
#if defined(WIN32) || defined(USE_WINDOWS)
#include <winsock2.h>
#include <windows.h>
#define strdup _strdup
#endif
#include <ctype.h>
@ -311,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();
@ -327,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" );
@ -417,7 +437,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 );
@ -429,7 +449,7 @@ int main(int argc, char ** argv)
Now = OGGetAbsoluteTime();
double Last = Now;
while( !bQuitColorChord )
while( !headless )
{
char stt[1024];
//Handle Rawdraw frame swappign

View file

@ -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 ) \

View file

@ -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 );

View file

@ -0,0 +1,24 @@
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
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
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.exe : $(SRCS)
$(WINGCC) $(WINGCCFLAGS) -o $@ $^ $(WINLDFLAGS)
clean :
rm -rf *.o *~ colorchord colorchord.exe embeddedcc $(OBJS)

View file

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

View file

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