From edb2ffc66231702c931429ab44ad5009abb8c128 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Tue, 4 Jan 2022 13:49:38 +0100 Subject: Added proper volume and playback rate feedback, changed volume steps in MIDI interface --- solo_tool.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'solo_tool.py') diff --git a/solo_tool.py b/solo_tool.py index f52e074..7933fce 100644 --- a/solo_tool.py +++ b/solo_tool.py @@ -92,7 +92,13 @@ class SoloTool: return self._player.isPlaying() def setPlaybackRate(self, rate): + previousRate = self._player.getPlaybackRate() self._player.setPlaybackRate(rate) + if previousRate != rate: + self._notifier.notify(Notifier.PLAYBACK_RATE_EVENT) + + def getPlaybackRate(self): + return self._player.getPlaybackRate() def setPlaybackPosition(self, position): self._player.setPlaybackPosition(position) @@ -101,8 +107,20 @@ class SoloTool: return self._player.getPlaybackPosition() def setPlaybackVolume(self, volume): + previousVolume = self._player.getPlaybackVolume() self._player.setPlaybackVolume(volume) + if previousVolume != volume: + self._notifier.notify(Notifier.PLAYBACK_VOLUME_EVENT) + + def getPlaybackVolume(self): + return self._player.getPlaybackVolume() def registerPlayingStateCallback(self, callback): self._notifier.registerCallback(Notifier.PLAYING_STATE_EVENT, callback) + def registerPlaybackVolumeCallback(self, callback): + self._notifier.registerCallback(Notifier.PLAYBACK_VOLUME_EVENT, callback) + + def registerPlaybackRateCallback(self, callback): + self._notifier.registerCallback(Notifier.PLAYBACK_RATE_EVENT, callback) + -- cgit v1.2.3