[SCM] calf/master: Merge branch 'line-graph' of boomshop.net:calf into analyzer
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:56 UTC 2013
Use mode in line-graph instead of bars and boxes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: d6a3c1a63a147948535a50da009275278ad5e6a3
X-Git-Newrev: 34569260c452f0fa4c543155ebba174a42a343dc
The following commit has been merged in the master branch:
commit 4dcbc26d560890311fecc159f3912631f709a1ba
Merge: 7bcf3387b66d59ac72c4be4745a78c269ac0ef96 2868f7ae53d77cca671f6fe2480719e3bebf7680
Author: Christian Holschuh <chrisch.holli at gmx.de>
Date: Tue Mar 6 02:33:03 2012 +0100
Merge branch 'line-graph' of boomshop.net:calf into analyzer
diff --combined src/modules.cpp
index 6612ac3,09454bc..507c80d
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@@ -981,25 -981,19 +981,19 @@@ bool analyzer_audio_module::get_phase_g
return false;
}
- bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context, bool *bars, bool *boxes) const
+ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context, int *mode) const
{
if (!active or subindex > 1 or !*params[param_analyzer_display]
or (subindex > 0 and !*params[param_analyzer_hold]))
// stop drawing
return false;
bool fftdone = false; // if fft was renewed, this one is true
double freq;
int iter = 0;
- int _iter = 0;
+ int _iter = 1;
int _param_speed = 16 - (int)*params[param_analyzer_speed];
if(subindex == 0) {
-
if(!((int)____analyzer_phase_was_drawn_here % _param_speed)) {
// seems we have to do a fft, so let's read the latest data from the
// buffer to send it to fft
@@@ -1069,8 -1063,8 +1063,8 @@@
rfftw_one(fft_plan, fft_in, fft_out);
//run fft for left and right channel while in "phase by freq" mode
if(*params[param_analyzer_correction] == 3) {
- rfftw_one(fft_plan, fft_inL, fft_outL);
- rfftw_one(fft_plan, fft_inR, fft_outR);
+ rfftw_one(fft_plan, fft_inL, fft_outL);
+ rfftw_one(fft_plan, fft_inR, fft_outR);
}
// ...and reset some values
____analyzer_hold_dirty = 0;
@@@ -1083,7 -1077,7 +1077,7 @@@
// accuracy was changed so we have to recalc linear transition
int _lintrans = (int)((float)points * log((20.f + (float)srate / (float)_accuracy) / 20.f) / log(1000.f));
lintrans = (int)(_lintrans + points % _lintrans / floor(points / _lintrans));
- }
+ }
for (int i = 0; i <= points; i++)
{
float lastoutL = 0.f;
@@@ -1133,29 -1127,42 +1127,27 @@@
fft_out[_iter] = std::max(n * fabs(fft_out[_iter]) - var1 , 1e-20);
break;
case 3:
-// for(int k = 0; k < std::max(10 , std::min(400 , (int)(2.f*(float)((_iter - iter))))); k++) {
-// if(_iter - k > 0) {
-// var1 += fabs(fft_outL[_iter - k]);
-// var2 += fabs(fft_outR[_iter - k]);
-// n++;
-// }
-// if(k != 0) {
-// var1 += fabs(fft_out[_iter + k]);
-// var2 += fabs(fft_out[_iter + k]);
-// }
-// else if(i) {
-// var1 += fabs(lastoutL);
-// var2 += fabs(lastoutR);
-// }
-// else {
-// var1 += fabs(fft_out[_iter]);
-// var2 += fabs(fft_out[_iter]);
-// }
-// n++;
-// }
+ if(fftdone and i) {
+ // if fft was renewed, recalc the absolute values if frequencies
+ // are skipped
+ for(int j = iter + 1; j < _iter; j++) {
+ fft_outL[_iter] += fabs(fft_outL[j]);
+ fft_outR[_iter] += fabs(fft_outR[j]);
+ }
+ }
float diff_fft;
- diff_fft = fabs(fft_outL[_iter]) - fabs(fft_out[_iter]);
- printf("i %5d diff %.4f\n", i, diff_fft);
- fft_out[_iter] = _accuracy / 2.f * (((float)n +1.f) * (1.f + diff_fft));
-// lastoutL = fft_outL[_iter];
-// lastoutR = fft_outR[_iter];
+ diff_fft = fabs(fft_outL[_iter]) - fabs(fft_outR[_iter]);
+ fft_out[_iter] = diff_fft / _accuracy;
break;
}
}
iter = _iter;
float val = 0.f;
- *boxes = false;
if (*params[param_analyzer_freeze]) {
// freeze enabled
val = fft_freeze[iter];
} else if (subindex == 1) {
// we draw the hold buffer
- *boxes = true;
val = fft_hold[iter];
} else {
// we draw normally (no freeze)
@@@ -1184,11 -1191,6 +1176,11 @@@
fft_freeze[iter] = val;
}
data[i] = dB_grid(fabs(val) / _accuracy * 2.f);
+ if(*params[param_analyzer_correction] == 3) {
+ if(i)data[i] = fft_out[iter];
+ if(!i)data[i}
+ if(fabs(data[i])>1.f) printf("mehr als 1!!!!!!!!!! bei %5d bei iter %4d und _iter %4d\n",i,iter,_iter);
+ }
} //else if(*params[param_analyzer_correction] == 2) {
// data[i] = dB_grid(fabs(1e-20) / _accuracy * 2.f);
// }
@@@ -1201,6 -1203,21 +1193,21 @@@
// subtle hold line
context->set_source_rgba(0.35, 0.4, 0.2, 0.2);
}
+ if(*params[param_analyzer_bars]) {
+ if(subindex == 0) {
+ // draw bars
+ *mode = 1;
+ } else {
+ // draw boxes
+ *mode = 2;
+ }
+ } else if (*params[param_analyzer_correction] == 3) {
+ // draw centered bars
+ *mode = 3;
+ } else {
+ // draw lines
+ *mode = 0;
+ }
return true;
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list