00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SPECTRALMETERWIDGET_H
00024 #define SPECTRALMETERWIDGET_H
00025
00026 #include "MeterWidget.h"
00027
00028 #include <QVector>
00029 #include "ui_SpectralMeterConfigWidget.h"
00030 #include <QDialog>
00031
00032 class Sheet;
00033 class Project;
00034 class QRect;
00035 class QPixmap;
00036 class Command;
00037 class SpectralMeterView;
00038
00039
00040 class SpectralMeterConfigWidget : public QDialog, private Ui::SpectralMeterConfigWidget
00041 {
00042 Q_OBJECT
00043
00044 public:
00045 SpectralMeterConfigWidget(QWidget* parent = 0);
00046
00047 private:
00048 void save_configuration();
00049 void load_configuration();
00050
00051 private slots:
00052 void on_buttonClose_clicked();
00053 void on_buttonApply_clicked();
00054 void advancedButton_toggled(bool);
00055
00056 signals:
00057 void configChanged();
00058
00059 };
00060
00061 class SpectralMeterWidget : public MeterWidget
00062 {
00063 public:
00064 SpectralMeterWidget(QWidget* parent);
00065
00066 private:
00067 SpectralMeterView* get_item();
00068 };
00069
00070
00071 class SpectralMeterView : public MeterView
00072 {
00073 Q_OBJECT
00074
00075 Q_CLASSINFO("edit_properties", tr("Settings..."))
00076 Q_CLASSINFO("set_mode", tr("Toggle avarage curve"))
00077 Q_CLASSINFO("reset", tr("Reset average curve"))
00078 Q_CLASSINFO("export_avarage_curve", tr("Export avarage curve"))
00079 Q_CLASSINFO("screen_capture", tr("Capture Screen"))
00080
00081
00082 public:
00083 SpectralMeterView(SpectralMeterWidget* widget);
00084
00085 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00086 virtual void resize();
00087
00088 private:
00089 QVector<float> specl;
00090 QVector<float> specr;
00091 QVector<float> m_spectrum;
00092 QVector<float> m_history;
00093 QVector<float> m_bands;
00094 QVector<float> m_freq_labels;
00095 QVector<float> m_avg_db;
00096 QVector<float> m_map_idx2xpos;
00097 QVector<float> m_map_idx2freq;
00098 QRect m_rect;
00099 SpectralMeterConfigWidget *m_config;
00100 QPixmap bgPixmap;
00101 uint num_bands;
00102 uint sample_rate;
00103 float upper_freq;
00104 float lower_freq;
00105 float upper_db;
00106 float lower_db;
00107 int margin_l;
00108 int margin_r;
00109 int margin_t;
00110 int margin_b;
00111 uint sample_weight;
00112
00113 uint fft_size;
00114 float xfactor;
00115 float upper_freq_log;
00116 float lower_freq_log;
00117 float freq_step;
00118 int bar_offset;
00119 bool show_average;
00120 bool update_average;
00121
00122 void reduce_bands();
00123 void update_layout();
00124 void update_freq_map();
00125 float db2ypos(float);
00126 float freq2xpos(float);
00127 void update_background();
00128 float freq2db(float, float);
00129 QString get_xmgr_string();
00130
00131 private slots:
00132 void update_data();
00133
00134 public slots:
00135 void load_configuration();
00136 void set_sheet(Sheet* sheet);
00137
00138 Command* edit_properties();
00139 Command* set_mode();
00140 Command* reset();
00141 Command* export_avarage_curve();
00142 Command* screen_capture();
00143 };
00144
00145 #endif
00146