1 // Copyright 2004 "Gilles Degottex"
3 // This file is part of "fmit"
5 // "fmit" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // "fmit" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 static const unsigned char g_icon_FT[] = {
22 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
23 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20,
24 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x06,
25 0x77, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xb5, 0x97, 0x6b, 0x6c, 0x9b,
26 0x57, 0x19, 0xc7, 0x7f, 0xe7, 0xf5, 0xe5, 0x75, 0xec, 0xdc, 0xec, 0xdc,
27 0x5a, 0x27, 0x69, 0x9c, 0x5b, 0xd3, 0xac, 0x6d, 0xda, 0xa8, 0x59, 0x27,
28 0x51, 0x79, 0x43, 0x30, 0x09, 0x56, 0x90, 0xcb, 0x84, 0x26, 0x04, 0x15,
29 0x6c, 0x1f, 0x80, 0x08, 0x89, 0x0f, 0xa8, 0x20, 0x4d, 0x9a, 0x26, 0xa1,
30 0xed, 0x0b, 0xda, 0x47, 0xd6, 0x0f, 0x93, 0x25, 0x10, 0xeb, 0xb6, 0x0a,
31 0x06, 0xa2, 0x13, 0x06, 0x15, 0x16, 0x28, 0x2c, 0x58, 0x29, 0xbb, 0xa4,
32 0x4b, 0xda, 0xa6, 0x49, 0xb3,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x18, 0x15, 0x41, 0x53, 0x8d, 0xca, 0xe5, 0x2b,
48 0x03, 0xbc, 0x72, 0xfe, 0x4d, 0xb2, 0x1f, 0xc0, 0x1e, 0x01, 0x59, 0xf2,
49 0x01, 0xe0, 0x98, 0xa2, 0x28, 0x9c, 0x7a, 0xf4, 0x28, 0x5f, 0x38, 0xd9,
50 0x45, 0x57, 0x67, 0x1b, 0xfb, 0xea, 0xaa, 0x49, 0xa4, 0x04, 0x5b, 0xb1,
51 0x14, 0x91, 0x58, 0x9a, 0xad, 0x78, 0x9a, 0xad, 0x98, 0xd6, 0x52, 0xcc,
52 0x6e, 0xa5, 0x49, 0x85, 0x25, 0x92, 0x14, 0x52, 0x46, 0x90, 0x12, 0x24,
53 0x20, 0xa5, 0x44, 0x4a, 0x70, 0x94, 0x19, 0x39, 0xd8, 0x72, 0x40, 0xe3,
54 0x6b, 0x2c, 0x28, 0x00, 0xf8, 0x01, 0x70, 0xcc, 0xa0, 0x28, 0x9c, 0xff,
55 0xc5, 0xcf, 0x38, 0xd8, 0xd6, 0xcc, 0x9d, 0xfb, 0x31, 0x02, 0x9b, 0x09,
56 0xc6, 0x96, 0xc3, 0xa4, 0xd3, 0x32, 0xeb, 0x58, 0xea, 0x08, 0x32, 0x4d,
57 0x51, 0x04, 0x42, 0xb0, 0xdb, 0xae, 0xfb, 0x3d, 0x1c, 0x4d, 0xe1, 0xb0,
58 0x97, 0x6b, 0x7c, 0xad, 0x6e, 0x4f, 0xaf, 0xd0, 0x17, 0xa3, 0x26, 0xa0,
59 0x05, 0xe0, 0x50, 0x7b, 0x13, 0x1d, 0x6d, 0xcd, 0x0c, 0x4e, 0x87, 0x89,
60 0xc6, 0x33, 0x61, 0x34, 0x28, 0xa0, 0x08, 0xb1, 0xc7, 0x71, 0xee, 0x2b,
61 0x01, 0x29, 0xc5, 0x2e, 0x3b, 0x40, 0x5a, 0x02, 0x12, 0x62, 0x71, 0xc9,
62 0xfe, 0xda, 0x72, 0x2c, 0xaa, 0x99, 0x68, 0x2c, 0x6e, 0x05, 0x9c, 0xc0,
63 0x5d, 0x4d, 0x80, 0xa2, 0x17, 0xb2, 0xaf, 0xae, 0x9a, 0xf9, 0xb5, 0x38,
64 0xc9, 0x54, 0x26, 0x7f, 0xb9, 0x66, 0x10, 0x18, 0x0d, 0xe8, 0xfa, 0x3a,
65 0x7b, 0xa1, 0x31, 0xca, 0xce, 0xfc, 0x58, 0x32, 0x8d, 0x10, 0x82, 0x06,
66 0x67, 0xad, 0xc6, 0xd9, 0xa1, 0x4f, 0x81, 0xa2, 0x7f, 0xb1, 0x5a, 0x54,
67 0x92, 0x29, 0x99, 0x71, 0x64, 0xd0, 0x93, 0xb1, 0x97, 0xb8, 0x98, 0xa0,
68 0xbc, 0xb9, 0x89, 0x64, 0x26, 0x26, 0xae, 0xc6, 0xfd, 0x1a, 0x4d, 0x67,
69 0xa1, 0x1a, 0x88, 0x03, 0x58, 0x54, 0x73, 0x6e, 0x22, 0x32, 0x1b, 0xc6,
70 0x3d, 0x61, 0x2f, 0x9e, 0xef, 0x42, 0x29, 0x48, 0x66, 0x9d, 0xb4, 0x34,
71 0x39, 0x35, 0xce, 0x43, 0x85, 0x04, 0x6c, 0x02, 0xa4, 0xd2, 0x69, 0x4c,
72 0xc6, 0xcc, 0xd7, 0xec, 0x12, 0x50, 0x28, 0xf7, 0x52, 0x14, 0x16, 0x24,
73 0xf5, 0x02, 0x24, 0x26, 0x43, 0x26, 0xc8, 0xcd, 0x07, 0xea, 0x3f, 0x5b,
74 0x40, 0x3c, 0x9e, 0xc0, 0x6c, 0x54, 0x74, 0x11, 0x90, 0x40, 0xb1, 0x02,
75 0xcc, 0xef, 0x4b, 0x64, 0x76, 0x2c, 0x40, 0x79, 0x89, 0x81, 0xfa, 0x2a,
76 0x33, 0x8e, 0xd2, 0x0c, 0x45, 0xf3, 0x83, 0x44, 0x20, 0x9e, 0x48, 0x62,
77 0xca, 0xa6, 0xe0, 0xb7, 0xaf, 0xbf, 0xc3, 0x5c, 0x60, 0x01, 0x00, 0x83,
78 0xc1, 0x40, 0xeb, 0x41, 0x17, 0x5f, 0x7e, 0xea, 0x71, 0x54, 0x55, 0x45,
79 0x4a, 0xc1, 0xf5, 0xa1, 0x51, 0xae, 0xfc, 0xb5, 0x3f, 0x17, 0x72, 0x8d,
80 0xd8, 0xfd, 0x78, 0x37, 0xd1, 0x8d, 0x55, 0x82, 0x81, 0x79, 0x3d, 0x0f,
81 0x52, 0x42, 0x70, 0x62, 0x91, 0x86, 0xf6, 0xba, 0x7a, 0xb7, 0xa7, 0xb7,
82 0xcc, 0xef, 0xf3, 0x86, 0xf4, 0x02, 0x96, 0x01, 0x22, 0x91, 0x6d, 0x4c,
83 0x06, 0x81, 0x90, 0x69, 0x5e, 0xfb, 0xe5, 0x1b, 0x84, 0x42, 0x61, 0xaa,
84 0xab, 0x1d, 0x6c, 0x6f, 0x47, 0x59, 0x5d, 0x59, 0xe7, 0xe4, 0xef, 0x2f,
85 0xf3, 0xda, 0x85, 0x57, 0x30, 0xab, 0x2a, 0x57, 0x2e, 0xbf, 0xc7, 0x9b,
86 0xbf, 0xfe, 0x03, 0x35, 0xb5, 0x55, 0x28, 0x06, 0x05, 0x45, 0x08, 0x0c,
87 0x0a, 0x7c, 0xe5, 0x89, 0x47, 0xf8, 0xcd, 0xc5, 0xcb, 0xcc, 0xcf, 0x2f,
88 0xb1, 0xb1, 0x11, 0x61, 0x73, 0x33, 0x42, 0x6d, 0xad, 0x1d, 0x55, 0x35,
89 0x21, 0x0d, 0x02, 0x32, 0x3b, 0xec, 0x21, 0xe0, 0x23, 0xd8, 0x59, 0x05,
90 0xf7, 0x01, 0x36, 0x42, 0x11, 0x8c, 0x06, 0xc1, 0xf2, 0xe2, 0x32, 0xcb,
91 0x4b, 0xab, 0x9c, 0xf6, 0x7c, 0x89, 0xbf, 0x0f, 0x5c, 0xe4, 0x5f, 0x1f,
92 0xbc, 0xcd, 0xd9, 0xe7, 0xbe, 0xc1, 0x87, 0xff, 0x19, 0xa6, 0xff, 0x1f,
93 0x57, 0x31, 0x1a, 0x04, 0xa3, 0x37, 0xc7, 0x29, 0xaf, 0x28, 0xe5, 0x9f,
94 0x03, 0x17, 0x98, 0x9c, 0xbc, 0xc4, 0xcc, 0xf4, 0x25, 0x26, 0x27, 0x2f,
95 0x71, 0xf6, 0xec, 0x57, 0xe9, 0xef, 0xf7, 0x32, 0x31, 0x71, 0x89, 0xa7,
96 0x9f, 0xfe, 0x22, 0x40, 0xee, 0xfd, 0x47, 0x3f, 0xf9, 0xa6, 0x16, 0x90,
97 0xc3, 0x5a, 0x47, 0x13, 0xb0, 0x04, 0xb0, 0x19, 0x8e, 0x60, 0x34, 0xc0,
98 0xe8, 0xc8, 0x38, 0x00, 0xdd, 0xdd, 0x9d, 0x58, 0x4b, 0xcc, 0x94, 0x97,
99 0x59, 0xf9, 0xd6, 0x77, 0xbe, 0x06, 0xc0, 0x8d, 0xa1, 0x51, 0xe2, 0xb1,
100 0x28, 0x33, 0x53, 0x01, 0x5a, 0x5b, 0x1b, 0x38, 0x50, 0x6b, 0x25, 0x9d,
101 0x4c, 0x10, 0x8b, 0xc5, 0x49, 0x26, 0x53, 0x28, 0x8a, 0x82, 0xaa, 0x9a,
102 0x51, 0x55, 0x33, 0xc3, 0xc3, 0x9f, 0x50, 0x5b, 0x6b, 0xa7, 0xb5, 0xb5,
103 0x01, 0x55, 0x35, 0xeb, 0xb7, 0xe4, 0x23, 0xf9, 0x35, 0x90, 0x89, 0xc0,
104 0x46, 0x18, 0x45, 0x08, 0x46, 0xae, 0x67, 0x04, 0x1c, 0xeb, 0xee, 0xc0,
105 0xa8, 0x08, 0x24, 0x12, 0xd5, 0x9c, 0x19, 0x9a, 0x4e, 0x25, 0x89, 0xad,
106 0x2f, 0xb3, 0xb6, 0xba, 0x4e, 0x68, 0x33, 0x84, 0xcb, 0x75, 0x26, 0x97,
107 0xe7, 0xd3, 0xa7, 0x4f, 0xf1, 0xd6, 0x5b, 0x2f, 0xa3, 0xf9, 0x9a, 0x98,
108 0x08, 0x70, 0xea, 0xd4, 0x31, 0x4c, 0xa6, 0xcc, 0xdc, 0x96, 0xa6, 0xdc,
109 0x4a, 0xd8, 0x2d, 0xc0, 0xef, 0xf3, 0xae, 0xb9, 0x3d, 0xbd, 0x91, 0x8d,
110 0x50, 0xd8, 0x16, 0x8b, 0x27, 0xb8, 0x39, 0x7c, 0x1b, 0x55, 0x35, 0x73,
111 0xf4, 0x48, 0x2b, 0x46, 0xa3, 0x40, 0x4a, 0xc1, 0xed, 0xd1, 0x29, 0x00,
112 0xba, 0x0e, 0x37, 0x31, 0x36, 0xf2, 0x09, 0x52, 0xc2, 0x33, 0xcf, 0x3c,
113 0xc9, 0xe1, 0xc3, 0x2d, 0x39, 0x01, 0x8f, 0x3d, 0x96, 0x8b, 0x2c, 0xb7,
114 0x6e, 0x4d, 0xb3, 0xbd, 0x1d, 0xa3, 0xa7, 0x67, 0x67, 0xdf, 0x69, 0x71,
115 0x15, 0x11, 0x90, 0x45, 0x10, 0xe8, 0xb8, 0xb7, 0xb8, 0xcc, 0x8d, 0xeb,
116 0xe3, 0xb4, 0x1f, 0x6c, 0xa2, 0xb2, 0xc2, 0x46, 0x5a, 0xc2, 0x76, 0x34,
117 0xc6, 0xeb, 0xbf, 0xfa, 0x23, 0x16, 0x8b, 0xca, 0x19, 0x8f, 0x9b, 0x57,
118 0x5f, 0x7d, 0x1b, 0x21, 0xe0, 0xf9, 0xe7, 0xbf, 0x47, 0x57, 0x57, 0x3b,
119 0x85, 0x70, 0xed, 0xda, 0x18, 0x52, 0x42, 0x4f, 0xcf, 0x23, 0x39, 0x5b,
120 0x65, 0x79, 0x29, 0x55, 0xf6, 0x0a, 0x56, 0xd6, 0x36, 0xea, 0xdd, 0x9e,
121 0x5e, 0xbb, 0xdf, 0xe7, 0x5d, 0xd3, 0x6f, 0xc5, 0x73, 0x00, 0xc3, 0x37,
122 0x27, 0x58, 0x5d, 0xdd, 0xc4, 0xe9, 0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, 0xf1, 0xa9, 0x00, 0x4f, 0x3e, 0x71, 0x72, 0xcf, 0xcc, 0x50, 0x78,
153 0x6b, 0x0f, 0xd1, 0x9d, 0xb9, 0x05, 0x12, 0x89, 0x64, 0x21, 0xa2, 0x34,
154 0x30, 0x05, 0xdc, 0x04, 0x86, 0x81, 0x21, 0x60, 0xd0, 0xef, 0xf3, 0xee,
155 0x2a, 0xb2, 0x7c, 0x01, 0xfd, 0xc0, 0x8b, 0x7f, 0xfa, 0xdb, 0xbf, 0xb1,
156 0x96, 0x58, 0x28, 0x2f, 0xb3, 0xb1, 0xb2, 0xb6, 0xc1, 0x4c, 0x60, 0x9e,
157 0xc9, 0x99, 0x60, 0x6e, 0x85, 0x14, 0xc0, 0x0a, 0x99, 0xbb, 0xdf, 0x8d,
158 0x2c, 0xe1, 0x0d, 0x60, 0xc4, 0xef, 0xf3, 0x46, 0x8a, 0x4d, 0xd0, 0xb0,
159 0x67, 0xa5, 0xb9, 0x3d, 0xbd, 0x6f, 0x00, 0xdf, 0x2d, 0x32, 0x3e, 0x04,
160 0x8c, 0x66, 0xc9, 0x6e, 0x65, 0x9f, 0x23, 0x7e, 0x9f, 0x77, 0xe1, 0xb3,
161 0x88, 0x8a, 0xa1, 0xd0, 0xe5, 0xf4, 0x59, 0xe0, 0x77, 0xc0, 0xd7, 0x81,
162 0x52, 0x1d, 0xe1, 0x08, 0x30, 0x5b, 0xe8, 0x8a, 0xfd, 0xff, 0xe0, 0xbf,
163 0x87, 0xf6, 0xdb, 0x8f, 0xf0, 0x17, 0xa5, 0xe8, 0x00, 0x00, 0x00, 0x00,
164 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
169 #include <qtooltip.h>
172 #include <Music/Music.h>
173 #include <Music/SPWindow.h>
174 using namespace Music;
175 #include <CppAddons/CAMath.h>
176 using namespace Math;
178 GLFT::GLFT(QWidget* parent)
179 : QGLWidget(parent, "GLFT")
180 , View("Fourier Transform", this)
181 , m_components_max(1.0)
183 m_start_move_mouse = true;
188 m_zp_factor = 4; // actually, actuellement, not zero-padding but win-size-factor
192 img.loadFromData(g_icon_FT, sizeof(g_icon_FT), "PNG");
193 setting_show->setIconSet(QIconSet(QImage(img)));
194 setting_show->setOn(false);
197 setting_autoScale = new QAction(this);
198 setting_autoScale->setMenuText(tr("Auto scale"));
199 setting_autoScale->setToggleAction(true);
200 connect(setting_autoScale, SIGNAL(toggled(bool)), this, SLOT(update()));
201 setting_autoScale->setOn(true);
202 setting_autoScale->addTo(&m_popup_menu);
204 setting_db_scale = new QAction(this);
205 setting_db_scale->setMenuText(tr("dB scale"));
206 setting_db_scale->setToggleAction(true);
207 connect(setting_db_scale, SIGNAL(toggled(bool)), this, SLOT(update()));
208 setting_db_scale->setOn(true);
209 setting_db_scale->addTo(&m_popup_menu);
211 m_popup_menu.insertItem(new Title(tr("Size"), &m_popup_menu));
212 setting_spinNumComponents = new QSpinBox(1, 65536, 1, &m_popup_menu);
213 setting_spinNumComponents->setValue(8192);
214 m_components.resize(setting_spinNumComponents->value());
215 QToolTip::add(setting_spinNumComponents, tr("Size"));
216 connect(setting_spinNumComponents, SIGNAL(valueChanged(int)), this, SLOT(spinNumComponentsChanged(int)));
217 m_popup_menu.insertItem(setting_spinNumComponents);
218 m_popup_menu.insertItem(new Title(tr("- Press left mouse button and move mouse to zoom"), &m_popup_menu));
219 m_popup_menu.insertItem(new Title(tr("- Press SHIFT key, left mouse button and move mouse to move view"), &m_popup_menu));
220 m_popup_menu.insertItem(new Title(tr("- Double-click to reset view"), &m_popup_menu));
222 m_plan.resize(setting_spinNumComponents->value());
223 m_components.resize(m_plan.size()/2, 0.0);
224 win = hann(m_plan.size());
229 s_settings->writeEntry("spinNumComponents", setting_spinNumComponents->value());
233 setting_spinNumComponents->setValue(s_settings->readNumEntry("spinNumComponents", setting_spinNumComponents->value()));
235 void GLFT::clearSettings()
237 s_settings->removeEntry("spinNumComponents");
240 void GLFT::refreshGraph()
242 while(int(buff.size())>m_plan.size())
246 void GLFT::spinNumComponentsChanged(int num)
248 m_plan.resize(int(m_zp_factor*num));
249 m_components.resize(m_plan.size()/2);
252 cerr << "GLFT: INFO: window size=" << win.size() << " FFT size=" << m_plan.size() << endl;
255 void GLFT::initializeGL()
257 // Set the clear color to black
258 glClearColor(1.0, 1.0, 1.0, 0.0);
260 glShadeModel( GL_FLAT );
261 // glShadeModel( GL_SMOOTH );
266 void GLFT::mousePressEvent(QMouseEvent* e)
268 m_start_move_mouse = true;
272 void GLFT::mouseDoubleClickEvent(QMouseEvent* e)
274 m_start_move_mouse = true;
282 void GLFT::mouseMoveEvent(QMouseEvent* e)
286 if(m_start_move_mouse)
290 m_start_move_mouse = false;
292 int dx = e->x() - old_x;
293 int dy = e->y() - old_y;
295 if(Qt::LeftButton & e->state())
297 if(Qt::ShiftButton & e->state())
305 if(m_z<0.0) m_z = 0.0;
317 glClear(GL_COLOR_BUFFER_BIT);
319 if(int(buff.size())>=m_plan.size())
321 while(int(buff.size())>m_plan.size())
325 string str = tr("Fourier Transform");
326 glColor3f(0.75,0.75,0.75);
327 glRasterPos2i(2, height()-20);
328 for(size_t i = 0; i < str.size(); i++)
329 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str[i]);
331 int scale_height = 0;
333 for(int i=0; i<int(win.size()); i++)
334 m_plan.in[i] = buff[i]*win[i];
335 for(int i=win.size(); i<int(m_plan.in.size()); i++)
340 m_components_max = -1e100;
341 for(int i=0; i<int(m_components.size()); i++)
343 m_components[i] = mod(m_plan.out[i]);
344 if(setting_db_scale->isOn())
345 m_components[i] = 100+20*log10(m_components[i]);
346 m_components_max = max(m_components_max, m_components[i]);
349 // cerr << m_components_max << endl;
351 double scale_factor = 1.0;
352 if(setting_autoScale->isOn() && m_components_max>0.0)
353 scale_factor = 1.0/m_components_max;
355 // cerr << scale_factor << endl;
359 float step = float(width())/m_components.size() + m_z;
360 int space = (step>2)?1:0;
361 for(size_t i=0; i<m_components.size(); i++)
363 glColor3f(0.4, 0.4, 0.5);
365 int y = int( (scale_factor*m_components[i]) * (height()-scale_height)) + scale_height;
368 glVertex2i(m_x+x, m_y+scale_height);
369 glVertex2i(m_x+x, m_y+y);
370 glVertex2i(m_x+int((i+1)*step)-space, m_y+y);
371 glVertex2i(m_x+int((i+1)*step)-space, m_y+scale_height);
378 for(size_t i=0; i<m_components.size(); i++)
380 glRasterPos2i(int((i+0.5)*step)-3, 2);
382 // string str = StringAddons::toString(i+1);
383 string str = QString::number(i+1);
385 for(size_t i = 0; i < str.size(); i++)
386 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, str[i]);
393 void GLFT::resizeGL( int w, int h )
395 // Set the new viewport size
396 glViewport(0, 0, (GLint)w, (GLint)h);
398 // Choose the projection matrix to be the matrix
399 // manipulated by the following calls
400 glMatrixMode(GL_PROJECTION);
402 // Set the projection matrix to be the identity matrix
405 // Define the dimensions of the Orthographic Viewing Volume
406 glOrtho(0.0, w, 0.0, h, 0.0, 1.0);
408 // Choose the modelview matrix to be the matrix
409 // manipulated by further calls
410 glMatrixMode(GL_MODELVIEW);