comparison main/MainWindow.cpp @ 60:06b3c3f437e6

* Make audio dial remember its more accurate mapped value as well as its display position * Add tool tip support to audio dial to show values
author Chris Cannam
date Tue, 17 Oct 2006 13:04:49 +0000
parents 1016a8ceceda
children 75ce271d0edb
comparison
equal deleted inserted replaced
59:1016a8ceceda 60:06b3c3f437e6
175 m_playSpeed->setValue(100); 175 m_playSpeed->setValue(100);
176 m_playSpeed->setFixedWidth(24); 176 m_playSpeed->setFixedWidth(24);
177 m_playSpeed->setFixedHeight(24); 177 m_playSpeed->setFixedHeight(24);
178 m_playSpeed->setNotchesVisible(true); 178 m_playSpeed->setNotchesVisible(true);
179 m_playSpeed->setPageStep(10); 179 m_playSpeed->setPageStep(10);
180 m_playSpeed->setToolTip(tr("Playback speed: +0%")); 180 //!!! m_playSpeed->setToolTip(tr("Playback speed: +0%"));
181 m_playSpeed->setObjectName(tr("Playback Speed")); 181 m_playSpeed->setObjectName(tr("Playback Speedup"));
182 m_playSpeed->setDefaultValue(100); 182 m_playSpeed->setDefaultValue(100);
183 m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper(0, 200)); 183 m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper(0, 200));
184 m_playSpeed->setShowToolTip(true);
184 connect(m_playSpeed, SIGNAL(valueChanged(int)), 185 connect(m_playSpeed, SIGNAL(valueChanged(int)),
185 this, SLOT(playSpeedChanged(int))); 186 this, SLOT(playSpeedChanged(int)));
186 187
187 m_playSharpen = new QPushButton(frame); 188 m_playSharpen = new QPushButton(frame);
188 m_playSharpen->setToolTip(tr("Sharpen percussive transients")); 189 m_playSharpen->setToolTip(tr("Sharpen percussive transients"));
3083 3084
3084 void 3085 void
3085 MainWindow::playSpeedChanged(int position) 3086 MainWindow::playSpeedChanged(int position)
3086 { 3087 {
3087 PlaySpeedRangeMapper mapper(0, 200); 3088 PlaySpeedRangeMapper mapper(0, 200);
3088 float factor = mapper.getFactorForPosition(position); 3089
3089 float percent = mapper.getValueForPosition(position); 3090 float percent = m_playSpeed->mappedValue();
3090 3091
3091 // std::cerr << "speed = " << position << " factor = " << factor << std::endl; 3092 float factor = mapper.getFactorForValue(percent);
3092 3093
3093 bool slow = (position < 100); 3094 // float factor = mapper.getFactorForPosition(position);
3095 // float percent = mapper.getValueForPosition(position);
3096
3097 std::cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << std::endl;
3098
3099 //!!! bool slow = (position < 100);
3094 bool something = (position != 100); 3100 bool something = (position != 100);
3095 3101 /*!!!
3096 int pc = lrintf(percent); 3102 int pc = lrintf(percent);
3097 3103
3098 m_playSpeed->setToolTip(tr("Playback speed: %1%2%") 3104 m_playSpeed->setToolTip(tr("Playback speed: %1%2%")
3099 .arg(!slow ? "+" : "-") 3105 .arg(!slow ? "+" : "")
3100 .arg(pc)); 3106 .arg(pc));
3101 3107 */
3102 m_playSharpen->setEnabled(something); 3108 m_playSharpen->setEnabled(something);
3103 m_playMono->setEnabled(something); 3109 m_playMono->setEnabled(something);
3104 bool sharpen = (something && m_playSharpen->isChecked()); 3110 bool sharpen = (something && m_playSharpen->isChecked());
3105 bool mono = (something && m_playMono->isChecked()); 3111 bool mono = (something && m_playMono->isChecked());
3106 m_playSource->setTimeStretch(factor, sharpen, mono); 3112 m_playSource->setTimeStretch(factor, sharpen, mono);