comparison src/MainWindow.cpp @ 345:f3a9e4abec1b

added low amplitude suppression toggle to analysis menu
author matthiasm
date Mon, 16 Jun 2014 12:24:52 +0100
parents 6f545a46746b
children 65907d91f328
comparison
equal deleted inserted replaced
342:6f545a46746b 345:f3a9e4abec1b
826 826
827 QSettings settings; 827 QSettings settings;
828 settings.beginGroup("Analyser"); 828 settings.beginGroup("Analyser");
829 bool autoAnalyse = settings.value("auto-analysis", true).toBool(); 829 bool autoAnalyse = settings.value("auto-analysis", true).toBool();
830 bool precise = settings.value("precision-analysis", false).toBool(); 830 bool precise = settings.value("precision-analysis", false).toBool();
831 bool lowamp = settings.value("lowamp-analysis", true).toBool();
831 settings.endGroup(); 832 settings.endGroup();
832 833
833 action = new QAction(tr("Auto-Analyse &New Audio"), this); 834 action = new QAction(tr("Auto-Analyse &New Audio"), this);
834 action->setStatusTip(tr("Automatically trigger analysis upon opening of a new audio file.")); 835 action->setStatusTip(tr("Automatically trigger analysis upon opening of a new audio file."));
835 action->setCheckable(true); 836 action->setCheckable(true);
841 action->setStatusTip(tr("Use a symmetric window in YIN to remove frequency-dependent timing bias. (This is slow!)")); 842 action->setStatusTip(tr("Use a symmetric window in YIN to remove frequency-dependent timing bias. (This is slow!)"));
842 action->setCheckable(true); 843 action->setCheckable(true);
843 action->setChecked(precise); 844 action->setChecked(precise);
844 connect(action, SIGNAL(triggered()), this, SLOT(precisionAnalysisToggled())); 845 connect(action, SIGNAL(triggered()), this, SLOT(precisionAnalysisToggled()));
845 menu->addAction(action); 846 menu->addAction(action);
847
848 action = new QAction(tr("&Suppress Detection at Low Amplitude"), this);
849 action->setStatusTip(tr("Reduce the likelihood of detecting a pitch when the signal has low amplitude."));
850 action->setCheckable(true);
851 action->setChecked(lowamp);
852 connect(action, SIGNAL(triggered()), this, SLOT(lowampAnalysisToggled()));
853 menu->addAction(action);
854
846 } 855 }
847 856
848 void 857 void
849 MainWindow::autoAnalysisToggled() 858 MainWindow::autoAnalysisToggled()
850 { 859 {
868 bool set = a->isChecked(); 877 bool set = a->isChecked();
869 878
870 QSettings settings; 879 QSettings settings;
871 settings.beginGroup("Analyser"); 880 settings.beginGroup("Analyser");
872 settings.setValue("precision-analysis", set); 881 settings.setValue("precision-analysis", set);
882 settings.endGroup();
883
884 // don't run analyseNow() automatically -- it's a destructive operation
885 }
886
887 void
888 MainWindow::lowampAnalysisToggled()
889 {
890 QAction *a = qobject_cast<QAction *>(sender());
891 if (!a) return;
892
893 bool set = a->isChecked();
894
895 QSettings settings;
896 settings.beginGroup("Analyser");
897 settings.setValue("lowamp-analysis", set);
873 settings.endGroup(); 898 settings.endGroup();
874 899
875 // don't run analyseNow() automatically -- it's a destructive operation 900 // don't run analyseNow() automatically -- it's a destructive operation
876 } 901 }
877 902