aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2021-12-27 21:01:58 +0100
committerEddy Pedroni <eddy@0xf7.com>2021-12-27 21:01:58 +0100
commitc2017d9599e413e13967b0a6268d92e19451249a (patch)
treeeba73a86704d9a83f90f18c683720a811e06d3a7
parentf52e40f899567d5d67a4cb2dcd75872ee038aaf8 (diff)
Added playback speed slider
-rw-r--r--MainWindow.py4
-rw-r--r--mainwindow.ui7
-rw-r--r--solo_tool_qt.py10
3 files changed, 21 insertions, 0 deletions
diff --git a/MainWindow.py b/MainWindow.py
index 5cec554..0dde7f0 100644
--- a/MainWindow.py
+++ b/MainWindow.py
@@ -69,6 +69,10 @@ class Ui_MainWindow(object):
self.addSongButton = QtWidgets.QPushButton(self.centralwidget)
self.addSongButton.setObjectName("addSongButton")
self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.addSongButton)
+ self.rateSlider = QtWidgets.QSlider(self.centralwidget)
+ self.rateSlider.setOrientation(QtCore.Qt.Horizontal)
+ self.rateSlider.setObjectName("rateSlider")
+ self.formLayout.setWidget(12, QtWidgets.QFormLayout.FieldRole, self.rateSlider)
self.horizontalLayout.addLayout(self.formLayout)
self.verticalLayout.addLayout(self.horizontalLayout)
self.centralWidgetLayout.addLayout(self.verticalLayout)
diff --git a/mainwindow.ui b/mainwindow.ui
index 771d66d..236460f 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -114,6 +114,13 @@
</property>
</widget>
</item>
+ <item row="12" column="1">
+ <widget class="QSlider" name="rateSlider">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
diff --git a/solo_tool_qt.py b/solo_tool_qt.py
index 8678800..bca71d0 100644
--- a/solo_tool_qt.py
+++ b/solo_tool_qt.py
@@ -6,6 +6,7 @@ from MainWindow import Ui_MainWindow
from solo_tool import SoloTool
POSITION_FACTOR = 100000
+RATE_FACTOR = 10
UI_REFRESH_PERIOD_MS = 500
class PlaylistModel(QAbstractListModel):
@@ -63,6 +64,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.bSlider.setMaximum(POSITION_FACTOR)
self.bSlider.sliderReleased.connect(self.abSliderReleased)
+ self.rateSlider.setRange(int(0.5 * RATE_FACTOR), int(1.5 * RATE_FACTOR))
+ self.rateSlider.setSingleStep(int(0.1 * RATE_FACTOR))
+ self.rateSlider.setValue(int(1.0 * RATE_FACTOR))
+ self.rateSlider.sliderReleased.connect(self.rateSliderReleased)
+
self.playButton.pressed.connect(self.soloTool.play)
self.pauseButton.pressed.connect(self.soloTool.pause)
self.saveAbButton.pressed.connect(self.saveAbLimits)
@@ -126,6 +132,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.soloTool.setAbLimits(a, b)
self.clearAbListSelection()
+ def rateSliderReleased(self):
+ rate = self.rateSlider.value() / float(RATE_FACTOR)
+ self.soloTool.setPlaybackRate(rate)
+
def playlistSelectionChanged(self, i):
index = i.indexes()[0].row()
self.soloTool.setSong(index)