Mercurial > hg > sonic-visualiser
changeset 1039:e517197049bc 3.0-integration
Merge
author | Chris Cannam |
---|---|
date | Tue, 04 Aug 2015 16:28:21 +0100 |
parents | 0f46daf55706 (diff) 7b2f70bcebe1 (current diff) |
children | 1f4e40be5aa2 |
files | .hgsubstate |
diffstat | 2 files changed, 30 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgsubstate Tue Aug 04 10:49:24 2015 +0100 +++ b/.hgsubstate Tue Aug 04 16:28:21 2015 +0100 @@ -1,6 +1,6 @@ d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay 06ed2d275a956fd1224376f74dfe170c19d3b2c2 icons/scalable 55ece8862b6d3a54aad271a53f9c1615e5d3bcf8 sv-dependency-builds -1b4e5a567d5819afabbf4ec79647cf6e608e019b svapp +85e7d2418d9acf74ffe27263f6245d8ea187f5a1 svapp 7f8eb7379280d39bdd199feba71a364ff5df05a0 svcore b0662a3c4679c651616f02551d6173c318136a9c svgui
--- a/main/MainWindow.cpp Tue Aug 04 10:49:24 2015 +0100 +++ b/main/MainWindow.cpp Tue Aug 04 16:28:21 2015 +0100 @@ -235,15 +235,15 @@ m_playSpeed = new AudioDial(frame); m_playSpeed->setMinimum(0); - m_playSpeed->setMaximum(200); - m_playSpeed->setValue(100); + m_playSpeed->setMaximum(120); + m_playSpeed->setValue(60); m_playSpeed->setFixedWidth(32); m_playSpeed->setFixedHeight(32); m_playSpeed->setNotchesVisible(true); m_playSpeed->setPageStep(10); - m_playSpeed->setObjectName(tr("Playback Speedup")); - m_playSpeed->setDefaultValue(100); - m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper(0, 200)); + m_playSpeed->setObjectName(tr("Playback Speed")); + m_playSpeed->setRangeMapper(new PlaySpeedRangeMapper); + m_playSpeed->setDefaultValue(60); m_playSpeed->setShowToolTip(true); connect(m_playSpeed, SIGNAL(valueChanged(int)), this, SLOT(playSpeedChanged(int))); @@ -3869,26 +3869,38 @@ void MainWindow::playSpeedChanged(int position) { - PlaySpeedRangeMapper mapper(0, 200); + PlaySpeedRangeMapper mapper; double percent = m_playSpeed->mappedValue(); double factor = mapper.getFactorForValue(percent); -// cerr << "speed = " << position << " percent = " << percent << " factor = " << factor << endl; - - bool something = (position != 100); - - int pc = int(lrint(percent)); - - if (!something) { +// cerr << "play speed position = " << position << " (range 0-120) percent = " << percent << " factor = " << factor << endl; + + int centre = m_playSpeed->defaultValue(); + + // Percentage is shown to 0dp if >100, to 1dp if <100; factor is + // shown to 3sf + + char pcbuf[30]; + char facbuf[30]; + + if (position == centre) { contextHelpChanged(tr("Playback speed: Normal")); + } else if (position < centre) { + sprintf(pcbuf, "%.1f", percent); + sprintf(facbuf, "%.3g", 1.0 / factor); + contextHelpChanged(tr("Playback speed: %1% (%2x slower)") + .arg(pcbuf) + .arg(facbuf)); } else { - contextHelpChanged(tr("Playback speed: %1%2%") - .arg(position > 100 ? "+" : "") - .arg(pc)); + sprintf(pcbuf, "%.0f", percent); + sprintf(facbuf, "%.3g", factor); + contextHelpChanged(tr("Playback speed: %1% (%2x faster)") + .arg(pcbuf) + .arg(facbuf)); } - m_playSource->setTimeStretch(factor); + m_playSource->setTimeStretch(1.0 / factor); // factor is a speedup updateMenuStates(); }