[SCM] calf/master: Spectralizer in Analyzer added windowing for Analyzer
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:41:09 UTC 2013
The following commit has been merged in the master branch:
commit 70cc1b33f839cf8bd1524e7bd807f36d44a73210
Author: Markus Schmidt <schmidt at boomshop.net>
Date: Thu Sep 13 04:02:41 2012 +0200
Spectralizer in Analyzer
added windowing for Analyzer
diff --git a/gui/gui-analyzer.xml b/gui/gui-analyzer.xml
index b277916..89ccb49 100644
--- a/gui/gui-analyzer.xml
+++ b/gui/gui-analyzer.xml
@@ -14,45 +14,43 @@
<frame label="Analyzer" expand="1" fill="1">
<hbox>
<vbox spacing="3">
- <hbox>
- <hbox expand="1" fill="1"></hbox>
- <hbox expand="0" fill="0" spacing="12">
- <label text="Accuracy" />
- <knob param="analyzer_accuracy" size="1" expand="0" fill="0"/>
- <label text=" " />
- <label text="Speed" />
- <knob param="analyzer_speed" size="1" expand="0" fill="0"/>
- <label text=" " />
- <label text="Hold" />
- <toggle param="analyzer_hold" size="1" expand="0" fill="0" />
- <label text=" " />
- <label text="Freeze" />
- <toggle param="analyzer_freeze" size="1" expand="0" fill="0" />
- <label text=" " />
- <label text="Display" />
- <toggle param="analyzer_display" size="1" expand="0" fill="0" />
- </hbox>
+ <hbox spacing="12">
+ <label text="Accuracy" />
+ <knob param="analyzer_accuracy" size="1" />
+ <label text=" " />
+ <label text="Speed" />
+ <knob param="analyzer_speed" size="1" />
+ <label text=" " />
+ <label text="Hold" />
+ <toggle param="analyzer_hold" size="1" />
+ <label text=" " />
+ <label text="Freeze" />
+ <toggle param="analyzer_freeze" size="1" />
+ <label text=" " />
+ <label text="Display" />
+ <toggle param="analyzer_display" size="1" />
+ <combo param="analyzer_mode"/>
</hbox>
<line-graph refresh="1" width="560" height="240" param="analyzer_level" expand="1" fill="1" use_fade="1" fade="0.8"/>
<hbox homogeneous="1">
- <combo param="analyzer_smoothing" expand="0" fill="0"/>
- <combo param="analyzer_view" expand="0" fill="0"/>
- <combo param="analyzer_post" expand="0" fill="0"/>
- <combo param="analyzer_scale" expand="0" fill="0"/>
- <combo param="analyzer_mode" expand="0" fill="0"/>
+ <combo param="analyzer_windowing" />
+ <combo param="analyzer_smoothing" />
+ <combo param="analyzer_post" />
+ <combo param="analyzer_scale" />
+ <combo param="analyzer_view" />
</hbox>
<hbox homogeneous="1">
- <label text="Smoothing" align="right" expand="0" fill="0"/>
- <label text="View Mode" expand="0" fill="0"/>
- <label text="Post Processing" expand="0" fill="0"/>
- <label text="Scale" expand="0" fill="0"/>
- <label text="Analyzer Mode" expand="0" fill="0"/>
+ <label text="Windowing" align="right" />
+ <label text="Smoothing" align="right" />
+ <label text="Post Processing" />
+ <label text="Scale" />
+ <label text="View Mode" />
</hbox>
</vbox>
- <vbox spacing="3">
+ <vbox spacing="3" expand="1" fill="1">
<label text="Zoom" />
<vscale param="analyzer_level" inverted="1"/>
<value param="analyzer_level" />
@@ -77,8 +75,8 @@
<label text="Display" expand="0" fill="0"/>
<toggle param="gonio_display" size="1" expand="0" fill="0" />
</hbox>
- <phase-graph refresh="1" size="240" param="gonio_level" expand="0" fill="0"/>
- <combo param="gonio_mode" expand="1" fill="1"/>
+ <phase-graph refresh="1" size="240" param="gonio_level" expand="1" fill="1"/>
+ <combo param="gonio_mode" expand="0" fill="0"/>
<label text="Display Mode" expand="0" fill="0"/>
</vbox>
<vbox spacing="3">
diff --git a/src/calf/custom_ctl.h b/src/calf/custom_ctl.h
index 4ba736c..f60571c 100644
--- a/src/calf/custom_ctl.h
+++ b/src/calf/custom_ctl.h
@@ -49,9 +49,12 @@ struct CalfLineGraph
float fade;
int mode;
cairo_surface_t *cache_surface;
- cairo_surface_t *fade_surface;
+ cairo_surface_t *master_surface;
+ cairo_surface_t *spec_surface;
+ cairo_surface_t *specc_surface;
//GdkPixmap *cache_pixmap;
int last_generation;
+ bool _spectrum;
};
struct CalfLineGraphClass
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index 07434c3..589efc4 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -412,6 +412,7 @@ struct analyzer_metadata: public plugin_metadata<analyzer_metadata>
param_analyzer_level, param_analyzer_mode,
param_analyzer_scale, param_analyzer_post,
param_analyzer_view, param_analyzer_smoothing,
+ param_analyzer_windowing,
param_analyzer_accuracy, param_analyzer_speed,
param_analyzer_display, param_analyzer_hold, param_analyzer_freeze,
param_gonio_level, param_gonio_mode, param_gonio_use_fade, param_gonio_fade, param_gonio_accuracy, param_gonio_display,
diff --git a/src/custom_ctl.cpp b/src/custom_ctl.cpp
index 94ca43f..d80e100 100644
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@ -82,7 +82,7 @@ calf_line_graph_draw_graph( cairo_t *c, float *data, int sx, int sy, int mode =
int ox=5, oy=5;
int _last = 0;
int y;
- for (int i = 0; i < sx; i++)
+ for (int i = 0; i <= sx; i++)
{
y = (int)(oy + sy / 2 - (sy / 2 - 1) * data[i]);
switch(mode) {
@@ -124,6 +124,17 @@ calf_line_graph_draw_graph( cairo_t *c, float *data, int sx, int sy, int mode =
continue;
}
break;
+ case 4:
+ // this mode draws pixels at the bottom of the surface
+ if (i and ((data[i] < INFINITY) or i == sx - 1)) {
+ cairo_set_source_rgba(c, 0.35, 0.4, 0.2, data[i] + 1 / 2.f);
+ cairo_rectangle(c, ox + _last, oy + sy - 1, i - _last, 1);
+ cairo_fill(c);
+ _last = i;
+ } else {
+ continue;
+ }
+ break;
}
}
if(!mode) {
@@ -149,7 +160,9 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
GdkColor sc = { 0, 0, 0, 0 };
bool cache_dirty = 0;
- bool fade_dirty = 0;
+ bool master_dirty = 0;
+ bool spec_dirty = 0;
+ bool specc_dirty = 0;
if( lg->cache_surface == NULL ) {
// looks like its either first call or the widget has been resized.
@@ -164,15 +177,35 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
cache_dirty = 1;
}
- if( lg->fade_surface == NULL ) {
+ if( lg->master_surface == NULL ) {
// looks like its either first call or the widget has been resized.
// create the cache_surface.
cairo_surface_t *window_surface = cairo_get_target( c );
- lg->fade_surface = cairo_surface_create_similar( window_surface,
+ lg->master_surface = cairo_surface_create_similar( window_surface,
CAIRO_CONTENT_COLOR,
widget->allocation.width,
widget->allocation.height );
- fade_dirty = 1;
+ master_dirty = 1;
+ }
+ if( lg->spec_surface == NULL ) {
+ // looks like its either first call or the widget has been resized.
+ // create the cache_surface.
+ cairo_surface_t *window_surface = cairo_get_target( c );
+ lg->spec_surface = cairo_surface_create_similar( window_surface,
+ CAIRO_CONTENT_ALPHA,
+ widget->allocation.width,
+ widget->allocation.height );
+ spec_dirty = 1;
+ }
+ if( lg->specc_surface == NULL ) {
+ // looks like its either first call or the widget has been resized.
+ // create the cache_surface.
+ cairo_surface_t *window_surface = cairo_get_target( c );
+ lg->specc_surface = cairo_surface_create_similar( window_surface,
+ CAIRO_CONTENT_ALPHA,
+ widget->allocation.width,
+ widget->allocation.height );
+ specc_dirty = 1;
}
cairo_select_font_face(c, "Bitstream Vera Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
@@ -202,12 +235,7 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
if( cache_dirty || gen_index != lg->last_generation || lg->source->get_clear_all(lg->source_id)) {
cairo_t *cache_cr = cairo_create( lg->cache_surface );
-
-// if(widget->style->bg_pixmap[0] == NULL) {
- gdk_cairo_set_source_color(cache_cr,&style->bg[GTK_STATE_NORMAL]);
-// } else {
-// gdk_cairo_set_source_pixbuf(cache_cr, GDK_PIXBUF(&style->bg_pixmap[GTK_STATE_NORMAL]), widget->allocation.x, widget->allocation.y + 20);
-// }
+ gdk_cairo_set_source_color(cache_cr,&style->bg[GTK_STATE_NORMAL]);
cairo_paint(cache_cr);
// outer (black)
@@ -283,10 +311,11 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
dot_n = cache_dot_index;
}
- cairo_t *cache_cr = cairo_create( lg->fade_surface );
+ cairo_t *cache_cr = cairo_create( lg->master_surface );
cairo_set_source_surface(cache_cr, lg->cache_surface, 0, 0);
- if(fade_dirty or !lg->use_fade) {
+ if(master_dirty or !lg->use_fade or lg->_spectrum) {
cairo_paint(cache_cr);
+ lg->_spectrum = 0;
} else {
cairo_paint_with_alpha(cache_cr, lg->fade * 0.35 + 0.05);
}
@@ -312,7 +341,44 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
lg->mode = 0;
for(int gn = graph_n; lg->source->get_graph(lg->source_id, gn, data, sx, &cache_cimpl, &lg->mode); gn++)
{
- calf_line_graph_draw_graph( cache_cr, data, sx, sy, lg->mode );
+ if(lg->mode == 4) {
+ lg->_spectrum = 1;
+ cairo_t *spec_cr = cairo_create( lg->spec_surface );
+ cairo_t *specc_cr = cairo_create( lg->specc_surface );
+
+ // clear spec cache
+ cairo_set_operator (specc_cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (specc_cr);
+ cairo_set_operator (specc_cr, CAIRO_OPERATOR_OVER);
+ //cairo_restore (specc_cr);
+
+ // draw last spec to spec cache
+ cairo_set_source_surface(specc_cr, lg->spec_surface, 0, -1);
+ cairo_paint(specc_cr);
+
+ // draw next line to spec cache
+ calf_line_graph_draw_graph( specc_cr, data, sx, sy, lg->mode );
+ cairo_save (specc_cr);
+
+ // draw spec cache to master
+ cairo_set_source_surface(cache_cr, lg->specc_surface, 0, 0);
+ cairo_paint(cache_cr);
+
+ // clear spec
+ cairo_set_operator (spec_cr, CAIRO_OPERATOR_CLEAR);
+ cairo_paint (spec_cr);
+ cairo_set_operator (spec_cr, CAIRO_OPERATOR_OVER);
+ //cairo_restore (spec_cr);
+
+ // draw spec cache to spec
+ cairo_set_source_surface(spec_cr, lg->specc_surface, 0, 0);
+ cairo_paint (spec_cr);
+
+ cairo_destroy(spec_cr);
+ cairo_destroy(specc_cr);
+ } else {
+ calf_line_graph_draw_graph( cache_cr, data, sx, sy, lg->mode );
+ }
}
gdk_cairo_set_source_color(cache_cr, &sc3);
for(int gn = dot_n; lg->source->get_dot(lg->source_id, gn, x, y, size = 3, &cache_cimpl); gn++)
@@ -325,7 +391,7 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_destroy(cache_cr);
}
- calf_line_graph_copy_cache_to_window( lg->fade_surface, c );
+ calf_line_graph_copy_cache_to_window( lg->master_surface, c );
// printf("exposed %p %dx%d %d+%d\n", widget->window, event->area.x, event->area.y, event->area.width, event->area.height);
@@ -371,9 +437,18 @@ calf_line_graph_size_allocate (GtkWidget *widget,
GtkWidgetClass *parent_class = (GtkWidgetClass *) g_type_class_peek_parent( CALF_LINE_GRAPH_GET_CLASS( lg ) );
+ if( lg->master_surface )
+ cairo_surface_destroy( lg->master_surface );
if( lg->cache_surface )
cairo_surface_destroy( lg->cache_surface );
+ if( lg->spec_surface )
+ cairo_surface_destroy( lg->spec_surface );
+ if( lg->specc_surface )
+ cairo_surface_destroy( lg->specc_surface );
+ lg->master_surface = NULL;
lg->cache_surface = NULL;
+ lg->spec_surface = NULL;
+ lg->specc_surface = NULL;
widget->allocation = *allocation;
GtkAllocation &a = widget->allocation;
@@ -410,8 +485,11 @@ calf_line_graph_init (CalfLineGraph *self)
widget->requisition.width = 40;
widget->requisition.height = 40;
self->cache_surface = NULL;
+ self->spec_surface = NULL;
+ self->specc_surface = NULL;
self->last_generation = 0;
self->mode = 0;
+ self->_spectrum = 0;
}
GtkWidget *
diff --git a/src/metadata.cpp b/src/metadata.cpp
index 2736f71..b33f8cf 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -983,11 +983,12 @@ CALF_PLUGIN_INFO(stereo) = { 0x8588, "StereoTools", "Calf Stereo Tools", "Markus
CALF_PORT_NAMES(analyzer) = {"In L", "In R", "Out L", "Out R"};
const char *gonio_mode_names[] = { "Small Dots", "Medium Dots", "Big Dots", "Fields", "Lines (High CPU)" };
-const char *analyzer_mode_names[] = { "Analyzer Average", "Analyzer Left", "Analyzer Right", "Analyzer Stereo", "Stereo Image", "Stereo Difference" };
+const char *analyzer_mode_names[] = { "Analyzer Average", "Analyzer Left", "Analyzer Right", "Analyzer Stereo", "Stereo Image", "Stereo Difference", "Spectralizer Average", "Spectralizer Left", "Spectralizer Right" };
const char *analyzer_smooth_names[] = { "Off", "Falling", "Transition" };
const char *analyzer_post_names[] = { "Normalized", "Average", "Additive", "Denoised Peaks" };
const char *analyzer_view_names[] = { "Bars", "Lines", "Cubic Splines" };
const char *analyzer_scale_names[] = { "Logarithmic", "Linear" };
+const char *analyzer_windowing_names[] = { "Linear", "Hamming", "von Hann", "Blackman", "Blackman-Harris", "Blackman-Nuttall", "Bartlett", "Bartlett-Hann", "Sine", "Tukey", "Lanczos", "Kaiser", "Gauß" };
CALF_PORT_PROPS(analyzer) = {
{ 0, 0, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_L", "Level L" },
{ 0, 0, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_R", "Level R" },
@@ -995,11 +996,12 @@ CALF_PORT_PROPS(analyzer) = {
{ 0, 0, 1, 0, PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_R", "Clip R" },
{ 1.25, 0.5, 2, 0, PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "analyzer_level", "Analyzer Level" },
- { 0, 0, 5, 0, PF_ENUM | PF_CTL_COMBO, analyzer_mode_names, "analyzer_mode", "Analyzer Mode" },
+ { 0, 0, 8, 0, PF_ENUM | PF_CTL_COMBO, analyzer_mode_names, "analyzer_mode", "Analyzer Mode" },
{ 0, 0, 1, 2, PF_ENUM | PF_CTL_COMBO, analyzer_scale_names, "analyzer_scale", "Analyzer Scale" },
{ 2, 0, 3, 0, PF_ENUM | PF_CTL_COMBO, analyzer_post_names, "analyzer_post", "Analyzer Post FFT" },
{ 1, 0, 1, 2, PF_ENUM | PF_CTL_COMBO , analyzer_view_names, "analyzer_view", "Analyzer View" },
{ 1, 0, 2, 0, PF_ENUM | PF_CTL_COMBO, analyzer_smooth_names, "analyzer_smoothing", "Analyzer Smoothing" },
+ { 0, 0, 12, 2, PF_ENUM | PF_CTL_COMBO, analyzer_windowing_names, "analyzer_windowing", "Analyzer Windowing" },
{ 6, 2, 8, 0, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "analyzer_accuracy", "Analyzer Accuracy" },
{ 13, 1, 15, 0, PF_INT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "analyzer_speed", "Analyzer Speed" },
{ 1, 0, 1, 0, PF_BOOL | PF_CTL_TOGGLE, NULL, "analyzer_display", "Analyzer Display" },
diff --git a/src/modules.cpp b/src/modules.cpp
index 22c20c5..8898f45 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -31,6 +31,7 @@ using namespace dsp;
using namespace calf_plugins;
#define SET_IF_CONNECTED(name) if (params[AM::param_##name] != NULL) *params[AM::param_##name] = name;
+#define sinc(x) (!x) ? 1 : sin(M_PI * x)/(M_PI * x);
///////////////////////////////////////////////////////////////////////////////////////////////
@@ -1067,6 +1068,8 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
or (subindex == 4 and (_param_mode == 3 or _param_mode == 4)) \
or (subindex == 1 and _param_mode == 5) \
+
+ or (subindex == 1 and _param_mode > 5 and _param_mode < 9) \
) {
// stop drawing when all curves have been drawn according to the mode
// and hold settings
@@ -1084,7 +1087,10 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
// there's no falling for difference mode, only smoothing
_param_smooth = 2;
}
-
+ if(_param_mode > 5 and _param_mode < 9) {
+ // there's no smoothing for spectralizer mode
+ //_param_smooth = 0;
+ }
if(subindex == 0) {
// #####################################################################
@@ -1107,6 +1113,119 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
float L = fft_buffer[_fpos];
float R = fft_buffer[_fpos + 1];
+ // #######################################
+ // Do some windowing functions on the
+ // buffer
+ // #######################################
+ int _m = 2;
+ float _f = 1.f;
+ float _a, a0, a1, a2, a3;
+ switch((int)*params[param_analyzer_windowing]) {
+ case 0:
+ default:
+ // Linear
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 1:
+ // Hamming
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 2:
+ // von Hann
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 3:
+ // Blackman
+ _a = 0.16;
+ a0 = 1.f - _a / 2.f;
+ a1 = 0.5;
+ a2 = _a / 2.f;
+ _f = a0 + a1 * cos((2.f * M_PI * i) / points - 1) + \
+ a2 * cos((4.f * M_PI * i) / points - 1);
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 4:
+ // Blackman-Harris
+ a0 = 0.35875;
+ a1 = 0.48829;
+ a2 = 0.14128;
+ a3 = 0.01168;
+ _f = a0 - a1 * cos((2.f * M_PI * i) / points - 1) + \
+ a2 * cos((4.f * M_PI * i) / points - 1) - \
+ a3 * cos((6.f * M_PI * i) / points - 1);
+ L *= _f;
+ if(_param_mode > _m)
+ R *= _f;
+ break;
+ case 5:
+ // Blackman-Nuttall
+ a0 = 0.3653819;
+ a1 = 0.4891775;
+ a2 = 0.1365995;
+ a3 = 0.0106411;
+ _f = a0 - a1 * cos((2.f * M_PI * i) / points - 1) + \
+ a2 * cos((4.f * M_PI * i) / points - 1) - \
+ a3 * cos((6.f * M_PI * i) / points - 1);
+ L *= _f;
+ if(_param_mode > _m)
+ R *= _f;
+ break;
+ case 6:
+ // Bartlett
+ //_f = (2.f / (sx - 1)) * ((sx - 1) / 2.f
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 7:
+ // Bartlett-Hann
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 8:
+ // Sine
+ _f = sin((M_PI * i) / (points - 1));
+ L *= _f;
+ if(_param_mode > _m)
+ R *= _f;
+ break;
+ case 9:
+ // Tukey
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 10:
+ // Lanczos
+ _f = sinc((2.f * i) / (points - 1) - 1);
+ L *= _f;
+ if(_param_mode > _m)
+ R *= _f;
+ break;
+ case 11:
+ // Kaiser
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ case 12:
+ // Gauß
+ L = L;
+ if(_param_mode > _m)
+ R = R;
+ break;
+ }
+
+
// perhaps we need to compute two FFT's, so store left and right
// channel in case we need only one FFT, the left channel is
// used as 'standard'"
@@ -1115,6 +1234,7 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
switch(_param_mode) {
case 0:
+ case 6:
// average (mode 0)
valL = (L + R) / 2;
valR = (L + R) / 2;
@@ -1127,6 +1247,7 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
valR = R;
break;
case 2:
+ case 8:
// right channel (mode 2)
valL = R;
valR = L;
@@ -1316,18 +1437,23 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
// #######################################
if(subindex == 0) {
float _fdelta = 0.91;
+ if(_param_mode > 5 and _param_mode < 9)
+ _fdelta = .99f;
+ float _ffactor = 2000.f;
+ if(_param_mode > 5 and _param_mode < 9)
+ _ffactor = 50.f;
if(_param_smooth == 2) {
// smoothing
if(fftdone) {
// rebuild delta values after fft was done
- if(_param_mode < 5) {
+ if(_param_mode < 5 or _param_mode > 5) {
fft_deltaL[iter] = pow(fabs(fft_outL[iter]) / fabs(fft_smoothL[iter]), 1.f / _param_speed);
} else {
fft_deltaL[iter] = (posneg * fabs(fft_outL[iter]) - fft_smoothL[iter]) / _param_speed;
}
} else {
// change fft_smooth according to delta
- if(_param_mode < 5) {
+ if(_param_mode < 5 or _param_mode > 5) {
fft_smoothL[iter] *= fft_deltaL[iter];
} else {
fft_smoothL[iter] += fft_deltaL[iter];
@@ -1343,7 +1469,7 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
fft_smoothL[iter] *= fft_deltaL[iter];
if(fft_deltaL[iter] > _fdelta) {
- fft_deltaL[iter] *= 1.f - (16.f - _param_speed) / 2000.f;
+ fft_deltaL[iter] *= 1.f - (16.f - _param_speed) / _ffactor;
}
}
@@ -1391,7 +1517,8 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
valL = fft_freezeL[iter];
valR = fft_freezeR[iter];
} else if ((subindex == 1 and _param_mode < 3) \
- or subindex > 1) {
+ or subindex > 1 \
+ or (_param_mode > 5 and *params[param_analyzer_hold])) {
// we draw the hold buffer
valL = fft_holdL[iter];
valR = fft_holdR[iter];
@@ -1602,7 +1729,7 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
// 2: boxes (little things on the values position
// 3: centered bars (0dB is centered in y direction)
- if (_param_mode > 3) {
+ if (_param_mode > 3 and _param_mode < 6) {
// centered viewing modes like stereo image and stereo difference
if(!*params[param_analyzer_view]) {
// boxes
@@ -1617,6 +1744,9 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
// lines
*mode = 0;
}
+ } else if (_param_mode > 5 and _param_mode < 9) {
+ // spectrum analyzer
+ *mode = 4;
} else if(!*params[param_analyzer_view]) {
// bars
if((subindex == 0 and _param_mode < 3) or (subindex <= 1 and _param_mode == 3)) {
@@ -1639,9 +1769,14 @@ bool analyzer_audio_module::get_gridline(int index, int subindex, float &pos, bo
bool out;
if(*params[param_analyzer_mode] <= 3)
out = get_freq_gridline(subindex, pos, vertical, legend, context, true, pow(64, *params[param_analyzer_level]), 0.5f);
- else
+ else if (*params[param_analyzer_mode] < 6)
out = get_freq_gridline(subindex, pos, vertical, legend, context, true, 16, 0.f);
- if(*params[param_analyzer_mode] > 3 and not vertical) {
+ else if (*params[param_analyzer_mode] < 9)
+ out = get_freq_gridline(subindex, pos, vertical, legend, context, true, 0, 1.1f);
+ else
+ out = false;
+
+ if(*params[param_analyzer_mode] > 3 and *params[param_analyzer_mode] < 6 and not vertical) {
if(subindex == 30)
legend="L";
else if(subindex == 34)
@@ -1649,6 +1784,9 @@ bool analyzer_audio_module::get_gridline(int index, int subindex, float &pos, bo
else
legend = "";
}
+ if(*params[param_analyzer_mode] > 5 and *params[param_analyzer_mode] < 9 and not vertical) {
+ legend = "";
+ }
return out;
}
bool analyzer_audio_module::get_clear_all(int index) const {
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list