Update for voice and input
This commit is contained in:
parent
d80ae18aff
commit
686f47217f
8 changed files with 884 additions and 0 deletions
109
colorchord2/configs.c
Normal file
109
colorchord2/configs.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
#include "configs.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <os_generic.h>
|
||||
#include "parameters.h"
|
||||
|
||||
int gargc;
|
||||
char ** gargv;
|
||||
|
||||
|
||||
const char * InitialFile[NRDEFFILES];
|
||||
double FileTimes[NRDEFFILES];
|
||||
int InitialFileCount = 1;
|
||||
|
||||
|
||||
void LoadFile( const char * filename )
|
||||
{
|
||||
char * buffer;
|
||||
int r;
|
||||
|
||||
FILE * f = fopen( filename, "rb" );
|
||||
if( !f )
|
||||
{
|
||||
fprintf( stderr, "Warning: cannot open %s.\n", filename );
|
||||
}
|
||||
else
|
||||
{
|
||||
fseek( f, 0, SEEK_END );
|
||||
int size = ftell( f );
|
||||
fseek( f, 0, SEEK_SET );
|
||||
buffer = malloc( size + 1 );
|
||||
r = fread( buffer, size, 1, f );
|
||||
fclose( f );
|
||||
buffer[size] = 0;
|
||||
if( r != 1 )
|
||||
{
|
||||
fprintf( stderr, "Warning: %d bytes read. Expected: %d from file %s\n", r, size, filename );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetParametersFromString( buffer );
|
||||
}
|
||||
free( buffer );
|
||||
}
|
||||
}
|
||||
|
||||
void SetEnvValues( int force )
|
||||
{
|
||||
int i;
|
||||
int hits = 0;
|
||||
for( i = 0; i < InitialFileCount; i++ )
|
||||
{
|
||||
double ft = OGGetFileTime( InitialFile[i] );
|
||||
if( FileTimes[i] != ft )
|
||||
{
|
||||
FileTimes[i] = ft;
|
||||
hits++;
|
||||
}
|
||||
}
|
||||
|
||||
if( !hits && !force ) return;
|
||||
|
||||
//Otherwise, something changed.
|
||||
|
||||
LoadFile( InitialFile[0] );
|
||||
|
||||
for( i = 1; i < gargc; i++ )
|
||||
{
|
||||
if( strchr( gargv[i], '=' ) != 0 )
|
||||
{
|
||||
printf( "AP: %s\n", gargv[i] );
|
||||
SetParametersFromString( gargv[i] );
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( "LF: %s\n", gargv[i] );
|
||||
LoadFile( gargv[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessArgs()
|
||||
{
|
||||
int i;
|
||||
for( i = 1; i < gargc; i++ )
|
||||
{
|
||||
if( strchr( gargv[i], '=' ) != 0 )
|
||||
{
|
||||
//A value setting operation
|
||||
}
|
||||
else
|
||||
{
|
||||
InitialFile[InitialFileCount++] = gargv[i];
|
||||
}
|
||||
}
|
||||
|
||||
SetEnvValues( 1 );
|
||||
}
|
||||
|
||||
|
||||
void SetupConfigs()
|
||||
{
|
||||
|
||||
InitialFile[0] = "default.conf";
|
||||
|
||||
ProcessArgs();
|
||||
|
||||
}
|
16
colorchord2/configs.h
Normal file
16
colorchord2/configs.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef _CONFIGS_H
|
||||
#define _CONFIGS_H
|
||||
|
||||
#define NRDEFFILES 10
|
||||
|
||||
extern int gargc;
|
||||
extern char ** gargv;
|
||||
|
||||
|
||||
void LoadFile( const char * filename );
|
||||
void SetEnvValues( int force );
|
||||
void ProcessArgs();
|
||||
void SetupConfigs();
|
||||
|
||||
#endif
|
||||
|
53
colorchord2/double_pie_voice.conf
Normal file
53
colorchord2/double_pie_voice.conf
Normal file
|
@ -0,0 +1,53 @@
|
|||
#for a two-ring WS2812 light, 24 LEDs per layer, one layer clockwise, the other counter-clockwise.
|
||||
|
||||
outdrivers = DisplayPie,DisplayNetwork,OutputLinear,RecorderPlugin
|
||||
leds = 48
|
||||
light_siding = 2.5 #Turn this to ~1.9 for more uniformity, ~1.0 for less.
|
||||
satamp = 1.600
|
||||
is_loop=1
|
||||
led_floor = .1 #Turn to .25 for more uniformity, .1 for less.
|
||||
steady_bright = 0
|
||||
|
||||
|
||||
|
||||
|
||||
# For the final note information... How much to slack everything?
|
||||
note_attach_amp_iir = 0.4500
|
||||
note_attach_amp_iir2 = 0.350
|
||||
note_attach_freq_iir = 0.4000
|
||||
dft_iir = 0.3
|
||||
|
||||
skipfirst = 3
|
||||
firstval = 0
|
||||
port = 7777
|
||||
#address = 192.168.11.231
|
||||
#address = 192.168.43.128
|
||||
address = 192.168.4.1
|
||||
|
||||
slope=.10
|
||||
amplify=.1
|
||||
|
||||
|
||||
lightx = 20
|
||||
lighty = 20
|
||||
|
||||
sourcename =
|
||||
# alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
|
||||
|
||||
#alsa_input.pci-0000_00_1f.3.analog-stereo
|
||||
#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
|
||||
|
||||
fliprg = 1
|
||||
skittlequantity = 24
|
||||
|
||||
|
||||
led_limit=.4
|
||||
|
||||
|
||||
|
||||
|
||||
play = 1
|
||||
buffer = 512
|
||||
player_filename = _CUT1recfile.raw
|
||||
recorder_filename = recfile.raw
|
||||
recorder_bypass = 44100
|
Loading…
Add table
Add a link
Reference in a new issue