aboutsummaryrefslogtreecommitdiffstats
path: root/cli-project/src/solo_tool_cli.py
blob: 5cc15378ddd9c636aa571f21fabbda66bc03281a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sys
import time

from solo_tool import SoloTool
from solo_tool.midi_controller_launchpad_mini import MidiController

def main():
    args = sys.argv[1:]
    if len(args) == 0:
        print("Please provide path to session file")
        sys.exit(1)

    soloTool = SoloTool()
    soloTool.loadSession(args[0])

    def tick():
        soloTool.tick()
        threading.Timer(0.1, tick).start()

    midiController = MidiController(soloTool)
    midiController.connect()

    try:
        while(True):
            time.sleep(0.1)
            soloTool.tick()
    except KeyboardInterrupt:
        pass
    finally:
        midiController.disconnect()
        
if __name__ == '__main__':
    main()