diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2021-11-04 22:02:06 +0100 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2021-11-04 22:02:06 +0100 |
commit | fa5b0f760892bcbc2548ec0e516a716bd854ceef (patch) | |
tree | d90a9ecc50b6c445697b9440fa0e6c356594ea97 /solo-tool.py | |
parent | 27f908340a5b8d3c8a9f3354f99712be5a0f739c (diff) |
Added MIDI support, test files, removed mediaplayer example
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") |