From b609b4ce55104c77a3f69366874a3e25e3061172 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Thu, 3 Feb 2022 20:20:30 +0100 Subject: Added AB toggle button to MIDI interface --- abcontroller.py | 3 ++ abcontroller_unittest.py | 4 +++ diagram.drawio | 2 +- known-issues.md | 1 + midi_controller_launchpad_mini.py | 21 ++++++++++--- midi_launchpad_mini_integrationtest.py | 57 ++++++++++++++++++++++------------ notifier.py | 1 + notifier_unittest.py | 1 + solo_tool.py | 10 ++++++ solo_tool_cli.py | 10 +++++- solo_tool_cli_integrationtest.py | 4 +-- solo_tool_integrationtest.py | 38 +++++++++++++++++++++++ 12 files changed, 124 insertions(+), 28 deletions(-) diff --git a/abcontroller.py b/abcontroller.py index 99bd9d7..cec9fb2 100644 --- a/abcontroller.py +++ b/abcontroller.py @@ -66,6 +66,9 @@ class ABController: def setEnable(self, enable): self._enabled = enable + def isEnabled(self): + return self._enabled + def getStoredLimits(self, song): return self._limits.get(song) diff --git a/abcontroller_unittest.py b/abcontroller_unittest.py index f9e947d..9fdcbc3 100644 --- a/abcontroller_unittest.py +++ b/abcontroller_unittest.py @@ -103,11 +103,15 @@ def test_disableAbRepeat(): uut.loadLimits(0) assert uut.getLoadedIndex() == 0 + assert uut.isEnabled() + uut.setEnable(False) checkLimits(uut, abLimits.a, abLimits.b, fail=True) + assert not uut.isEnabled() uut.setEnable(True) checkLimits(uut, abLimits.a, abLimits.b) + assert uut.isEnabled() def test_storeLimitsToSpecificSong(): song = "/path/to/song" diff --git a/diagram.drawio b/diagram.drawio index 935a914..e3d1846 100644 --- a/diagram.drawio +++ b/diagram.drawio @@ -1 +1 @@ -7V3vf5o8EP9rfNl+IPz0ZbXd1j7d1q3d1u4dSkRWJBai1f31D0hQIFdqlZ9lryQhhCR337vL3QV70nC2+ugZ8+lnYmKnhwRz1ZPOewiJMhKCn7BmHdXofRRVWJ5tska7ilv7L2aV7DlrYZvYTzWkhDjUnqcrx8R18Zim6gzPI8/pZhPipN86N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+yjRE5Gv7ytCRHZ9RY7IEOB8RjKp1blikjMyBDjhiJgU61wxySEZApxxxEyqda6Y5JQMAU45FJNqnSsmOSZDgHOONo5l+aYNZPoU8+qzdOyeqb/X82XvyZWtT/2AA+e5A3yOSDoA4MfZEwDTUEoP/ICfL4T9gV/fM/CHwcCAH3By5ntD/wzwX99XpG9iDQ34AWdnkknx0RWTHvgBZ0+R4CkmPfADzp5iJuVHV0x64AecPSkm1UdXTHrgB5w9neq77NQkB2XA6dNpuXJTkx6U21J9NwT1B+XDMr5fUtYDI2WBsxrfm/BnSPkGzqJEZT00VBY4r5FMKpCumPSoLHDeETGpQLpi0qOywHlH2xKAm5j0qCxw3qEufJe9lZj0qCxw3uGpYUMAH6h3T6eF6T394csgSuMDoh564hee/AmYRtIBED9+0OD5Gvks8cPlIfJa2kdqYPzefjjQ5XfRn98ZS09P49LTsYRJedAVk57GW4Lt0jiT8qArJj2NS5zatHcqbmLS07j09C1hUhx0xaSncYlTm8OrtKgbRmk2uV2v8MjDld8goWtpgrxFjsnS19TE83HZeW+t7GL6WfxFD+ISP8jwtMo4C+KCDw3GydBAHOdAvg8CzoE4Y+npQdzT5bF1Bzcx6UHc04cxYroy6UHc04kxYfL+vSsmPYh7ejEqJjU7V0x6EPd0Yzx8J+VGpoXZVTeHcMJaNfIUOYR7mj2C7/M1v6euDuAD8tUVAbzefetZfhjrdH6XT/8D \ No newline at end of file diff --git a/known-issues.md b/known-issues.md index b1bac9e..ae248f5 100644 --- a/known-issues.md +++ b/known-issues.md @@ -27,6 +27,7 @@ * Key mapping in Qt to jump to A * Space bar in principle * Not so easy to do actually, used Super L instead +* AB repeat toggle in MIDI controller # Use Cases diff --git a/midi_controller_launchpad_mini.py b/midi_controller_launchpad_mini.py index 6790cec..0cc952c 100644 --- a/midi_controller_launchpad_mini.py +++ b/midi_controller_launchpad_mini.py @@ -28,12 +28,14 @@ class MidiController: self._soloTool.registerPlayingStateCallback(self._updatePlayPauseButton) self._soloTool.registerPlaybackVolumeCallback(self._updateVolumeRow) self._soloTool.registerPlaybackRateCallback(self._updateRateRow) + self._soloTool.registerAbLimitEnabledCallback(self._updateToggleAbLimitEnableButton) def _registerHandlers(self): self._handlers = { - 96 : self._stop, + 96 : self._soloTool.stop, + 99 : self._soloTool.jumpToA, 112 : self._playPause, - 101 : self._soloTool.jumpToA, + 101 : self._toggleAbLimitEnable, 102 : self._soloTool.previousStoredAbLimits, 103 : self._soloTool.nextStoredAbLimits, 118 : self._soloTool.previousSong, @@ -66,8 +68,8 @@ class MidiController: else: self._soloTool.play() - def _stop(self): - self._soloTool.stop() + def _toggleAbLimitEnable(self): + self._soloTool.setAbLimitEnable(not self._soloTool.isAbLimitEnabled()) def _updatePlayPauseButton(self, playing): if playing: @@ -75,6 +77,12 @@ class MidiController: else: self._setButtonLED(7, 0, MidiController.LED_YELLOW) + def _updateToggleAbLimitEnableButton(self, enabled): + if enabled: + self._setButtonLED(6, 5, MidiController.LED_GREEN) + else: + self._setButtonLED(6, 5, MidiController.LED_RED) + def _updateVolumeRow(self, volume): t1 = int(round(volume / MidiController.PLAYBACK_VOLUME_STEP, 1)) t2 = int(round(MidiController.MIN_PLAYBACK_VOLUME / MidiController.PLAYBACK_VOLUME_STEP, 1)) @@ -123,8 +131,11 @@ class MidiController: self._setButtonLED(6, 0, MidiController.LED_RED) self._updatePlayPauseButton(self._soloTool.isPlaying()) + # AB repeat toggle + self._updateToggleAbLimitEnableButton(self._soloTool.isAbLimitEnabled()) + # AB control - self._setButtonLED(6, 5, MidiController.LED_YELLOW) + self._setButtonLED(6, 3, MidiController.LED_YELLOW) self._setButtonLED(6, 6, MidiController.LED_RED) self._setButtonLED(6, 7, MidiController.LED_GREEN) diff --git a/midi_launchpad_mini_integrationtest.py b/midi_launchpad_mini_integrationtest.py index 615ef49..e9bc6b5 100644 --- a/midi_launchpad_mini_integrationtest.py +++ b/midi_launchpad_mini_integrationtest.py @@ -9,6 +9,15 @@ LED_YELLOW = 126 LED_GREEN = 124 LED_OFF = 0 +nextSongButton = 119 +previousSongButton = 118 +playPauseButton = 112 +stopButton = 96 +nextLimitButton = 103 +previousLimitButton = 102 +abToggleButton = 101 +jumpToAButton = 99 + class MidiWrapperMock: def __init__(self): self.callback = None @@ -56,8 +65,6 @@ def test_connect(uut, midiWrapperMock): assert midiWrapperMock.connectedDevice == expectedDevice def test_startStopAndPauseButtons(uut, midiWrapperMock, playerMock): - playPauseButton = 112 - stopButton = 96 uut.connect() assert playerMock.state == PlayerMock.STOPPED @@ -88,8 +95,6 @@ def test_startStopAndPauseButtons(uut, midiWrapperMock, playerMock): assert playerMock.state == PlayerMock.STOPPED def test_startPauseButtonLed(uut, midiWrapperMock, playerMock, soloTool): - playPauseButton = 112 - stopButton = 96 uut.connect() assert playerMock.state == PlayerMock.STOPPED @@ -110,6 +115,26 @@ def test_startPauseButtonLed(uut, midiWrapperMock, playerMock, soloTool): playerMock.simulatePlayingStateChanged() assert midiWrapperMock.getLatestMessage() == (playPauseButton, MidiController.LED_GREEN, 0) +def test_abToggleButton(uut, midiWrapperMock, soloTool): + uut.connect() + + midiWrapperMock.simulateInput(abToggleButton) + assert soloTool.isAbLimitEnabled() + assert midiWrapperMock.getLatestMessage() == (abToggleButton, MidiController.LED_GREEN, 0) + + midiWrapperMock.simulateInput(abToggleButton) + assert not soloTool.isAbLimitEnabled() + assert midiWrapperMock.getLatestMessage() == (abToggleButton, MidiController.LED_RED, 0) + +def test_abToggleButtonLed(uut, midiWrapperMock, soloTool): + uut.connect() + + soloTool.setAbLimitEnable(True) + assert midiWrapperMock.getLatestMessage() == (abToggleButton, MidiController.LED_GREEN, 0) + + soloTool.setAbLimitEnable(False) + assert midiWrapperMock.getLatestMessage() == (abToggleButton, MidiController.LED_RED, 0) + def test_jumpToAButton(uut, midiWrapperMock, soloTool, playerMock): ab = (0.5, 0.6) uut.connect() @@ -117,12 +142,10 @@ def test_jumpToAButton(uut, midiWrapperMock, soloTool, playerMock): soloTool.setAbLimits(ab[0], ab[1]) assert playerMock.position == 0.0 - midiWrapperMock.simulateInput(101) + midiWrapperMock.simulateInput(jumpToAButton) assert playerMock.position == ab[0] def test_previousAndNextSongButtons(uut, midiWrapperMock, soloTool, playerMock): - nextSongButton = 119 - previousSongButton = 118 songs = [ "test.flac", "test.mp3" @@ -145,8 +168,6 @@ def test_previousAndNextSongButtons(uut, midiWrapperMock, soloTool, playerMock): assert playerMock.currentSong == songs[0] def test_previousAndNextAbButtons(uut, midiWrapperMock, soloTool, playerMock): - nextLimitButton = 103 - previousLimitButton = 102 song = "test.flac" abLimits = [ [0.2, 0.4], @@ -330,13 +351,14 @@ def test_initializationMessages(uut, midiWrapperMock): [(i, LED_GREEN, 0) for i in range(0, 6)] + # volume row [(i, LED_YELLOW, 0) for i in range(16, 22)] + # playback rate row [ - (96, LED_RED, 0), - (101, LED_YELLOW, 0), - (102, LED_RED, 0), - (103, LED_GREEN, 0), - (112, LED_YELLOW, 0), - (118, LED_RED, 0), - (119, LED_GREEN, 0) + (stopButton, LED_RED, 0), + (playPauseButton, LED_YELLOW, 0), + (abToggleButton, LED_RED, 0), + (jumpToAButton, LED_YELLOW, 0), + (previousLimitButton, LED_RED, 0), + (nextLimitButton, LED_GREEN, 0), + (previousSongButton, LED_RED, 0), + (nextSongButton, LED_GREEN, 0) ] ) @@ -346,9 +368,6 @@ def test_initializationMessages(uut, midiWrapperMock): assert sentMessagesSet == expectedMessages def test_playingFeedbackWhenChangingSong(uut, midiWrapperMock, soloTool, playerMock): - nextSongButton = 119 - previousSongButton = 118 - playPauseButton = 112 songs = [ "test.flac", "test.mp3" diff --git a/notifier.py b/notifier.py index 06b4434..fae41b9 100644 --- a/notifier.py +++ b/notifier.py @@ -5,6 +5,7 @@ class Notifier: PLAYBACK_RATE_EVENT = 2 CURRENT_SONG_EVENT = 3 CURRENT_AB_EVENT = 4 + AB_LIMIT_ENABLED_EVENT = 5 def __init__(self, player): self._callbacks = dict() diff --git a/notifier_unittest.py b/notifier_unittest.py index 4aff8f4..b27a17f 100644 --- a/notifier_unittest.py +++ b/notifier_unittest.py @@ -38,6 +38,7 @@ def test_allEvents(uut): checkEvent(uut, Notifier.PLAYBACK_RATE_EVENT) checkEvent(uut, Notifier.CURRENT_SONG_EVENT) checkEvent(uut, Notifier.CURRENT_AB_EVENT) + checkEvent(uut, Notifier.AB_LIMIT_ENABLED_EVENT) def test_eventWithoutRegisteredCallbacks(uut): uut.notify(Notifier.PLAYING_STATE_EVENT, 0) diff --git a/solo_tool.py b/solo_tool.py index 4ea081d..6cb1a77 100644 --- a/solo_tool.py +++ b/solo_tool.py @@ -74,7 +74,14 @@ class SoloTool: return list() def setAbLimitEnable(self, enable): + previous = self._abController.isEnabled() self._abController.setEnable(enable) + new = self._abController.isEnabled() + if previous != new: + self._notifier.notify(Notifier.AB_LIMIT_ENABLED_EVENT, new) + + def isAbLimitEnabled(self): + return self._abController.isEnabled() def nextStoredAbLimits(self): previous = self._abController.getLoadedIndex() @@ -152,3 +159,6 @@ class SoloTool: def registerCurrentAbLimitsCallback(self, callback): self._notifier.registerCallback(Notifier.CURRENT_AB_EVENT, callback) + def registerAbLimitEnabledCallback(self, callback): + self._notifier.registerCallback(Notifier.AB_LIMIT_ENABLED_EVENT, callback) + diff --git a/solo_tool_cli.py b/solo_tool_cli.py index 8d53a33..43e3a9d 100644 --- a/solo_tool_cli.py +++ b/solo_tool_cli.py @@ -1,10 +1,12 @@ import sys +import time +import threading from solo_tool import SoloTool from midi_controller_launchpad_mini import MidiController class SoloToolCLI: - def __init__(self, sessionJson, soloToolOverride=None, midiOverride=None): + def __init__(self, sessionJson, soloToolOverride=None, midiOverride=None, tickEnable=True): self._soloTool = SoloTool() if soloToolOverride is None else soloToolOverride self._soloTool.loadSession(sessionJson) self._midiController = MidiController(self._soloTool) if midiOverride is None else midiOverride @@ -12,6 +14,8 @@ class SoloToolCLI: "song" : self._song, "midi" : self._midi } + if tickEnable: + self._tick() def input(self, commandString): split = commandString.strip().split(" ") @@ -34,6 +38,10 @@ class SoloToolCLI: else: print("Supported device: Novation Launchpad Mini MkII") + def _tick(self): + self._soloTool.tick() + threading.Timer(0.1, self._tick).start() + def main(args): if len(args) == 0: print("Please provide path to session file") diff --git a/solo_tool_cli_integrationtest.py b/solo_tool_cli_integrationtest.py index 9134dcf..25ef131 100644 --- a/solo_tool_cli_integrationtest.py +++ b/solo_tool_cli_integrationtest.py @@ -27,7 +27,7 @@ def mockMidi(soloTool): @pytest.fixture def uut(soloTool, mockMidi): - return SoloToolCLI("test_session.json", soloToolOverride=soloTool, midiOverride=mockMidi) + return SoloToolCLI("test_session.json", soloToolOverride=soloTool, midiOverride=mockMidi, tickEnable=False) def test_songSelection(uut, soloTool, mockPlayer): expectedOutput = """\ @@ -56,7 +56,6 @@ Songs: uut.input("song") - assert buf.getvalue() == expectedOutput def test_connectMidi(uut, mockMidi): @@ -73,3 +72,4 @@ Connecting to MIDI device... assert mockMidi.connected assert buf.getvalue() == expectedOutput + diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index ee99303..5731eac 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -137,6 +137,15 @@ def test_addAndSetAbLimits(uut, mockPlayer): uut.tick() assert mockPlayer.position == 0.1 +def test_abLimitEnabledGetter(uut): + assert not uut.isAbLimitEnabled() + + uut.setAbLimitEnable(True) + assert uut.isAbLimitEnabled() + + uut.setAbLimitEnable(False) + assert not uut.isAbLimitEnabled() + def test_multipleSongsAndAbLimits(uut, mockPlayer): songs = [ "test.flac", @@ -554,3 +563,32 @@ def test_currentAbNotification(uut): uut.nextStoredAbLimits() assert not called + +def test_abLimitEnabledNotification(uut): + called = False + receivedValue = None + def callback(value): + nonlocal called, receivedValue + called = True + receivedValue = value + + uut.registerAbLimitEnabledCallback(callback) + assert not called + + uut.setAbLimitEnable(False) + assert not called + assert receivedValue is None + + uut.setAbLimitEnable(True) + assert called + assert receivedValue == True + called = False + receivedValue = None + + uut.setAbLimitEnable(True) + assert not called + assert receivedValue is None + + uut.setAbLimitEnable(False) + assert called + assert receivedValue == False -- cgit v1.2.3