diff --git a/Makefile b/Makefile index c6dfdc7..bc6c872 100644 --- a/Makefile +++ b/Makefile @@ -2,20 +2,20 @@ 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 +OUTS := OutputVoronoi.o DisplayArray.o OutputLinear.o DisplayPie.o DisplayNetwork.o DisplayUSB2812.o DisplayDMX.o RecorderPlugin.o WINGCC:=i586-mingw32msvc-gcc WINGCCFLAGS:= -lwinmm -lgdi32 -lws2_32 -O2 -ffast-math -g RAWDRAWLIBS:=-lX11 -lm -lpthread -lXinerama -lXext LDLIBS:=-lpthread -lasound -lm -lpulse-simple -lpulse -CFLAGS:=-g -Os -flto -Wall -ffast-math +CFLAGS:=-g -O2 -flto -Wall -ffast-math 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 +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 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 +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 $(WINGCC) -o $@ $^ $(WINGCCFLAGS) diff --git a/default.conf b/default.conf index dc09757..1c31890 100644 --- a/default.conf +++ b/default.conf @@ -23,7 +23,7 @@ wininput = 0 #Compiled version will default this. #sound_source = PULSE #-1 indicates left and right, 0 left, 1 right. -sample_channel = -1 +sample_channel = 1 sourcename = alsa_output.pci-0000_00_1b.0.analog-stereo.monitor diff --git a/dmx.conf b/dmx.conf index ddf6d7f..eee1895 100644 --- a/dmx.conf +++ b/dmx.conf @@ -1,4 +1,4 @@ -outdrivers = DisplayDMX, OutputLinear, DisplayArray +outdrivers = DisplayDMX, OutputLinear, DisplayArray, RecorderPlugin byte_offset = 32 ledoutamp = 1.0 diff --git a/linearpie.conf b/linearpie.conf old mode 100644 new mode 100755 diff --git a/main.c b/main.c index d268ede..cde602d 100644 --- a/main.c +++ b/main.c @@ -13,6 +13,7 @@ #include "notefinder.h" #include "outdrivers.h" #include "parameters.h" +#include "hook.h" #ifdef WIN32 #include @@ -56,6 +57,7 @@ void HandleKey( int keycode, int bDown ) if( c == 'K' && bDown ) DumpParameters(); if( keycode == 65307 ) exit( 0 ); printf( "Key: %d -> %d\n", keycode, bDown ); + KeyHappened( keycode, bDown ); } void HandleButton( int x, int y, int button, int bDown ) @@ -71,17 +73,22 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun { int channelin = sd->channelsRec; // int channelout = sd->channelsPlay; + //*samplesp = 0; +// int process_channels = (MAX_CHANNELS < channelin)?MAX_CHANNELS:channelin; //Load the samples into a ring buffer. Split the channels from interleved to one per buffer. - *samplesp = 0; -// int process_channels = (MAX_CHANNELS < channelin)?MAX_CHANNELS:channelin; int i; int j; for( i = 0; i < samplesr; i++ ) { + for( j = 0; j < channelin; j++ ) + { + out[i*channelin+j] = 0; + } + if( sample_channel < 0 ) { float fo = 0; @@ -94,7 +101,6 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun fo /= channelin; sound[soundhead] = fo; soundhead = (soundhead+1)%SOUNDCBSIZE; - } else { @@ -104,6 +110,10 @@ void SoundCB( float * out, float * in, int samplesr, int * samplesp, struct Soun soundhead = (soundhead+1)%SOUNDCBSIZE; } } + + SoundEventHappened( samplesr, in, channelin, 0 ); + SoundEventHappened( samplesr, out, sd->channelsPlay, 1 ); + *samplesp = samplesr; } diff --git a/outdrivers.h b/outdrivers.h index 5a8571e..63a7ef4 100644 --- a/outdrivers.h +++ b/outdrivers.h @@ -1,3 +1,6 @@ +//Output drivers, used for outputting lights, etc... However, this technique +//may be used for unrelated-to-output plugins. + #ifndef _OUTDRIVERS_H #define _OUTDRIVERS_H