From d6403961e778db1f0f6a5e45147770714449fa8c Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sun, 9 Jan 2022 18:48:55 +0100 Subject: Fixed MIDI controller bug --- known-issues.md | 1 + midi_launchpad_mini_integrationtest.py | 21 +++++++++++++++++++++ player_mock.py | 1 + player_vlc.py | 1 + 4 files changed, 24 insertions(+) diff --git a/known-issues.md b/known-issues.md index d3e58a7..a7ab952 100644 --- a/known-issues.md +++ b/known-issues.md @@ -22,6 +22,7 @@ * Add buttons to write current playback position to A or B limit sliders * Switching between songs and AB limits does not work properly * AB controller only keeps track of limit index, not current song => when song changes, index is invalid but not properly reset +* Changing song while playing does not update play/pause button LED on MIDI controller # Use Cases diff --git a/midi_launchpad_mini_integrationtest.py b/midi_launchpad_mini_integrationtest.py index 35ac087..615ef49 100644 --- a/midi_launchpad_mini_integrationtest.py +++ b/midi_launchpad_mini_integrationtest.py @@ -345,3 +345,24 @@ def test_initializationMessages(uut, midiWrapperMock): sentMessagesSet = set(midiWrapperMock.sentMessages) assert sentMessagesSet == expectedMessages +def test_playingFeedbackWhenChangingSong(uut, midiWrapperMock, soloTool, playerMock): + nextSongButton = 119 + previousSongButton = 118 + playPauseButton = 112 + songs = [ + "test.flac", + "test.mp3" + ] + for s in songs: + soloTool.addSong(s) + uut.connect() + + soloTool.setSong(0) + soloTool.play() + assert playerMock.state == PlayerMock.PLAYING + assert midiWrapperMock.getLatestMessage() == (playPauseButton, LED_GREEN, 0) + + soloTool.nextSong() + assert playerMock.state == PlayerMock.STOPPED + assert midiWrapperMock.getLatestMessage() == (playPauseButton, LED_YELLOW, 0) + diff --git a/player_mock.py b/player_mock.py index ee3801d..3162e0f 100644 --- a/player_mock.py +++ b/player_mock.py @@ -55,6 +55,7 @@ class Player(): return self.volume def setCurrentSong(self, path): + self.stop() self.currentSong = path def setPlayingStateChangedCallback(self, callback): diff --git a/player_vlc.py b/player_vlc.py index a7244bb..283102e 100644 --- a/player_vlc.py +++ b/player_vlc.py @@ -36,6 +36,7 @@ class Player: return self._player.audio_get_volume() / 100.0 def setCurrentSong(self, path): + self._player.stop() media = vlc.Media(path) self._player.set_media(media) -- cgit v1.2.3