// Copyright 2004 "Gilles Degottex" // This file is part of "fmit" // "fmit" is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // "fmit" is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "GLFT.h" static const unsigned char g_icon_FT[] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x06, 0x77, 0x49, 0x44, 0x41, 0x54, 0x58, 0x85, 0xb5, 0x97, 0x6b, 0x6c, 0x9b, 0x57, 0x19, 0xc7, 0x7f, 0xe7, 0xf5, 0xe5, 0x75, 0xec, 0xdc, 0xec, 0xdc, 0x5a, 0x27, 0x69, 0x9c, 0x5b, 0xd3, 0xac, 0x6d, 0xda, 0xa8, 0x59, 0x27, 0x51, 0x79, 0x43, 0x30, 0x09, 0x56, 0x90, 0xcb, 0x84, 0x26, 0x04, 0x15, 0x6c, 0x1f, 0x80, 0x08, 0x89, 0x0f, 0xa8, 0x20, 0x4d, 0x9a, 0x26, 0xa1, 0xed, 0x0b, 0xda, 0x47, 0xd6, 0x0f, 0x93, 0x25, 0x10, 0xeb, 0xb6, 0x0a, 0x06, 0xa2, 0x13, 0x06, 0x15, 0x16, 0x28, 0x2c, 0x58, 0x29, 0xbb, 0xa4, 0x4b, 0xda, 0xa6, 0x49, 0xb3, 0xdc, 0x1a, 0xc7, 0x4d, 0x9a, 0xe6, 0x1e, 0xdb, 0x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, 0x54, 0x26, 0x7f, 0xb9, 0x66, 0x10, 0x18, 0x0d, 0xe8, 0xfa, 0x3a, 0x7b, 0xa1, 0x31, 0xca, 0xce, 0xfc, 0x58, 0x32, 0x8d, 0x10, 0x82, 0x06, 0x67, 0xad, 0xc6, 0xd9, 0xa1, 0x4f, 0x81, 0xa2, 0x7f, 0xb1, 0x5a, 0x54, 0x92, 0x29, 0x99, 0x71, 0x64, 0xd0, 0x93, 0xb1, 0x97, 0xb8, 0x98, 0xa0, 0xbc, 0xb9, 0x89, 0x64, 0x26, 0x26, 0xae, 0xc6, 0xfd, 0x1a, 0x4d, 0x67, 0xa1, 0x1a, 0x88, 0x03, 0x58, 0x54, 0x73, 0x6e, 0x22, 0x32, 0x1b, 0xc6, 0x3d, 0x61, 0x2f, 0x9e, 0xef, 0x42, 0x29, 0x48, 0x66, 0x9d, 0xb4, 0x34, 0x39, 0x35, 0xce, 0x43, 0x85, 0x04, 0x6c, 0x02, 0xa4, 0xd2, 0x69, 0x4c, 0xc6, 0xcc, 0xd7, 0xec, 0x12, 0x50, 0x28, 0xf7, 0x52, 0x14, 0x16, 0x24, 0xf5, 0x02, 0x24, 0x26, 0x43, 0x26, 0xc8, 0xcd, 0x07, 0xea, 0x3f, 0x5b, 0x40, 0x3c, 0x9e, 0xc0, 0x6c, 0x54, 0x74, 0x11, 0x90, 0x40, 0xb1, 0x02, 0xcc, 0xef, 0x4b, 0x64, 0x76, 0x2c, 0x40, 0x79, 0x89, 0x81, 0xfa, 0x2a, 0x33, 0x8e, 0xd2, 0x0c, 0x45, 0xf3, 0x83, 0x44, 0x20, 0x9e, 0x48, 0x62, 0xca, 0xa6, 0xe0, 0xb7, 0xaf, 0xbf, 0xc3, 0x5c, 0x60, 0x01, 0x00, 0x83, 0xc1, 0x40, 0xeb, 0x41, 0x17, 0x5f, 0x7e, 0xea, 0x71, 0x54, 0x55, 0x45, 0x4a, 0xc1, 0xf5, 0xa1, 0x51, 0xae, 0xfc, 0xb5, 0x3f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xb1, 0xb2, 0xb6, 0xc1, 0x4c, 0x60, 0x9e, 0xc9, 0x99, 0x60, 0x6e, 0x85, 0x14, 0xc0, 0x0a, 0x99, 0xbb, 0xdf, 0x8d, 0x2c, 0xe1, 0x0d, 0x60, 0xc4, 0xef, 0xf3, 0x46, 0x8a, 0x4d, 0xd0, 0xb0, 0x67, 0xa5, 0xb9, 0x3d, 0xbd, 0x6f, 0x00, 0xdf, 0x2d, 0x32, 0x3e, 0x04, 0x8c, 0x66, 0xc9, 0x6e, 0x65, 0x9f, 0x23, 0x7e, 0x9f, 0x77, 0xe1, 0xb3, 0x88, 0x8a, 0xa1, 0xd0, 0xe5, 0xf4, 0x59, 0xe0, 0x77, 0xc0, 0xd7, 0x81, 0x52, 0x1d, 0xe1, 0x08, 0x30, 0x5b, 0xe8, 0x8a, 0xfd, 0xff, 0xe0, 0xbf, 0x87, 0xf6, 0xdb, 0x8f, 0xf0, 0x17, 0xa5, 0xe8, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; #include using namespace std; #include #include #include #include #include using namespace Music; #include using namespace Math; GLFT::GLFT(QWidget* parent) : QGLWidget(parent, "GLFT") , View("Fourier Transform", this) , m_components_max(1.0) { m_start_move_mouse = true; m_x = 0; m_y = 0; m_z = 0.0; m_zp_factor = 4; // actually, actuellement, not zero-padding but win-size-factor // settings QImage img; img.loadFromData(g_icon_FT, sizeof(g_icon_FT), "PNG"); setting_show->setIconSet(QIconSet(QImage(img))); setting_show->setOn(false); hide(); setting_autoScale = new QAction(this); setting_autoScale->setMenuText(tr("Auto scale")); setting_autoScale->setToggleAction(true); connect(setting_autoScale, SIGNAL(toggled(bool)), this, SLOT(update())); setting_autoScale->setOn(true); setting_autoScale->addTo(&m_popup_menu); setting_db_scale = new QAction(this); setting_db_scale->setMenuText(tr("dB scale")); setting_db_scale->setToggleAction(true); connect(setting_db_scale, SIGNAL(toggled(bool)), this, SLOT(update())); setting_db_scale->setOn(true); setting_db_scale->addTo(&m_popup_menu); m_popup_menu.insertItem(new Title(tr("Size"), &m_popup_menu)); setting_spinNumComponents = new QSpinBox(1, 65536, 1, &m_popup_menu); setting_spinNumComponents->setValue(8192); m_components.resize(setting_spinNumComponents->value()); QToolTip::add(setting_spinNumComponents, tr("Size")); connect(setting_spinNumComponents, SIGNAL(valueChanged(int)), this, SLOT(spinNumComponentsChanged(int))); m_popup_menu.insertItem(setting_spinNumComponents); m_popup_menu.insertItem(new Title(tr("- Press left mouse button and move mouse to zoom"), &m_popup_menu)); m_popup_menu.insertItem(new Title(tr("- Press SHIFT key, left mouse button and move mouse to move view"), &m_popup_menu)); m_popup_menu.insertItem(new Title(tr("- Double-click to reset view"), &m_popup_menu)); m_plan.resize(setting_spinNumComponents->value()); m_components.resize(m_plan.size()/2, 0.0); win = hann(m_plan.size()); } void GLFT::save() { s_settings->writeEntry("spinNumComponents", setting_spinNumComponents->value()); } void GLFT::load() { setting_spinNumComponents->setValue(s_settings->readNumEntry("spinNumComponents", setting_spinNumComponents->value())); } void GLFT::clearSettings() { s_settings->removeEntry("spinNumComponents"); } void GLFT::refreshGraph() { while(int(buff.size())>m_plan.size()) buff.pop_back(); } void GLFT::spinNumComponentsChanged(int num) { m_plan.resize(int(m_zp_factor*num)); m_components.resize(m_plan.size()/2); win = hann(num); cerr << "GLFT: INFO: window size=" << win.size() << " FFT size=" << m_plan.size() << endl; } void GLFT::initializeGL() { // Set the clear color to black glClearColor(1.0, 1.0, 1.0, 0.0); glShadeModel( GL_FLAT ); // glShadeModel( GL_SMOOTH ); glLoadIdentity(); } void GLFT::mousePressEvent(QMouseEvent* e) { m_start_move_mouse = true; m_press_x = e->x(); m_press_y = e->y(); } void GLFT::mouseDoubleClickEvent(QMouseEvent* e) { m_start_move_mouse = true; m_x = 0; m_y = 0; // m_z = 0.0; m_z = 1.0; updateGL(); } void GLFT::mouseMoveEvent(QMouseEvent* e) { static int old_x; static int old_y; if(m_start_move_mouse) { old_x = e->x(); old_y = e->y(); m_start_move_mouse = false; } int dx = e->x() - old_x; int dy = e->y() - old_y; if(Qt::LeftButton & e->state()) { if(Qt::ShiftButton & e->state()) { m_x += dx; m_y -= dy; } else { m_z += dx/100.0; if(m_z<0.0) m_z = 0.0; } updateGL(); } old_x = e->x(); old_y = e->y(); } void GLFT::paintGL() { glClear(GL_COLOR_BUFFER_BIT); if(int(buff.size())>=m_plan.size()) { while(int(buff.size())>m_plan.size()) buff.pop_back(); // name string str = tr("Fourier Transform"); glColor3f(0.75,0.75,0.75); glRasterPos2i(2, height()-20); for(size_t i = 0; i < str.size(); i++) glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str[i]); int scale_height = 0; for(int i=0; iisOn()) m_components[i] = 100+20*log10(m_components[i]); m_components_max = max(m_components_max, m_components[i]); } // cerr << m_components_max << endl; double scale_factor = 1.0; if(setting_autoScale->isOn() && m_components_max>0.0) scale_factor = 1.0/m_components_max; // cerr << scale_factor << endl; // bars glBegin(GL_QUADS); float step = float(width())/m_components.size() + m_z; int space = (step>2)?1:0; for(size_t i=0; i=0) { glVertex2i(m_x+x, m_y+scale_height); glVertex2i(m_x+x, m_y+y); glVertex2i(m_x+int((i+1)*step)-space, m_y+y); glVertex2i(m_x+int((i+1)*step)-space, m_y+scale_height); } } glEnd(); // scale /* glColor3f(0,0,0); for(size_t i=0; i