aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-01-09 18:48:55 +0100
committerEddy Pedroni <eddy@0xf7.com>2022-01-09 18:48:55 +0100
commitd6403961e778db1f0f6a5e45147770714449fa8c (patch)
tree6c5f5c5820ac5f6b2b4b5072496c5d2f22f0148f
parentc2d40c6dc0c14edd96bf9832d097347b15f672e3 (diff)
Fixed MIDI controller bug
-rw-r--r--known-issues.md1
-rw-r--r--midi_launchpad_mini_integrationtest.py21
-rw-r--r--player_mock.py1
-rw-r--r--player_vlc.py1
4 files changed, 24 insertions, 0 deletions
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)