Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 21:7da85e0b85e9
* Add some internal feedback to the time stretcher to try to make it maintain
tempo within variable timestretching situations -- not ideal but perhaps
better than nothing.
* Better tooltip text for play speeed control; make play sharpening control
remember its last state
author | Chris Cannam |
---|---|
date | Thu, 14 Sep 2006 16:08:23 +0000 |
parents | 67d54627efd3 |
children | ae0731ba8e67 |
comparison
equal
deleted
inserted
replaced
20:e125f0dde7a3 | 21:7da85e0b85e9 |
---|---|
167 this, SLOT(playSpeedChanged(int))); | 167 this, SLOT(playSpeedChanged(int))); |
168 | 168 |
169 m_playSharpen = new QCheckBox(frame); | 169 m_playSharpen = new QCheckBox(frame); |
170 m_playSharpen->setToolTip(tr("Sharpen percussive transients")); | 170 m_playSharpen->setToolTip(tr("Sharpen percussive transients")); |
171 m_playSharpen->setEnabled(false); | 171 m_playSharpen->setEnabled(false); |
172 m_playSharpen->setChecked(false); | 172 |
173 QSettings settings; | |
174 settings.beginGroup("MainWindow"); | |
175 m_playSharpen->setChecked(settings.value("playsharpen", false).toBool()); | |
176 settings.endGroup(); | |
177 | |
173 connect(m_playSharpen, SIGNAL(clicked()), | 178 connect(m_playSharpen, SIGNAL(clicked()), |
174 this, SLOT(playSharpenToggled())); | 179 this, SLOT(playSharpenToggled())); |
175 | 180 |
176 layout->addWidget(m_paneStack, 0, 0, 1, 4); | 181 layout->addWidget(m_paneStack, 0, 0, 1, 4); |
177 layout->addWidget(m_panner, 1, 0); | 182 layout->addWidget(m_panner, 1, 0); |
2867 { | 2872 { |
2868 static float factors[] = { | 2873 static float factors[] = { |
2869 1.0, 1.1, 1.2, 1.3, 1.5, 1.7, 2.0, 3.0, 4.0, 6.0, 10.0 | 2874 1.0, 1.1, 1.2, 1.3, 1.5, 1.7, 2.0, 3.0, 4.0, 6.0, 10.0 |
2870 }; | 2875 }; |
2871 float factor = factors[speed >= 10 ? speed - 10 : 10 - speed]; | 2876 float factor = factors[speed >= 10 ? speed - 10 : 10 - speed]; |
2872 // int factor = 11 - speed; | 2877 |
2873 if (speed > 10) factor = 1.0 / factor; | 2878 int pc = lrintf((factor - 1.0) * 100); |
2879 | |
2880 if (speed > 10) { | |
2881 factor = 1.0 / factor; | |
2882 } | |
2883 | |
2874 std::cerr << "factor = " << factor << std::endl; | 2884 std::cerr << "factor = " << factor << std::endl; |
2875 /* | 2885 |
2876 int iinc = 128; | 2886 m_playSpeed->setToolTip(tr("Playback speed: %1%2%") |
2877 int oinc = lrintf(iinc * factor); | 2887 .arg(speed >= 10 ? "+" : "-") |
2878 factor = (float(oinc) + 0.01) / iinc; | 2888 .arg(pc)); |
2879 std::cerr << "corrected factor = " << factor << std::endl; | 2889 |
2880 */ | |
2881 m_playSpeed->setToolTip(tr("Playback speed: %1") | |
2882 .arg(factor != 1 ? | |
2883 QString("1/%1").arg(factor) : | |
2884 tr("Full"))); | |
2885 m_playSharpen->setEnabled(speed != 10); | 2890 m_playSharpen->setEnabled(speed != 10); |
2886 bool sharpen = (speed != 10 && m_playSharpen->isChecked()); | 2891 bool sharpen = (speed != 10 && m_playSharpen->isChecked()); |
2887 m_playSource->setSlowdownFactor(factor, sharpen); | 2892 m_playSource->setSlowdownFactor(factor, sharpen); |
2888 } | 2893 } |
2889 | 2894 |
2890 void | 2895 void |
2891 MainWindow::playSharpenToggled() | 2896 MainWindow::playSharpenToggled() |
2892 { | 2897 { |
2898 QSettings settings; | |
2899 settings.beginGroup("MainWindow"); | |
2900 settings.setValue("playsharpen", m_playSharpen->isChecked()); | |
2901 settings.endGroup(); | |
2902 | |
2893 playSpeedChanged(m_playSpeed->value()); | 2903 playSpeedChanged(m_playSpeed->value()); |
2894 } | 2904 } |
2895 | 2905 |
2896 void | 2906 void |
2897 MainWindow::outputLevelsChanged(float left, float right) | 2907 MainWindow::outputLevelsChanged(float left, float right) |