diff options
Diffstat (limited to 'solo-tool.py')
-rw-r--r-- | solo-tool.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/solo-tool.py b/solo-tool.py index 90616a8..26ddca2 100644 --- a/solo-tool.py +++ b/solo-tool.py @@ -6,6 +6,8 @@ from PyQt5.QtMultimediaWidgets import * from MainWindow import Ui_MainWindow +import midi + class PlaylistModel(QAbstractListModel): def __init__(self, playlist, *args, **kwargs): super(PlaylistModel, self).__init__(*args, **kwargs) @@ -84,6 +86,9 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.saveSessionButton.pressed.connect(self.saveSession) self.loadSessionButton.pressed.connect(self.loadSession) + self.initMidiButton.pressed.connect(self.initMidi) + self.midiEnabled = False + self.show() def playlistSelectionChanged(self, ix): @@ -169,6 +174,19 @@ class MainWindow(QMainWindow, Ui_MainWindow): with open(path, "w") as f: json.dump(self.internalState, f) + def initMidi(self): + midi.midi_init() + self.midiEnabled = True + + # play pause + midi.button_on(midi.lp_key[0][0], (midi.GREEN if self.player.state() == QMediaPlayer.PlayingState else midi.RED)) + def midiPlayPause(): + midi.button_on(midi.lp_key[0][0], (midi.RED if self.player.state() == QMediaPlayer.PlayingState else midi.GREEN)) + self.playPauseButton.click() + + midi.on_press(midi.lp_key[0][0], midiPlayPause) + + if __name__ == '__main__': app = QApplication([]) app.setApplicationName("Solo Tool") |