mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
update spandsp to use newest snapshot http://www.soft-switch.org/downloads/snapshots/spandsp/spandsp-20080910.tar.gz
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9493 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: line_model_monitor.cpp,v 1.4 2008/05/27 15:08:21 steveu Exp $
|
||||
* $Id: line_model_monitor.cpp,v 1.5 2008/09/08 16:10:41 steveu Exp $
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -56,44 +56,49 @@
|
||||
#include "spandsp.h"
|
||||
#include "line_model_monitor.h"
|
||||
|
||||
Fl_Double_Window *w;
|
||||
struct line_model_monitor_s
|
||||
{
|
||||
Fl_Double_Window *w;
|
||||
|
||||
Fl_Audio_Meter *audio_meter;
|
||||
Fl_Audio_Meter *audio_meter;
|
||||
|
||||
Fl_Group *c_spec;
|
||||
Fl_Group *c_right;
|
||||
Fl_Group *c_can;
|
||||
Fl_Group *c_line_model;
|
||||
Fl_Group *c_spec;
|
||||
Fl_Group *c_right;
|
||||
Fl_Group *c_can;
|
||||
Fl_Group *c_line_model;
|
||||
|
||||
Ca_Canvas *canvas_spec;
|
||||
Ca_X_Axis *spec_freq;
|
||||
Ca_Y_Axis *spec_amp;
|
||||
Ca_Line *spec_re = NULL;
|
||||
double spec_re_plot[2*512];
|
||||
Ca_Canvas *canvas_spec;
|
||||
Ca_X_Axis *spec_freq;
|
||||
Ca_Y_Axis *spec_amp;
|
||||
Ca_Line *spec_re;
|
||||
double spec_re_plot[2*512];
|
||||
|
||||
Ca_Canvas *canvas_can;
|
||||
Ca_X_Axis *can_x;
|
||||
Ca_Y_Axis *can_y;
|
||||
Ca_Line *can_re = NULL;
|
||||
double can_re_plot[512];
|
||||
Ca_Canvas *canvas_can;
|
||||
Ca_X_Axis *can_x;
|
||||
Ca_Y_Axis *can_y;
|
||||
Ca_Line *can_re;
|
||||
double can_re_plot[512];
|
||||
|
||||
Ca_Canvas *canvas_line_model;
|
||||
Ca_X_Axis *line_model_x;
|
||||
Ca_Y_Axis *line_model_y;
|
||||
Ca_Line *line_model_re = NULL;
|
||||
double line_model_re_plot[512];
|
||||
Ca_Canvas *canvas_line_model;
|
||||
Ca_X_Axis *line_model_x;
|
||||
Ca_Y_Axis *line_model_y;
|
||||
Ca_Line *line_model_re;
|
||||
double line_model_re_plot[512];
|
||||
|
||||
int in_ptr;
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
double in[1024][2];
|
||||
double out[1024][2];
|
||||
#else
|
||||
fftw_complex in[1024];
|
||||
fftw_complex out[1024];
|
||||
#endif
|
||||
fftw_plan p;
|
||||
};
|
||||
|
||||
static int skip = 0;
|
||||
|
||||
int in_ptr;
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
double in[1024][2];
|
||||
double out[1024][2];
|
||||
#else
|
||||
fftw_complex in[1024];
|
||||
fftw_complex out[1024];
|
||||
#endif
|
||||
fftw_plan p;
|
||||
static struct line_model_monitor_s model;
|
||||
static struct line_model_monitor_s *s = &model;
|
||||
|
||||
int line_model_monitor_can_update(const float *coeffs, int len)
|
||||
{
|
||||
@@ -101,25 +106,25 @@ int line_model_monitor_can_update(const float *coeffs, int len)
|
||||
float min;
|
||||
float max;
|
||||
|
||||
if (can_re)
|
||||
delete can_re;
|
||||
if (s->can_re)
|
||||
delete s->can_re;
|
||||
|
||||
canvas_can->current(canvas_can);
|
||||
s->canvas_can->current(s->canvas_can);
|
||||
i = 0;
|
||||
min = coeffs[i];
|
||||
max = coeffs[i];
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
can_re_plot[2*i] = i;
|
||||
can_re_plot[2*i + 1] = coeffs[i];
|
||||
s->can_re_plot[2*i] = i;
|
||||
s->can_re_plot[2*i + 1] = coeffs[i];
|
||||
if (min > coeffs[i])
|
||||
min = coeffs[i];
|
||||
if (max < coeffs[i])
|
||||
max = coeffs[i];
|
||||
}
|
||||
can_y->maximum((max == min) ? max + 0.2 : max);
|
||||
can_y->minimum(min);
|
||||
can_re = new Ca_Line(len, can_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
s->can_y->maximum((max == min) ? max + 0.2 : max);
|
||||
s->can_y->minimum(min);
|
||||
s->can_re = new Ca_Line(len, s->can_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
if (++skip >= 100)
|
||||
{
|
||||
skip = 0;
|
||||
@@ -135,25 +140,25 @@ int line_model_monitor_line_model_update(const float *coeffs, int len)
|
||||
float min;
|
||||
float max;
|
||||
|
||||
if (line_model_re)
|
||||
delete line_model_re;
|
||||
if (s->line_model_re)
|
||||
delete s->line_model_re;
|
||||
|
||||
canvas_line_model->current(canvas_line_model);
|
||||
s->canvas_line_model->current(s->canvas_line_model);
|
||||
i = 0;
|
||||
min = coeffs[i];
|
||||
max = coeffs[i];
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
line_model_re_plot[2*i] = i;
|
||||
line_model_re_plot[2*i + 1] = coeffs[i];
|
||||
s->line_model_re_plot[2*i] = i;
|
||||
s->line_model_re_plot[2*i + 1] = coeffs[i];
|
||||
if (min > coeffs[i])
|
||||
min = coeffs[i];
|
||||
if (max < coeffs[i])
|
||||
max = coeffs[i];
|
||||
}
|
||||
line_model_y->maximum((max == min) ? max + 0.2 : max);
|
||||
line_model_y->minimum(min);
|
||||
line_model_re = new Ca_Line(len, line_model_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
s->line_model_y->maximum((max == min) ? max + 0.2 : max);
|
||||
s->line_model_y->minimum(min);
|
||||
s->line_model_re = new Ca_Line(len, s->line_model_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
if (++skip >= 100)
|
||||
{
|
||||
skip = 0;
|
||||
@@ -169,18 +174,18 @@ int line_model_monitor_line_spectrum_update(const int16_t amp[], int len)
|
||||
int x;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
audio_meter->sample(amp[i]/32768.0);
|
||||
s->audio_meter->sample(amp[i]/32768.0);
|
||||
|
||||
if (in_ptr + len < 512)
|
||||
if (s->in_ptr + len < 512)
|
||||
{
|
||||
/* Just add this fragment to the buffer. */
|
||||
for (i = 0; i < len; i++)
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
in[in_ptr + i][0] = amp[i];
|
||||
s->in[s->in_ptr + i][0] = amp[i];
|
||||
#else
|
||||
in[in_ptr + i].re = amp[i];
|
||||
s->in[s->in_ptr + i].re = amp[i];
|
||||
#endif
|
||||
in_ptr += len;
|
||||
s->in_ptr += len;
|
||||
return 0;
|
||||
}
|
||||
if (len >= 512)
|
||||
@@ -190,9 +195,9 @@ int line_model_monitor_line_spectrum_update(const int16_t amp[], int len)
|
||||
x = len - 512;
|
||||
for (i = 0; i < 512; i++)
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
in[i][0] = amp[x + i];
|
||||
s->in[i][0] = amp[x + i];
|
||||
#else
|
||||
in[i].re = amp[x + i];
|
||||
s->in[i].re = amp[x + i];
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -201,36 +206,36 @@ int line_model_monitor_line_spectrum_update(const int16_t amp[], int len)
|
||||
x = 512 - len;
|
||||
for (i = 0; i < x; i++)
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
in[i][0] = in[in_ptr - x + i][0];
|
||||
s->in[i][0] = s->in[s->in_ptr - x + i][0];
|
||||
#else
|
||||
in[i].re = in[in_ptr - x + i].re;
|
||||
s->in[i].re = s->in[s->in_ptr - x + i].re;
|
||||
#endif
|
||||
for (i = x; i < 512; i++)
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
in[i][0] = amp[i - x];
|
||||
s->in[i][0] = amp[i - x];
|
||||
#else
|
||||
in[i].re = amp[i - x];
|
||||
s->in[i].re = amp[i - x];
|
||||
#endif
|
||||
}
|
||||
in_ptr = 0;
|
||||
s->in_ptr = 0;
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
fftw_execute(p);
|
||||
fftw_execute(s->p);
|
||||
#else
|
||||
fftw_one(p, in, out);
|
||||
fftw_one(s->p, s->in, s->out);
|
||||
#endif
|
||||
if (spec_re)
|
||||
delete spec_re;
|
||||
canvas_spec->current(canvas_spec);
|
||||
if (s->spec_re)
|
||||
delete s->spec_re;
|
||||
s->canvas_spec->current(s->canvas_spec);
|
||||
for (i = 0; i < 512; i++)
|
||||
{
|
||||
spec_re_plot[2*i] = i*4000.0/512.0;
|
||||
s->spec_re_plot[2*i] = i*4000.0/512.0;
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
spec_re_plot[2*i + 1] = 20.0*log10(sqrt(out[i][0]*out[i][0] + out[i][1]*out[i][1])/(256.0*32768)) + 3.14;
|
||||
s->spec_re_plot[2*i + 1] = 20.0*log10(sqrt(s->out[i][0]*s->out[i][0] + s->out[i][1]*s->out[i][1])/(256.0*32768)) + 3.14;
|
||||
#else
|
||||
spec_re_plot[2*i + 1] = 20.0*log10(sqrt(out[i].re*out[i].re + out[i].im*out[i].im)/(256.0*32768)) + 3.14;
|
||||
s->spec_re_plot[2*i + 1] = 20.0*log10(sqrt(s->out[i].re*s->out[i].re + s->out[i].im*s->out[i].im)/(256.0*32768)) + 3.14;
|
||||
#endif
|
||||
}
|
||||
spec_re = new Ca_Line(512, spec_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
s->spec_re = new Ca_Line(512, s->spec_re_plot, 0, 0, FL_BLUE, CA_NO_POINT);
|
||||
Fl::check();
|
||||
return 0;
|
||||
}
|
||||
@@ -243,167 +248,171 @@ int start_line_model_monitor(int len)
|
||||
float y;
|
||||
int i;
|
||||
|
||||
w = new Fl_Double_Window(850, 400, "Telephone line model monitor");
|
||||
s->w = new Fl_Double_Window(850, 400, "Telephone line model monitor");
|
||||
|
||||
c_spec = new Fl_Group(0, 0, 380, 400);
|
||||
c_spec->box(FL_DOWN_BOX);
|
||||
c_spec->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
s->c_spec = new Fl_Group(0, 0, 380, 400);
|
||||
s->c_spec->box(FL_DOWN_BOX);
|
||||
s->c_spec->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
|
||||
canvas_spec = new Ca_Canvas(60, 30, 300, 300, "Spectrum");
|
||||
canvas_spec->box(FL_PLASTIC_DOWN_BOX);
|
||||
canvas_spec->color(7);
|
||||
canvas_spec->align(FL_ALIGN_TOP);
|
||||
canvas_spec->border(15);
|
||||
s->canvas_spec = new Ca_Canvas(60, 30, 300, 300, "Spectrum");
|
||||
s->canvas_spec->box(FL_PLASTIC_DOWN_BOX);
|
||||
s->canvas_spec->color(7);
|
||||
s->canvas_spec->align(FL_ALIGN_TOP);
|
||||
s->canvas_spec->border(15);
|
||||
|
||||
spec_freq = new Ca_X_Axis(65, 330, 290, 30, "Freq (Hz)");
|
||||
spec_freq->align(FL_ALIGN_BOTTOM);
|
||||
spec_freq->minimum(0);
|
||||
spec_freq->maximum(4000);
|
||||
spec_freq->label_format("%g");
|
||||
spec_freq->minor_grid_color(fl_gray_ramp(20));
|
||||
spec_freq->major_grid_color(fl_gray_ramp(15));
|
||||
spec_freq->label_grid_color(fl_gray_ramp(10));
|
||||
spec_freq->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
spec_freq->minor_grid_style(FL_DOT);
|
||||
spec_freq->major_step(5);
|
||||
spec_freq->label_step(1);
|
||||
spec_freq->axis_color(FL_BLACK);
|
||||
spec_freq->axis_align(CA_BOTTOM | CA_LINE);
|
||||
s->spec_freq = new Ca_X_Axis(65, 330, 290, 30, "Freq (Hz)");
|
||||
s->spec_freq->align(FL_ALIGN_BOTTOM);
|
||||
s->spec_freq->minimum(0);
|
||||
s->spec_freq->maximum(4000);
|
||||
s->spec_freq->label_format("%g");
|
||||
s->spec_freq->minor_grid_color(fl_gray_ramp(20));
|
||||
s->spec_freq->major_grid_color(fl_gray_ramp(15));
|
||||
s->spec_freq->label_grid_color(fl_gray_ramp(10));
|
||||
s->spec_freq->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->spec_freq->minor_grid_style(FL_DOT);
|
||||
s->spec_freq->major_step(5);
|
||||
s->spec_freq->label_step(1);
|
||||
s->spec_freq->axis_color(FL_BLACK);
|
||||
s->spec_freq->axis_align(CA_BOTTOM | CA_LINE);
|
||||
|
||||
spec_amp = new Ca_Y_Axis(20, 35, 40, 290, "Amp (dBmO)");
|
||||
spec_amp->align(FL_ALIGN_LEFT);
|
||||
spec_amp->minimum(-80.0);
|
||||
spec_amp->maximum(10.0);
|
||||
spec_amp->minor_grid_color(fl_gray_ramp(20));
|
||||
spec_amp->major_grid_color(fl_gray_ramp(15));
|
||||
spec_amp->label_grid_color(fl_gray_ramp(10));
|
||||
//spec_amp->grid_visible(CA_MINOR_TICK | CA_MAJOR_TICK | CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
spec_amp->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
spec_amp->minor_grid_style(FL_DOT);
|
||||
spec_amp->major_step(5);
|
||||
spec_amp->label_step(1);
|
||||
spec_amp->axis_color(FL_BLACK);
|
||||
s->spec_amp = new Ca_Y_Axis(20, 35, 40, 290, "Amp (dBmO)");
|
||||
s->spec_amp->align(FL_ALIGN_LEFT);
|
||||
s->spec_amp->minimum(-80.0);
|
||||
s->spec_amp->maximum(10.0);
|
||||
s->spec_amp->minor_grid_color(fl_gray_ramp(20));
|
||||
s->spec_amp->major_grid_color(fl_gray_ramp(15));
|
||||
s->spec_amp->label_grid_color(fl_gray_ramp(10));
|
||||
//s->spec_amp->grid_visible(CA_MINOR_TICK | CA_MAJOR_TICK | CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->spec_amp->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->spec_amp->minor_grid_style(FL_DOT);
|
||||
s->spec_amp->major_step(5);
|
||||
s->spec_amp->label_step(1);
|
||||
s->spec_amp->axis_color(FL_BLACK);
|
||||
|
||||
spec_amp->current();
|
||||
s->spec_amp->current();
|
||||
s->spec_re = NULL;
|
||||
|
||||
c_spec->end();
|
||||
s->c_spec->end();
|
||||
|
||||
c_right = new Fl_Group(440, 0, 465, 405);
|
||||
s->c_right = new Fl_Group(440, 0, 465, 405);
|
||||
|
||||
c_can = new Fl_Group(380, 0, 415, 200);
|
||||
c_can->box(FL_DOWN_BOX);
|
||||
c_can->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
c_can->current();
|
||||
s->c_can = new Fl_Group(380, 0, 415, 200);
|
||||
s->c_can->box(FL_DOWN_BOX);
|
||||
s->c_can->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
s->c_can->current();
|
||||
|
||||
canvas_can = new Ca_Canvas(460, 35, 300, 100, "??? coefficients");
|
||||
canvas_can->box(FL_PLASTIC_DOWN_BOX);
|
||||
canvas_can->color(7);
|
||||
canvas_can->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(canvas_can);
|
||||
canvas_can->border(15);
|
||||
s->canvas_can = new Ca_Canvas(460, 35, 300, 100, "??? coefficients");
|
||||
s->canvas_can->box(FL_PLASTIC_DOWN_BOX);
|
||||
s->canvas_can->color(7);
|
||||
s->canvas_can->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(s->canvas_can);
|
||||
s->canvas_can->border(15);
|
||||
|
||||
can_x = new Ca_X_Axis(465, 135, 290, 30, "Tap");
|
||||
can_x->align(FL_ALIGN_BOTTOM);
|
||||
can_x->minimum(0.0);
|
||||
can_x->maximum((float) len);
|
||||
can_x->label_format("%g");
|
||||
can_x->minor_grid_color(fl_gray_ramp(20));
|
||||
can_x->major_grid_color(fl_gray_ramp(15));
|
||||
can_x->label_grid_color(fl_gray_ramp(10));
|
||||
can_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
can_x->minor_grid_style(FL_DOT);
|
||||
can_x->major_step(5);
|
||||
can_x->label_step(1);
|
||||
can_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
can_x->axis_color(FL_BLACK);
|
||||
can_x->current();
|
||||
s->can_x = new Ca_X_Axis(465, 135, 290, 30, "Tap");
|
||||
s->can_x->align(FL_ALIGN_BOTTOM);
|
||||
s->can_x->minimum(0.0);
|
||||
s->can_x->maximum((float) len);
|
||||
s->can_x->label_format("%g");
|
||||
s->can_x->minor_grid_color(fl_gray_ramp(20));
|
||||
s->can_x->major_grid_color(fl_gray_ramp(15));
|
||||
s->can_x->label_grid_color(fl_gray_ramp(10));
|
||||
s->can_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->can_x->minor_grid_style(FL_DOT);
|
||||
s->can_x->major_step(5);
|
||||
s->can_x->label_step(1);
|
||||
s->can_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
s->can_x->axis_color(FL_BLACK);
|
||||
s->can_x->current();
|
||||
|
||||
can_y = new Ca_Y_Axis(420, 40, 40, 90, "Amp");
|
||||
can_y->align(FL_ALIGN_LEFT);
|
||||
can_y->minimum(-0.1);
|
||||
can_y->maximum(0.1);
|
||||
can_y->minor_grid_color(fl_gray_ramp(20));
|
||||
can_y->major_grid_color(fl_gray_ramp(15));
|
||||
can_y->label_grid_color(fl_gray_ramp(10));
|
||||
can_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
can_y->minor_grid_style(FL_DOT);
|
||||
can_y->major_step(5);
|
||||
can_y->label_step(1);
|
||||
can_y->axis_color(FL_BLACK);
|
||||
can_y->current();
|
||||
s->can_y = new Ca_Y_Axis(420, 40, 40, 90, "Amp");
|
||||
s->can_y->align(FL_ALIGN_LEFT);
|
||||
s->can_y->minimum(-0.1);
|
||||
s->can_y->maximum(0.1);
|
||||
s->can_y->minor_grid_color(fl_gray_ramp(20));
|
||||
s->can_y->major_grid_color(fl_gray_ramp(15));
|
||||
s->can_y->label_grid_color(fl_gray_ramp(10));
|
||||
s->can_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->can_y->minor_grid_style(FL_DOT);
|
||||
s->can_y->major_step(5);
|
||||
s->can_y->label_step(1);
|
||||
s->can_y->axis_color(FL_BLACK);
|
||||
s->can_y->current();
|
||||
|
||||
c_can->end();
|
||||
s->c_can->end();
|
||||
|
||||
c_line_model = new Fl_Group(380, 200, 415, 200);
|
||||
c_line_model->box(FL_DOWN_BOX);
|
||||
c_line_model->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
c_line_model->current();
|
||||
s->can_re = NULL;
|
||||
|
||||
canvas_line_model = new Ca_Canvas(460, 235, 300, 100, "Line impulse response model");
|
||||
canvas_line_model->box(FL_PLASTIC_DOWN_BOX);
|
||||
canvas_line_model->color(7);
|
||||
canvas_line_model->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(canvas_line_model);
|
||||
canvas_line_model->border(15);
|
||||
s->c_line_model = new Fl_Group(380, 200, 415, 200);
|
||||
s->c_line_model->box(FL_DOWN_BOX);
|
||||
s->c_line_model->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
|
||||
s->c_line_model->current();
|
||||
|
||||
line_model_x = new Ca_X_Axis(465, 335, 290, 30, "Tap");
|
||||
line_model_x->align(FL_ALIGN_BOTTOM);
|
||||
line_model_x->minimum(0.0);
|
||||
line_model_x->maximum((float) len);
|
||||
line_model_x->label_format("%g");
|
||||
line_model_x->minor_grid_color(fl_gray_ramp(20));
|
||||
line_model_x->major_grid_color(fl_gray_ramp(15));
|
||||
line_model_x->label_grid_color(fl_gray_ramp(10));
|
||||
line_model_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
line_model_x->minor_grid_style(FL_DOT);
|
||||
line_model_x->major_step(5);
|
||||
line_model_x->label_step(1);
|
||||
line_model_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
line_model_x->axis_color(FL_BLACK);
|
||||
line_model_x->current();
|
||||
s->canvas_line_model = new Ca_Canvas(460, 235, 300, 100, "Line impulse response model");
|
||||
s->canvas_line_model->box(FL_PLASTIC_DOWN_BOX);
|
||||
s->canvas_line_model->color(7);
|
||||
s->canvas_line_model->align(FL_ALIGN_TOP);
|
||||
Fl_Group::current()->resizable(s->canvas_line_model);
|
||||
s->canvas_line_model->border(15);
|
||||
|
||||
line_model_y = new Ca_Y_Axis(420, 240, 40, 90, "Amp");
|
||||
line_model_y->align(FL_ALIGN_LEFT);
|
||||
line_model_y->minimum(-0.1);
|
||||
line_model_y->maximum(0.1);
|
||||
line_model_y->minor_grid_color(fl_gray_ramp(20));
|
||||
line_model_y->major_grid_color(fl_gray_ramp(15));
|
||||
line_model_y->label_grid_color(fl_gray_ramp(10));
|
||||
line_model_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
line_model_y->minor_grid_style(FL_DOT);
|
||||
line_model_y->major_step(5);
|
||||
line_model_y->label_step(1);
|
||||
line_model_y->axis_color(FL_BLACK);
|
||||
line_model_y->current();
|
||||
s->line_model_x = new Ca_X_Axis(465, 335, 290, 30, "Tap");
|
||||
s->line_model_x->align(FL_ALIGN_BOTTOM);
|
||||
s->line_model_x->minimum(0.0);
|
||||
s->line_model_x->maximum((float) len);
|
||||
s->line_model_x->label_format("%g");
|
||||
s->line_model_x->minor_grid_color(fl_gray_ramp(20));
|
||||
s->line_model_x->major_grid_color(fl_gray_ramp(15));
|
||||
s->line_model_x->label_grid_color(fl_gray_ramp(10));
|
||||
s->line_model_x->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->line_model_x->minor_grid_style(FL_DOT);
|
||||
s->line_model_x->major_step(5);
|
||||
s->line_model_x->label_step(1);
|
||||
s->line_model_x->axis_align(CA_BOTTOM | CA_LINE);
|
||||
s->line_model_x->axis_color(FL_BLACK);
|
||||
s->line_model_x->current();
|
||||
|
||||
c_line_model->end();
|
||||
s->line_model_y = new Ca_Y_Axis(420, 240, 40, 90, "Amp");
|
||||
s->line_model_y->align(FL_ALIGN_LEFT);
|
||||
s->line_model_y->minimum(-0.1);
|
||||
s->line_model_y->maximum(0.1);
|
||||
s->line_model_y->minor_grid_color(fl_gray_ramp(20));
|
||||
s->line_model_y->major_grid_color(fl_gray_ramp(15));
|
||||
s->line_model_y->label_grid_color(fl_gray_ramp(10));
|
||||
s->line_model_y->grid_visible(CA_LABEL_GRID | CA_ALWAYS_VISIBLE);
|
||||
s->line_model_y->minor_grid_style(FL_DOT);
|
||||
s->line_model_y->major_step(5);
|
||||
s->line_model_y->label_step(1);
|
||||
s->line_model_y->axis_color(FL_BLACK);
|
||||
s->line_model_y->current();
|
||||
s->line_model_re = NULL;
|
||||
|
||||
audio_meter = new Fl_Audio_Meter(810, 40, 10, 250, "");
|
||||
audio_meter->box(FL_PLASTIC_UP_BOX);
|
||||
audio_meter->type(FL_VERT_AUDIO_METER);
|
||||
s->c_line_model->end();
|
||||
|
||||
c_right->end();
|
||||
s->audio_meter = new Fl_Audio_Meter(810, 40, 10, 250, "");
|
||||
s->audio_meter->box(FL_PLASTIC_UP_BOX);
|
||||
s->audio_meter->type(FL_VERT_AUDIO_METER);
|
||||
|
||||
Fl_Group::current()->resizable(c_right);
|
||||
w->end();
|
||||
w->show();
|
||||
s->c_right->end();
|
||||
|
||||
Fl_Group::current()->resizable(s->c_right);
|
||||
s->w->end();
|
||||
s->w->show();
|
||||
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
p = fftw_plan_dft_1d(1024, in, out, FFTW_BACKWARD, FFTW_ESTIMATE);
|
||||
s->p = fftw_plan_dft_1d(1024, s->in, s->out, FFTW_BACKWARD, FFTW_ESTIMATE);
|
||||
for (i = 0; i < 1024; i++)
|
||||
{
|
||||
in[i][0] = 0.0;
|
||||
in[i][1] = 0.0;
|
||||
s->in[i][0] = 0.0;
|
||||
s->in[i][1] = 0.0;
|
||||
}
|
||||
#else
|
||||
p = fftw_create_plan(1024, FFTW_BACKWARD, FFTW_ESTIMATE);
|
||||
s->p = fftw_create_plan(1024, FFTW_BACKWARD, FFTW_ESTIMATE);
|
||||
for (i = 0; i < 1024; i++)
|
||||
{
|
||||
in[i].re = 0.0;
|
||||
in[i].im = 0.0;
|
||||
s->in[i].re = 0.0;
|
||||
s->in[i].im = 0.0;
|
||||
}
|
||||
#endif
|
||||
in_ptr = 0;
|
||||
s->in_ptr = 0;
|
||||
|
||||
Fl::check();
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user