From fa5b0f760892bcbc2548ec0e516a716bd854ceef Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Thu, 4 Nov 2021 22:02:06 +0100 Subject: Added MIDI support, test files, removed mediaplayer example --- solo-tool.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'solo-tool.py') 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") -- cgit v1.2.3