work on the DMX thing, trying to make it be able to record, too.

This commit is contained in:
Laptop 2015-06-26 15:37:30 -04:00
parent ba815e0a99
commit 945df1897a
6 changed files with 22 additions and 9 deletions

View file

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

View file

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

View file

@ -1,4 +1,4 @@
outdrivers = DisplayDMX, OutputLinear, DisplayArray
outdrivers = DisplayDMX, OutputLinear, DisplayArray, RecorderPlugin
byte_offset = 32
ledoutamp = 1.0

0
linearpie.conf Normal file → Executable file
View file

16
main.c
View file

@ -13,6 +13,7 @@
#include "notefinder.h"
#include "outdrivers.h"
#include "parameters.h"
#include "hook.h"
#ifdef WIN32
#include <windows.h>
@ -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;
}

View file

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