added autosens feature

master
karlstav 10 years ago
parent cdff7c64fe
commit 6f5631d996
  1. 28
      cava.c
  2. 2
      changelog
  3. 3
      example_files/config
  4. 1
      todo

@ -64,8 +64,8 @@ struct termios oldtio, newtio;
int rc;
char *inputMethod, *outputMethod, *modeString, *color, *bcolor, *style;
double monstercat, integral, gravity, ignore, smh;
int fixedbars, sens, framerate, bw, bs;
double monstercat, integral, gravity, ignore, smh, sens;
int fixedbars, framerate, bw, bs, autosens;
unsigned int lowcf, highcf;
double smoothDef[64] = {0.8, 0.8, 1, 1, 0.8, 0.8, 1, 0.8, 0.8, 1, 1, 0.8,
1, 1, 0.8, 0.6, 0.6, 0.7, 0.8, 0.8, 0.8, 0.8, 0.8,
@ -178,12 +178,14 @@ FILE *fp;
fixedbars = iniparser_getint(ini, "general:bars", 0);
bw = iniparser_getint(ini, "general:bar_width", 3);
bs = iniparser_getint(ini, "general:bar_spacing", 1);
sens = iniparser_getint(ini, "general:sensitivity", 100);
framerate = iniparser_getint(ini, "general:framerate", 60);
sens = iniparser_getint(ini, "general:sensitivity", 100);
autosens = iniparser_getint(ini, "general:autosens", 1);
lowcf = iniparser_getint(ini, "general:lower_cutoff_freq", 50);
highcf = iniparser_getint(ini, "general:higher_cutoff_freq", 10000);
style = (char *)iniparser_getstring(ini, "output:style", "stereo");
smcount = iniparser_getsecnkeys(ini, "eq");
if (smcount > 0) {
smooth = malloc(smcount*sizeof(*smooth));
@ -366,6 +368,10 @@ void validate_config()
"lower cutoff frequency can't be higher than higher cutoff frequency\n");
exit(EXIT_FAILURE);
}
//setting sens
sens = sens / 100;
// read & validate: eq
}
@ -408,7 +414,7 @@ int * separate_freq_bands(fftw_complex out[M / 2 + 1][2], int bars, int lcf[200]
peak[o] = peak[o] / (hcf[o]-lcf[o]+1); //getting average
temp = peak[o] * k[o] * ((float)sens / 100); //multiplying with k and adjusting to sens settings
temp = peak[o] * k[o] * sens; //multiplying with k and adjusting to sens settings
if (temp <= ignore)temp = 0;
if (channel == 1) fl[o] = temp;
else fr[o] = temp;
@ -738,10 +744,10 @@ Options:\n\
switch (ch) {
case 65: // key up
sens += 10;
sens = sens * 1.05;
break;
case 66: // key down
sens -= 10;
sens = sens * 0.95;
break;
case 68: // key right
bw++;
@ -887,6 +893,16 @@ Options:\n\
if (f[o] < 1)f[o] = 1;
}
//autmatic sens adjustment
if (autosens) {
for (o = 0; o < bars; o++) {
if (f[o] > height * 8) {
sens = sens * 0.99;
break;
}
}
}
// output: draw processed input
#ifndef DEBUG
switch (om) {

@ -1,8 +1,10 @@
2015-11-XX - 0.4.0
- added pulseadio support
- added confg script
- removed commanline argumets
- added optional config path
- added autosens feature
- bugfixes
2015-9-19 - 0.3.5

@ -13,6 +13,9 @@
# increasing this value 200 means double height. Accepts only non-negative values.
; sensitivity = 100
# Autosens will atempt to decrease sensitivity if cava peaks. 1 = on, 0 = off
; autosens = 1
# The number of bars. 0 (default) sets it to auto (fil upp console).
# width of bras and space between bars in number of characters. Default witdth 3 and space 1.
; bars = 0

@ -1,7 +1,6 @@
TODO
----
* pulseaudio and configure script with optional dependencies
* more key controls
* switch to libconfig
* possibility to save settings to config file

Loading…
Cancel
Save