comparison src/MainWindow.cpp @ 423:bbe7ba53030e

new analysis menu fully functional (but not much tested)
author matthiasm
date Wed, 25 Mar 2015 17:02:40 +0000
parents 0a12d7e79b74
children ad8f94fb334d
comparison
equal deleted inserted replaced
422:0a12d7e79b74 423:bbe7ba53030e
748 QSettings settings; 748 QSettings settings;
749 settings.beginGroup("Analyser"); 749 settings.beginGroup("Analyser");
750 bool autoAnalyse = settings.value("auto-analysis", true).toBool(); 750 bool autoAnalyse = settings.value("auto-analysis", true).toBool();
751 bool precise = settings.value("precision-analysis", false).toBool(); 751 bool precise = settings.value("precision-analysis", false).toBool();
752 bool lowamp = settings.value("lowamp-analysis", true).toBool(); 752 bool lowamp = settings.value("lowamp-analysis", true).toBool();
753 bool onset = settings.value("onset-analysis", true).toBool();
754 bool prune = settings.value("prune-analysis", true).toBool();
753 settings.endGroup(); 755 settings.endGroup();
754 756
755 action = new QAction(tr("Auto-Analyse &New Audio"), this); 757 action = new QAction(tr("Auto-Analyse &New Audio"), this);
756 action->setStatusTip(tr("Automatically trigger analysis upon opening of a new audio file.")); 758 action->setStatusTip(tr("Automatically trigger analysis upon opening of a new audio file."));
757 action->setCheckable(true); 759 action->setCheckable(true);
779 action->setCheckable(true); 781 action->setCheckable(true);
780 action->setChecked(lowamp); 782 action->setChecked(lowamp);
781 connect(action, SIGNAL(triggered()), this, SLOT(lowampAnalysisToggled())); 783 connect(action, SIGNAL(triggered()), this, SLOT(lowampAnalysisToggled()));
782 menu->addAction(action); 784 menu->addAction(action);
783 785
784 action = new QAction(tr("&Amplitude-based Note Separation"), this); 786 action = new QAction(tr("&High Onset Sensitivity"), this);
785 action->setStatusTip(tr("Increase likelihood of separating notes, especially consecutive notes at the same pitch.")); 787 action->setStatusTip(tr("Increase likelihood of separating notes, especially consecutive notes at the same pitch."));
786 action->setCheckable(true); 788 action->setCheckable(true);
787 action->setChecked(false); 789 action->setChecked(onset);
788 // connect(action, SIGNAL(triggered()), this, SLOT(lowampAnalysisToggled())); 790 connect(action, SIGNAL(triggered()), this, SLOT(onsetAnalysisToggled()));
789 menu->addAction(action); 791 menu->addAction(action);
790 792
791 action = new QAction(tr("&Drop Short Notes"), this); 793 action = new QAction(tr("&Drop Short Notes"), this);
792 action->setStatusTip(tr("Duration-based pruning: automatic note estimator will not output notes of less than 100ms duration.")); 794 action->setStatusTip(tr("Duration-based pruning: automatic note estimator will not output notes of less than 100ms duration."));
793 action->setCheckable(true); 795 action->setCheckable(true);
794 action->setChecked(true); 796 action->setChecked(prune);
795 // connect(action, SIGNAL(triggered()), this, SLOT(lowampAnalysisToggled())); 797 connect(action, SIGNAL(triggered()), this, SLOT(pruneAnalysisToggled()));
796 menu->addAction(action); 798 menu->addAction(action);
797 799
798 menu->addSeparator(); 800 menu->addSeparator();
799 801
800 action = new QAction(tr("Reset Options to Defaults"), this); 802 action = new QAction(tr("Reset Options to Defaults"), this);
842 bool set = a->isChecked(); 844 bool set = a->isChecked();
843 845
844 QSettings settings; 846 QSettings settings;
845 settings.beginGroup("Analyser"); 847 settings.beginGroup("Analyser");
846 settings.setValue("lowamp-analysis", set); 848 settings.setValue("lowamp-analysis", set);
849 settings.endGroup();
850
851 // don't run analyseNow() automatically -- it's a destructive operation
852 }
853
854 void
855 MainWindow::onsetAnalysisToggled()
856 {
857 QAction *a = qobject_cast<QAction *>(sender());
858 if (!a) return;
859
860 bool set = a->isChecked();
861
862 QSettings settings;
863 settings.beginGroup("Analyser");
864 settings.setValue("onset-analysis", set);
865 settings.endGroup();
866
867 // don't run analyseNow() automatically -- it's a destructive operation
868 }
869
870 void
871 MainWindow::pruneAnalysisToggled()
872 {
873 QAction *a = qobject_cast<QAction *>(sender());
874 if (!a) return;
875
876 bool set = a->isChecked();
877
878 QSettings settings;
879 settings.beginGroup("Analyser");
880 settings.setValue("prune-analysis", set);
847 settings.endGroup(); 881 settings.endGroup();
848 882
849 // don't run analyseNow() automatically -- it's a destructive operation 883 // don't run analyseNow() automatically -- it's a destructive operation
850 } 884 }
851 885