Mercurial > hg > tony
comparison src/MainWindow.cpp @ 227:ae0bf8dc5833
Crude ability to adjust displayed frequency range
author | Chris Cannam |
---|---|
date | Tue, 11 Mar 2014 09:26:04 +0000 |
parents | 9bdff8d10a86 |
children | 135e0f1fd1ee |
comparison
equal
deleted
inserted
replaced
226:9bdff8d10a86 | 227:ae0bf8dc5833 |
---|---|
52 #include "data/fileio/DataFileReaderFactory.h" | 52 #include "data/fileio/DataFileReaderFactory.h" |
53 #include "data/fileio/CSVFormat.h" | 53 #include "data/fileio/CSVFormat.h" |
54 #include "data/fileio/CSVFileWriter.h" | 54 #include "data/fileio/CSVFileWriter.h" |
55 #include "data/fileio/MIDIFileWriter.h" | 55 #include "data/fileio/MIDIFileWriter.h" |
56 #include "rdf/RDFExporter.h" | 56 #include "rdf/RDFExporter.h" |
57 | |
58 #include "widgets/RangeInputDialog.h" | |
57 | 59 |
58 // For version information | 60 // For version information |
59 #include "vamp/vamp.h" | 61 #include "vamp/vamp.h" |
60 #include "vamp-sdk/PluginBase.h" | 62 #include "vamp-sdk/PluginBase.h" |
61 #include "plugin/api/ladspa.h" | 63 #include "plugin/api/ladspa.h" |
666 action->setStatusTip(tr("Zoom to show the whole file")); | 668 action->setStatusTip(tr("Zoom to show the whole file")); |
667 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit())); | 669 connect(action, SIGNAL(triggered()), this, SLOT(zoomToFit())); |
668 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); | 670 connect(this, SIGNAL(canZoom(bool)), action, SLOT(setEnabled(bool))); |
669 m_keyReference->registerShortcut(action); | 671 m_keyReference->registerShortcut(action); |
670 menu->addAction(action); | 672 menu->addAction(action); |
673 | |
674 menu->addSeparator(); | |
675 | |
676 action = new QAction(tr("Set Displayed Fre&quency Range..."), this); | |
677 action->setStatusTip(tr("Set the minimum and maximum frequencies in the visible display")); | |
678 connect(action, SIGNAL(triggered()), this, SLOT(editDisplayExtents())); | |
679 menu->addAction(action); | |
671 } | 680 } |
672 | 681 |
673 void | 682 void |
674 MainWindow::setupHelpMenu() | 683 MainWindow::setupHelpMenu() |
675 { | 684 { |
1181 m_playPitch->setChecked(m_analyser->isAudible(Analyser::PitchTrack)); | 1190 m_playPitch->setChecked(m_analyser->isAudible(Analyser::PitchTrack)); |
1182 m_playNotes->setChecked(m_analyser->isAudible(Analyser::Notes)); | 1191 m_playNotes->setChecked(m_analyser->isAudible(Analyser::Notes)); |
1183 } | 1192 } |
1184 | 1193 |
1185 void | 1194 void |
1195 MainWindow::editDisplayExtents() | |
1196 { | |
1197 float min, max; | |
1198 float vmin = 0; | |
1199 float vmax = getMainModel()->getSampleRate() /2; | |
1200 | |
1201 if (!m_analyser->getDisplayFrequencyExtents(min, max)) { | |
1202 //!!! | |
1203 return; | |
1204 } | |
1205 | |
1206 RangeInputDialog dialog(tr("Set frequency range"), | |
1207 tr("Enter new frequency range, from %1 to %2 Hz.\nThese values will be rounded to the nearest spectrogram bin.") | |
1208 .arg(vmin).arg(vmax), | |
1209 "Hz", vmin, vmax, this); | |
1210 dialog.setRange(min, max); | |
1211 | |
1212 if (dialog.exec() == QDialog::Accepted) { | |
1213 dialog.getRange(min, max); | |
1214 if (min > max) { | |
1215 float tmp = max; | |
1216 max = min; | |
1217 min = tmp; | |
1218 } | |
1219 m_analyser->setDisplayFrequencyExtents(min, max); | |
1220 } | |
1221 } | |
1222 | |
1223 void | |
1186 MainWindow::updateDescriptionLabel() | 1224 MainWindow::updateDescriptionLabel() |
1187 { | 1225 { |
1188 // Nothing, we don't have one | 1226 // Nothing, we don't have one |
1189 } | 1227 } |
1190 | 1228 |