# HG changeset patch # User Chris Cannam # Date 1582203282 0 # Thu Feb 20 12:54:42 2020 +0000 # Node ID 1f775074537259a6c3d7a7f8c7cd41d3c38873b7 # Parent 5bba08afb40147aa3b6a4d03e7356a0e16f6c7ab Implement speed changing diff --git a/src/Interface.cpp b/src/Interface.cpp --- a/src/Interface.cpp +++ b/src/Interface.cpp @@ -34,14 +34,23 @@ auto pause = new QPushButton(tr("||")); mainLayout->addWidget(pause, 0, 3); + auto speed = new QDoubleSpinBox; + speed->setMinimum(0.1); + speed->setMaximum(100.0); + speed->setValue(1.0); + speed->setDecimals(2); + speed->setSingleStep(0.1); + mainLayout->addWidget(speed, 0, 4); + connect(open, SIGNAL(clicked()), this, SLOT(open())); connect(rewind, SIGNAL(clicked()), this, SLOT(rewind())); connect(play, SIGNAL(clicked()), this, SLOT(play())); connect(pause, SIGNAL(clicked()), this, SLOT(pause())); + connect(speed, SIGNAL(valueChanged(double)), this, SLOT(speedChanged(double))); m_filenameLabel = new QLabel; m_filenameLabel->setText(tr("")); - mainLayout->addWidget(m_filenameLabel, 1, 0, 1, 4); + mainLayout->addWidget(m_filenameLabel, 1, 0, 1, 5); setCentralWidget(mainFrame); } @@ -102,23 +111,10 @@ { m_processor->rewind(); } -/* + void -Interface::speedUp() +Interface::speedChanged(double ratio) { - int v = m_speed->value(); - v = (v/2) * 2 + 2; // target is always even - m_speed->setValue(v); - speedChange(m_speed->value()); + m_processor->setTimeRatio(ratio); } -void -Interface::slowDown() -{ - int v = m_speed->value(); - v = (v/2) * 2 - 2; // target is always even - m_speed->setValue(v); - speedChange(m_speed->value()); -} -*/ - diff --git a/src/Interface.h b/src/Interface.h --- a/src/Interface.h +++ b/src/Interface.h @@ -31,12 +31,10 @@ void play(); void pause(); void rewind(); -// void speedUp(); -// void slowDown(); + void speedChanged(double); private: Processor *m_processor; - QDoubleSpinBox *m_speedSpin; QLabel *m_filenameLabel; };