From c2017d9599e413e13967b0a6268d92e19451249a Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Mon, 27 Dec 2021 21:01:58 +0100 Subject: Added playback speed slider --- solo_tool_qt.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'solo_tool_qt.py') 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) -- cgit v1.2.3